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/ServiceWorkerRegistration.h" | 5 #include "modules/serviceworkers/ServiceWorkerRegistration.h" |
6 | 6 |
7 #include "bindings/core/v8/CallbackPromiseAdapter.h" | 7 #include "bindings/core/v8/CallbackPromiseAdapter.h" |
8 #include "bindings/core/v8/ScriptPromise.h" | 8 #include "bindings/core/v8/ScriptPromise.h" |
9 #include "bindings/core/v8/ScriptState.h" | 9 #include "bindings/core/v8/ScriptState.h" |
10 #include "core/dom/DOMException.h" | 10 #include "core/dom/DOMException.h" |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 | 131 |
132 ServiceWorkerRegistration::ServiceWorkerRegistration( | 132 ServiceWorkerRegistration::ServiceWorkerRegistration( |
133 ExecutionContext* executionContext, | 133 ExecutionContext* executionContext, |
134 std::unique_ptr<WebServiceWorkerRegistration::Handle> handle) | 134 std::unique_ptr<WebServiceWorkerRegistration::Handle> handle) |
135 : ActiveScriptWrappable(this), | 135 : ActiveScriptWrappable(this), |
136 SuspendableObject(executionContext), | 136 SuspendableObject(executionContext), |
137 m_handle(std::move(handle)), | 137 m_handle(std::move(handle)), |
138 m_stopped(false) { | 138 m_stopped(false) { |
139 ASSERT(m_handle); | 139 ASSERT(m_handle); |
140 ASSERT(!m_handle->registration()->proxy()); | 140 ASSERT(!m_handle->registration()->proxy()); |
141 ThreadState::current()->registerPreFinalizer(this); | |
142 | 141 |
143 if (!executionContext) | 142 if (!executionContext) |
144 return; | 143 return; |
145 m_handle->registration()->setProxy(this); | 144 m_handle->registration()->setProxy(this); |
146 } | 145 } |
147 | 146 |
148 ServiceWorkerRegistration::~ServiceWorkerRegistration() {} | 147 ServiceWorkerRegistration::~ServiceWorkerRegistration() {} |
149 | 148 |
150 void ServiceWorkerRegistration::dispose() { | 149 void ServiceWorkerRegistration::dispose() { |
151 // Promptly clears a raw reference from content/ to an on-heap object | 150 // Promptly clears a raw reference from content/ to an on-heap object |
(...skipping 12 matching lines...) Expand all Loading... |
164 } | 163 } |
165 | 164 |
166 void ServiceWorkerRegistration::contextDestroyed() { | 165 void ServiceWorkerRegistration::contextDestroyed() { |
167 if (m_stopped) | 166 if (m_stopped) |
168 return; | 167 return; |
169 m_stopped = true; | 168 m_stopped = true; |
170 m_handle->registration()->proxyStopped(); | 169 m_handle->registration()->proxyStopped(); |
171 } | 170 } |
172 | 171 |
173 } // namespace blink | 172 } // namespace blink |
OLD | NEW |