| 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 #include <utility> | 20 #include <utility> |
| 21 | 21 |
| 22 namespace blink { | 22 namespace blink { |
| 23 | 23 |
| 24 ServiceWorkerRegistration* ServiceWorkerRegistration::take( |
| 25 ScriptPromiseResolver* resolver, |
| 26 std::unique_ptr<WebServiceWorkerRegistration::Handle> handle) { |
| 27 return getOrCreate(resolver->getExecutionContext(), std::move(handle)); |
| 28 } |
| 29 |
| 24 bool ServiceWorkerRegistration::hasPendingActivity() const { | 30 bool ServiceWorkerRegistration::hasPendingActivity() const { |
| 25 return !m_stopped; | 31 return !m_stopped; |
| 26 } | 32 } |
| 27 | 33 |
| 28 const AtomicString& ServiceWorkerRegistration::interfaceName() const { | 34 const AtomicString& ServiceWorkerRegistration::interfaceName() const { |
| 29 return EventTargetNames::ServiceWorkerRegistration; | 35 return EventTargetNames::ServiceWorkerRegistration; |
| 30 } | 36 } |
| 31 | 37 |
| 32 void ServiceWorkerRegistration::dispatchUpdateFoundEvent() { | 38 void ServiceWorkerRegistration::dispatchUpdateFoundEvent() { |
| 33 dispatchEvent(Event::create(EventTypeNames::updatefound)); | 39 dispatchEvent(Event::create(EventTypeNames::updatefound)); |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 } | 164 } |
| 159 | 165 |
| 160 void ServiceWorkerRegistration::contextDestroyed() { | 166 void ServiceWorkerRegistration::contextDestroyed() { |
| 161 if (m_stopped) | 167 if (m_stopped) |
| 162 return; | 168 return; |
| 163 m_stopped = true; | 169 m_stopped = true; |
| 164 m_handle->registration()->proxyStopped(); | 170 m_handle->registration()->proxyStopped(); |
| 165 } | 171 } |
| 166 | 172 |
| 167 } // namespace blink | 173 } // namespace blink |
| OLD | NEW |