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

Unified Diff: Source/modules/serviceworkers/NavigatorServiceWorker.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/serviceworkers/NavigatorServiceWorker.cpp
diff --git a/Source/modules/serviceworkers/NavigatorServiceWorker.cpp b/Source/modules/serviceworkers/NavigatorServiceWorker.cpp
index 29f4910c6659ee6dbaa833d43c6e500903b351af..4d2be39cb430da9ad27f14321af211f2dec05698 100644
--- a/Source/modules/serviceworkers/NavigatorServiceWorker.cpp
+++ b/Source/modules/serviceworkers/NavigatorServiceWorker.cpp
@@ -10,8 +10,8 @@
namespace WebCore {
-NavigatorServiceWorker::NavigatorServiceWorker(Navigator* navigator)
- : DOMWindowProperty(navigator->frame())
+NavigatorServiceWorker::NavigatorServiceWorker(Navigator& navigator)
+ : DOMWindowProperty(navigator.frame())
{
}
@@ -19,14 +19,14 @@ NavigatorServiceWorker::~NavigatorServiceWorker()
{
}
-NavigatorServiceWorker* NavigatorServiceWorker::from(Navigator* navigator)
+NavigatorServiceWorker& NavigatorServiceWorker::from(Navigator& navigator)
{
NavigatorServiceWorker* supplement = toNavigatorServiceWorker(navigator);
if (!supplement) {
supplement = new NavigatorServiceWorker(navigator);
provideTo(navigator, supplementName(), adoptPtr(supplement));
}
- return supplement;
+ return *supplement;
}
const char* NavigatorServiceWorker::supplementName()
@@ -34,9 +34,9 @@ const char* NavigatorServiceWorker::supplementName()
return "NavigatorServiceWorker";
}
-ServiceWorkerContainer* NavigatorServiceWorker::serviceWorker(Navigator* navigator)
+ServiceWorkerContainer* NavigatorServiceWorker::serviceWorker(Navigator& navigator)
{
- return NavigatorServiceWorker::from(navigator)->serviceWorker();
+ return NavigatorServiceWorker::from(navigator).serviceWorker();
}
ServiceWorkerContainer* NavigatorServiceWorker::serviceWorker()

Powered by Google App Engine
This is Rietveld 408576698