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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 if (!m_provider) { | 91 if (!m_provider) { |
92 resolver->reject(DOMException::create(InvalidStateError, "Failed to unre
gister a ServiceWorkerRegistration: No associated provider is available.")); | 92 resolver->reject(DOMException::create(InvalidStateError, "Failed to unre
gister a ServiceWorkerRegistration: No associated provider is available.")); |
93 return promise; | 93 return promise; |
94 } | 94 } |
95 | 95 |
96 m_handle->registration()->unregister(m_provider, new CallbackPromiseAdapter<
bool, ServiceWorkerError>(resolver)); | 96 m_handle->registration()->unregister(m_provider, new CallbackPromiseAdapter<
bool, ServiceWorkerError>(resolver)); |
97 return promise; | 97 return promise; |
98 } | 98 } |
99 | 99 |
100 ServiceWorkerRegistration::ServiceWorkerRegistration(ExecutionContext* execution
Context, PassOwnPtr<WebServiceWorkerRegistration::Handle> handle) | 100 ServiceWorkerRegistration::ServiceWorkerRegistration(ExecutionContext* execution
Context, PassOwnPtr<WebServiceWorkerRegistration::Handle> handle) |
101 : ActiveDOMObject(executionContext) | 101 : ActiveScriptWrappable(this) |
| 102 , ActiveDOMObject(executionContext) |
102 , m_handle(handle) | 103 , m_handle(handle) |
103 , m_provider(nullptr) | 104 , m_provider(nullptr) |
104 , m_stopped(false) | 105 , m_stopped(false) |
105 { | 106 { |
106 ASSERT(m_handle); | 107 ASSERT(m_handle); |
107 ASSERT(!m_handle->registration()->proxy()); | 108 ASSERT(!m_handle->registration()->proxy()); |
108 | 109 |
109 if (!executionContext) | 110 if (!executionContext) |
110 return; | 111 return; |
111 if (ServiceWorkerContainerClient* client = ServiceWorkerContainerClient::fro
m(executionContext)) | 112 if (ServiceWorkerContainerClient* client = ServiceWorkerContainerClient::fro
m(executionContext)) |
(...skipping 22 matching lines...) Expand all Loading... |
134 | 135 |
135 void ServiceWorkerRegistration::stop() | 136 void ServiceWorkerRegistration::stop() |
136 { | 137 { |
137 if (m_stopped) | 138 if (m_stopped) |
138 return; | 139 return; |
139 m_stopped = true; | 140 m_stopped = true; |
140 m_handle->registration()->proxyStopped(); | 141 m_handle->registration()->proxyStopped(); |
141 } | 142 } |
142 | 143 |
143 } // namespace blink | 144 } // namespace blink |
OLD | NEW |