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 "config.h" | 5 #include "config.h" |
6 #include "ServiceWorkerRegistration.h" | 6 #include "ServiceWorkerRegistration.h" |
7 | 7 |
8 #include "bindings/core/v8/CallbackPromiseAdapter.h" | 8 #include "bindings/core/v8/CallbackPromiseAdapter.h" |
9 #include "bindings/core/v8/ScriptPromise.h" | 9 #include "bindings/core/v8/ScriptPromise.h" |
10 #include "bindings/core/v8/ScriptPromiseResolver.h" | 10 #include "bindings/core/v8/ScriptPromiseResolver.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 { | 90 { |
91 if (!m_provider) { | 91 if (!m_provider) { |
92 exceptionState.throwDOMException(InvalidStateError, "Failed to update a
ServiceWorkerRegistration: No associated provider is available."); | 92 exceptionState.throwDOMException(InvalidStateError, "Failed to update a
ServiceWorkerRegistration: No associated provider is available."); |
93 return; | 93 return; |
94 } | 94 } |
95 m_outerRegistration->update(m_provider); | 95 m_outerRegistration->update(m_provider); |
96 } | 96 } |
97 | 97 |
98 ScriptPromise ServiceWorkerRegistration::unregister(ScriptState* scriptState) | 98 ScriptPromise ServiceWorkerRegistration::unregister(ScriptState* scriptState) |
99 { | 99 { |
100 RefPtrWillBeRawPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver::
create(scriptState); | 100 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState)
; |
101 ScriptPromise promise = resolver->promise(); | 101 ScriptPromise promise = resolver->promise(); |
102 | 102 |
103 if (!m_provider) { | 103 if (!m_provider) { |
104 resolver->reject(DOMException::create(InvalidStateError, "Failed to unre
gister a ServiceWorkerRegistration: No associated provider is available.")); | 104 resolver->reject(DOMException::create(InvalidStateError, "Failed to unre
gister a ServiceWorkerRegistration: No associated provider is available.")); |
105 return promise; | 105 return promise; |
106 } | 106 } |
107 | 107 |
108 m_outerRegistration->unregister(m_provider, new CallbackPromiseAdapter<bool,
ServiceWorkerError>(resolver)); | 108 m_outerRegistration->unregister(m_provider, new CallbackPromiseAdapter<bool,
ServiceWorkerError>(resolver)); |
109 return promise; | 109 return promise; |
110 } | 110 } |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 | 161 |
162 void ServiceWorkerRegistration::stop() | 162 void ServiceWorkerRegistration::stop() |
163 { | 163 { |
164 if (m_stopped) | 164 if (m_stopped) |
165 return; | 165 return; |
166 m_stopped = true; | 166 m_stopped = true; |
167 m_outerRegistration->proxyStopped(); | 167 m_outerRegistration->proxyStopped(); |
168 } | 168 } |
169 | 169 |
170 } // namespace blink | 170 } // namespace blink |
OLD | NEW |