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" |
11 #include "core/dom/ExceptionCode.h" | 11 #include "core/dom/ExceptionCode.h" |
12 #include "core/dom/ExecutionContext.h" | 12 #include "core/dom/ExecutionContext.h" |
13 #include "core/events/Event.h" | 13 #include "core/events/Event.h" |
14 #include "modules/EventTargetModules.h" | 14 #include "modules/EventTargetModules.h" |
15 #include "modules/serviceworkers/ServiceWorkerContainerClient.h" | 15 #include "modules/serviceworkers/ServiceWorkerContainerClient.h" |
16 #include "modules/serviceworkers/ServiceWorkerError.h" | 16 #include "modules/serviceworkers/ServiceWorkerError.h" |
17 #include "public/platform/modules/serviceworker/WebServiceWorkerProvider.h" | 17 #include "public/platform/modules/serviceworker/WebServiceWorkerProvider.h" |
18 #include "wtf/PtrUtil.h" | 18 #include "wtf/PtrUtil.h" |
19 #include <memory> | 19 #include <memory> |
20 | 20 |
21 namespace blink { | 21 namespace blink { |
22 | 22 |
| 23 bool ServiceWorkerRegistration::hasPendingActivity() const |
| 24 { |
| 25 return !m_stopped; |
| 26 } |
| 27 |
23 const AtomicString& ServiceWorkerRegistration::interfaceName() const | 28 const AtomicString& ServiceWorkerRegistration::interfaceName() const |
24 { | 29 { |
25 return EventTargetNames::ServiceWorkerRegistration; | 30 return EventTargetNames::ServiceWorkerRegistration; |
26 } | 31 } |
27 | 32 |
28 void ServiceWorkerRegistration::dispatchUpdateFoundEvent() | 33 void ServiceWorkerRegistration::dispatchUpdateFoundEvent() |
29 { | 34 { |
30 dispatchEvent(Event::create(EventTypeNames::updatefound)); | 35 dispatchEvent(Event::create(EventTypeNames::updatefound)); |
31 } | 36 } |
32 | 37 |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 DEFINE_TRACE(ServiceWorkerRegistration) | 129 DEFINE_TRACE(ServiceWorkerRegistration) |
125 { | 130 { |
126 visitor->trace(m_installing); | 131 visitor->trace(m_installing); |
127 visitor->trace(m_waiting); | 132 visitor->trace(m_waiting); |
128 visitor->trace(m_active); | 133 visitor->trace(m_active); |
129 EventTargetWithInlineData::trace(visitor); | 134 EventTargetWithInlineData::trace(visitor); |
130 ActiveDOMObject::trace(visitor); | 135 ActiveDOMObject::trace(visitor); |
131 Supplementable<ServiceWorkerRegistration>::trace(visitor); | 136 Supplementable<ServiceWorkerRegistration>::trace(visitor); |
132 } | 137 } |
133 | 138 |
134 bool ServiceWorkerRegistration::hasPendingActivity() const | |
135 { | |
136 return !m_stopped; | |
137 } | |
138 | |
139 void ServiceWorkerRegistration::stop() | 139 void ServiceWorkerRegistration::stop() |
140 { | 140 { |
141 if (m_stopped) | 141 if (m_stopped) |
142 return; | 142 return; |
143 m_stopped = true; | 143 m_stopped = true; |
144 m_handle->registration()->proxyStopped(); | 144 m_handle->registration()->proxyStopped(); |
145 } | 145 } |
146 | 146 |
147 } // namespace blink | 147 } // namespace blink |
OLD | NEW |