| 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 delete registration; | 81 delete registration; |
| 82 } | 82 } |
| 83 | 83 |
| 84 String ServiceWorkerRegistration::scope() const | 84 String ServiceWorkerRegistration::scope() const |
| 85 { | 85 { |
| 86 return m_outerRegistration->scope().string(); | 86 return m_outerRegistration->scope().string(); |
| 87 } | 87 } |
| 88 | 88 |
| 89 ScriptPromise ServiceWorkerRegistration::update(ScriptState* scriptState) | 89 ScriptPromise ServiceWorkerRegistration::update(ScriptState* scriptState) |
| 90 { | 90 { |
| 91 RefPtrWillBeRawPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver::
create(scriptState); | 91 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState)
; |
| 92 ScriptPromise promise = resolver->promise(); | 92 ScriptPromise promise = resolver->promise(); |
| 93 | 93 |
| 94 if (!m_provider) { | 94 if (!m_provider) { |
| 95 resolver->reject(DOMException::create(InvalidStateError, "Failed to upda
te a ServiceWorkerRegistration: No associated provider is available.")); | 95 resolver->reject(DOMException::create(InvalidStateError, "Failed to upda
te a ServiceWorkerRegistration: No associated provider is available.")); |
| 96 return promise; | 96 return promise; |
| 97 } | 97 } |
| 98 | 98 |
| 99 m_outerRegistration->update(m_provider, new CallbackPromiseAdapter<void, Ser
viceWorkerError>(resolver)); | 99 m_outerRegistration->update(m_provider, new CallbackPromiseAdapter<void, Ser
viceWorkerError>(resolver)); |
| 100 return promise; | 100 return promise; |
| 101 } | 101 } |
| 102 | 102 |
| 103 ScriptPromise ServiceWorkerRegistration::unregister(ScriptState* scriptState) | 103 ScriptPromise ServiceWorkerRegistration::unregister(ScriptState* scriptState) |
| 104 { | 104 { |
| 105 RefPtrWillBeRawPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver::
create(scriptState); | 105 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState)
; |
| 106 ScriptPromise promise = resolver->promise(); | 106 ScriptPromise promise = resolver->promise(); |
| 107 | 107 |
| 108 if (!m_provider) { | 108 if (!m_provider) { |
| 109 resolver->reject(DOMException::create(InvalidStateError, "Failed to unre
gister a ServiceWorkerRegistration: No associated provider is available.")); | 109 resolver->reject(DOMException::create(InvalidStateError, "Failed to unre
gister a ServiceWorkerRegistration: No associated provider is available.")); |
| 110 return promise; | 110 return promise; |
| 111 } | 111 } |
| 112 | 112 |
| 113 m_outerRegistration->unregister(m_provider, new CallbackPromiseAdapter<bool,
ServiceWorkerError>(resolver)); | 113 m_outerRegistration->unregister(m_provider, new CallbackPromiseAdapter<bool,
ServiceWorkerError>(resolver)); |
| 114 return promise; | 114 return promise; |
| 115 } | 115 } |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 | 166 |
| 167 void ServiceWorkerRegistration::stop() | 167 void ServiceWorkerRegistration::stop() |
| 168 { | 168 { |
| 169 if (m_stopped) | 169 if (m_stopped) |
| 170 return; | 170 return; |
| 171 m_stopped = true; | 171 m_stopped = true; |
| 172 m_outerRegistration->proxyStopped(); | 172 m_outerRegistration->proxyStopped(); |
| 173 } | 173 } |
| 174 | 174 |
| 175 } // namespace blink | 175 } // namespace blink |
| OLD | NEW |