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

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

Issue 2144213002: ServiceWorkerContainer should override contextDestroyed and clear m_provider (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
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"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 } 66 }
67 if (!m_serviceWorker && frame) { 67 if (!m_serviceWorker && frame) {
68 DCHECK(frame->domWindow()); 68 DCHECK(frame->domWindow());
69 m_serviceWorker = ServiceWorkerContainer::create(frame->domWindow()->get ExecutionContext()); 69 m_serviceWorker = ServiceWorkerContainer::create(frame->domWindow()->get ExecutionContext());
70 } 70 }
71 return m_serviceWorker.get(); 71 return m_serviceWorker.get();
72 } 72 }
73 73
74 void NavigatorServiceWorker::contextDestroyed() 74 void NavigatorServiceWorker::contextDestroyed()
75 { 75 {
76 if (m_serviceWorker) { 76 m_serviceWorker = nullptr;
77 m_serviceWorker->willBeDetachedFromFrame();
78 m_serviceWorker = nullptr;
79 }
80 } 77 }
81 78
82 DEFINE_TRACE(NavigatorServiceWorker) 79 DEFINE_TRACE(NavigatorServiceWorker)
83 { 80 {
84 visitor->trace(m_serviceWorker); 81 visitor->trace(m_serviceWorker);
85 Supplement<Navigator>::trace(visitor); 82 Supplement<Navigator>::trace(visitor);
86 ContextLifecycleObserver::trace(visitor); 83 ContextLifecycleObserver::trace(visitor);
87 } 84 }
88 85
89 } // namespace blink 86 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698