diff options
Diffstat (limited to 'Source/WebCore/Modules/notifications/DOMWindowNotifications.cpp')
-rw-r--r-- | Source/WebCore/Modules/notifications/DOMWindowNotifications.cpp | 42 |
1 files changed, 22 insertions, 20 deletions
diff --git a/Source/WebCore/Modules/notifications/DOMWindowNotifications.cpp b/Source/WebCore/Modules/notifications/DOMWindowNotifications.cpp index 21a6b9352..be9d681b3 100644 --- a/Source/WebCore/Modules/notifications/DOMWindowNotifications.cpp +++ b/Source/WebCore/Modules/notifications/DOMWindowNotifications.cpp @@ -11,10 +11,10 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR @@ -56,27 +56,28 @@ DOMWindowNotifications* DOMWindowNotifications::from(DOMWindow* window) { DOMWindowNotifications* supplement = static_cast<DOMWindowNotifications*>(Supplement<DOMWindow>::from(window, supplementName())); if (!supplement) { - supplement = new DOMWindowNotifications(window); - Supplement<DOMWindow>::provideTo(window, supplementName(), adoptPtr(supplement)); + auto newSupplement = std::make_unique<DOMWindowNotifications>(window); + supplement = newSupplement.get(); + provideTo(window, supplementName(), WTFMove(newSupplement)); } return supplement; } -NotificationCenter* DOMWindowNotifications::webkitNotifications(DOMWindow* window) +NotificationCenter* DOMWindowNotifications::webkitNotifications(DOMWindow& window) { - return DOMWindowNotifications::from(window)->webkitNotifications(); + return DOMWindowNotifications::from(&window)->webkitNotifications(); } -void DOMWindowNotifications::disconnectFrameForPageCache() +void DOMWindowNotifications::disconnectFrameForDocumentSuspension() { - m_suspendedNotificationCenter = m_notificationCenter.release(); - DOMWindowProperty::disconnectFrameForPageCache(); + m_suspendedNotificationCenter = WTFMove(m_notificationCenter); + DOMWindowProperty::disconnectFrameForDocumentSuspension(); } -void DOMWindowNotifications::reconnectFrameFromPageCache(Frame* frame) +void DOMWindowNotifications::reconnectFrameFromDocumentSuspension(Frame* frame) { - DOMWindowProperty::reconnectFrameFromPageCache(frame); - m_notificationCenter = m_suspendedNotificationCenter.release(); + DOMWindowProperty::reconnectFrameFromDocumentSuspension(frame); + m_notificationCenter = WTFMove(m_suspendedNotificationCenter); } void DOMWindowNotifications::willDestroyGlobalObjectInCachedFrame() @@ -100,23 +101,24 @@ void DOMWindowNotifications::willDetachGlobalObjectFromFrame() NotificationCenter* DOMWindowNotifications::webkitNotifications() { if (!m_window->isCurrentlyDisplayedInFrame()) - return 0; + return nullptr; if (m_notificationCenter) return m_notificationCenter.get(); - Document* document = m_window->document(); + auto* document = m_window->document(); if (!document) - return 0; + return nullptr; - Page* page = document->page(); + auto* page = document->page(); if (!page) - return 0; + return nullptr; - NotificationClient* provider = NotificationController::clientFrom(page); - if (provider) - m_notificationCenter = NotificationCenter::create(document, provider); + auto* provider = NotificationController::clientFrom(*page); + if (!provider) + return nullptr; + m_notificationCenter = NotificationCenter::create(*document, provider); return m_notificationCenter.get(); } |