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

Unified Diff: third_party/WebKit/Source/modules/serviceworkers/NavigatorServiceWorker.cpp

Issue 2556893003: Remove ContextLifecycleObserver from NavigatorServiceWorker (Closed)
Patch Set: temp Created 4 years 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: third_party/WebKit/Source/modules/serviceworkers/NavigatorServiceWorker.cpp
diff --git a/third_party/WebKit/Source/modules/serviceworkers/NavigatorServiceWorker.cpp b/third_party/WebKit/Source/modules/serviceworkers/NavigatorServiceWorker.cpp
index cd8b179cb1c56c988ee0a3a816570919f6b8557c..73160f042ade6669ce253c8138413baca46ac274 100644
--- a/third_party/WebKit/Source/modules/serviceworkers/NavigatorServiceWorker.cpp
+++ b/third_party/WebKit/Source/modules/serviceworkers/NavigatorServiceWorker.cpp
@@ -12,9 +12,7 @@
namespace blink {
-NavigatorServiceWorker::NavigatorServiceWorker(Navigator& navigator)
- : ContextLifecycleObserver(navigator.frame() ? navigator.frame()->document()
- : nullptr) {}
+NavigatorServiceWorker::NavigatorServiceWorker(Navigator& navigator) {}
NavigatorServiceWorker* NavigatorServiceWorker::from(Document& document) {
if (!document.frame() || !document.frame()->domWindow())
@@ -105,21 +103,23 @@ ServiceWorkerContainer* NavigatorServiceWorker::serviceWorker(
return nullptr;
}
if (!m_serviceWorker && frame) {
+ // We need to create a new ServiceWorkerContainer when the frame
+ // navigates to a new document. In practice, this happens only when the
+ // frame navigates from the initial empty page to a new same-origin page.
DCHECK(frame->domWindow());
m_serviceWorker = ServiceWorkerContainer::create(
- frame->domWindow()->getExecutionContext());
+ frame->domWindow()->getExecutionContext(), this);
}
return m_serviceWorker.get();
}
-void NavigatorServiceWorker::contextDestroyed() {
+void NavigatorServiceWorker::clearServiceWorker() {
m_serviceWorker = nullptr;
}
DEFINE_TRACE(NavigatorServiceWorker) {
visitor->trace(m_serviceWorker);
Supplement<Navigator>::trace(visitor);
- ContextLifecycleObserver::trace(visitor);
}
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698