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

Side by Side Diff: third_party/WebKit/Source/modules/serviceworkers/NavigatorServiceWorker.cpp

Issue 2651613002: Use a new Supplement constructor for ServiceWorkerRegistration supplements (Closed)
Patch Set: temp Created 3 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/modules/push_messaging/ServiceWorkerRegistrationPush.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "modules/serviceworkers/NavigatorServiceWorker.h" 5 #include "modules/serviceworkers/NavigatorServiceWorker.h"
6 6
7 #include "core/dom/Document.h" 7 #include "core/dom/Document.h"
8 #include "core/frame/LocalDOMWindow.h" 8 #include "core/frame/LocalDOMWindow.h"
9 #include "core/frame/LocalFrame.h" 9 #include "core/frame/LocalFrame.h"
10 #include "core/frame/Navigator.h" 10 #include "core/frame/Navigator.h"
11 #include "modules/serviceworkers/ServiceWorkerContainer.h" 11 #include "modules/serviceworkers/ServiceWorkerContainer.h"
12 12
13 namespace blink { 13 namespace blink {
14 14
15 NavigatorServiceWorker::NavigatorServiceWorker(Navigator& navigator) {} 15 NavigatorServiceWorker::NavigatorServiceWorker(Navigator& navigator)
16 : Supplement<Navigator>(navigator) {}
16 17
17 NavigatorServiceWorker* NavigatorServiceWorker::from(Document& document) { 18 NavigatorServiceWorker* NavigatorServiceWorker::from(Document& document) {
18 if (!document.frame() || !document.frame()->domWindow()) 19 if (!document.frame() || !document.frame()->domWindow())
19 return nullptr; 20 return nullptr;
20 Navigator& navigator = *document.frame()->domWindow()->navigator(); 21 Navigator& navigator = *document.frame()->domWindow()->navigator();
21 return &from(navigator); 22 return &from(navigator);
22 } 23 }
23 24
24 NavigatorServiceWorker& NavigatorServiceWorker::from(Navigator& navigator) { 25 NavigatorServiceWorker& NavigatorServiceWorker::from(Navigator& navigator) {
25 NavigatorServiceWorker* supplement = toNavigatorServiceWorker(navigator); 26 NavigatorServiceWorker* supplement = toNavigatorServiceWorker(navigator);
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 void NavigatorServiceWorker::clearServiceWorker() { 117 void NavigatorServiceWorker::clearServiceWorker() {
117 m_serviceWorker = nullptr; 118 m_serviceWorker = nullptr;
118 } 119 }
119 120
120 DEFINE_TRACE(NavigatorServiceWorker) { 121 DEFINE_TRACE(NavigatorServiceWorker) {
121 visitor->trace(m_serviceWorker); 122 visitor->trace(m_serviceWorker);
122 Supplement<Navigator>::trace(visitor); 123 Supplement<Navigator>::trace(visitor);
123 } 124 }
124 125
125 } // namespace blink 126 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/push_messaging/ServiceWorkerRegistrationPush.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698