Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1464)

Unified Diff: Source/modules/notifications/DOMWindowNotifications.cpp

Issue 171333003: Pass implementation object to supplemental classes by reference (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/modules/notifications/DOMWindowNotifications.cpp
diff --git a/Source/modules/notifications/DOMWindowNotifications.cpp b/Source/modules/notifications/DOMWindowNotifications.cpp
index 48a53a53468f5f317aef4f9b89760151763d60cd..689d36f40e965216dbc60e29bd7791dd2abba214 100644
--- a/Source/modules/notifications/DOMWindowNotifications.cpp
+++ b/Source/modules/notifications/DOMWindowNotifications.cpp
@@ -37,8 +37,8 @@
namespace WebCore {
-DOMWindowNotifications::DOMWindowNotifications(DOMWindow* window)
- : DOMWindowProperty(window->frame())
+DOMWindowNotifications::DOMWindowNotifications(DOMWindow& window)
+ : DOMWindowProperty(window.frame())
, m_window(window)
{
}
@@ -52,19 +52,19 @@ const char* DOMWindowNotifications::supplementName()
return "DOMWindowNotifications";
}
-DOMWindowNotifications* DOMWindowNotifications::from(DOMWindow* window)
+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));
}
- return supplement;
+ return *supplement;
}
-NotificationCenter* DOMWindowNotifications::webkitNotifications(DOMWindow* window)
+NotificationCenter* DOMWindowNotifications::webkitNotifications(DOMWindow& window)
{
- return DOMWindowNotifications::from(window)->webkitNotifications();
+ return DOMWindowNotifications::from(window).webkitNotifications();
}
void DOMWindowNotifications::willDestroyGlobalObjectInFrame()
@@ -81,13 +81,13 @@ void DOMWindowNotifications::willDetachGlobalObjectFromFrame()
NotificationCenter* DOMWindowNotifications::webkitNotifications()
{
- if (!m_window->isCurrentlyDisplayedInFrame())
+ if (!m_window.isCurrentlyDisplayedInFrame())
return 0;
if (m_notificationCenter)
return m_notificationCenter.get();
- Document* document = m_window->document();
+ Document* document = m_window.document();
if (!document)
return 0;

Powered by Google App Engine
This is Rietveld 408576698