OLD | NEW |
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 Loading... |
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 |
OLD | NEW |