| 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 19 matching lines...) Expand all Loading... |
| 30 } | 30 } |
| 31 | 31 |
| 32 void ServiceWorkerRegistration::dispatchUpdateFoundEvent() { | 32 void ServiceWorkerRegistration::dispatchUpdateFoundEvent() { |
| 33 dispatchEvent(Event::create(EventTypeNames::updatefound)); | 33 dispatchEvent(Event::create(EventTypeNames::updatefound)); |
| 34 } | 34 } |
| 35 | 35 |
| 36 void ServiceWorkerRegistration::setInstalling( | 36 void ServiceWorkerRegistration::setInstalling( |
| 37 std::unique_ptr<WebServiceWorker::Handle> handle) { | 37 std::unique_ptr<WebServiceWorker::Handle> handle) { |
| 38 if (!getExecutionContext()) | 38 if (!getExecutionContext()) |
| 39 return; | 39 return; |
| 40 m_installing = | 40 m_installing = ServiceWorker::from(getExecutionContext(), |
| 41 ServiceWorker::from(getExecutionContext(), wrapUnique(handle.release())); | 41 WTF::wrapUnique(handle.release())); |
| 42 } | 42 } |
| 43 | 43 |
| 44 void ServiceWorkerRegistration::setWaiting( | 44 void ServiceWorkerRegistration::setWaiting( |
| 45 std::unique_ptr<WebServiceWorker::Handle> handle) { | 45 std::unique_ptr<WebServiceWorker::Handle> handle) { |
| 46 if (!getExecutionContext()) | 46 if (!getExecutionContext()) |
| 47 return; | 47 return; |
| 48 m_waiting = | 48 m_waiting = ServiceWorker::from(getExecutionContext(), |
| 49 ServiceWorker::from(getExecutionContext(), wrapUnique(handle.release())); | 49 WTF::wrapUnique(handle.release())); |
| 50 } | 50 } |
| 51 | 51 |
| 52 void ServiceWorkerRegistration::setActive( | 52 void ServiceWorkerRegistration::setActive( |
| 53 std::unique_ptr<WebServiceWorker::Handle> handle) { | 53 std::unique_ptr<WebServiceWorker::Handle> handle) { |
| 54 if (!getExecutionContext()) | 54 if (!getExecutionContext()) |
| 55 return; | 55 return; |
| 56 m_active = | 56 m_active = ServiceWorker::from(getExecutionContext(), |
| 57 ServiceWorker::from(getExecutionContext(), wrapUnique(handle.release())); | 57 WTF::wrapUnique(handle.release())); |
| 58 } | 58 } |
| 59 | 59 |
| 60 ServiceWorkerRegistration* ServiceWorkerRegistration::getOrCreate( | 60 ServiceWorkerRegistration* ServiceWorkerRegistration::getOrCreate( |
| 61 ExecutionContext* executionContext, | 61 ExecutionContext* executionContext, |
| 62 std::unique_ptr<WebServiceWorkerRegistration::Handle> handle) { | 62 std::unique_ptr<WebServiceWorkerRegistration::Handle> handle) { |
| 63 ASSERT(handle); | 63 ASSERT(handle); |
| 64 | 64 |
| 65 ServiceWorkerRegistration* existingRegistration = | 65 ServiceWorkerRegistration* existingRegistration = |
| 66 static_cast<ServiceWorkerRegistration*>(handle->registration()->proxy()); | 66 static_cast<ServiceWorkerRegistration*>(handle->registration()->proxy()); |
| 67 if (existingRegistration) { | 67 if (existingRegistration) { |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 } | 158 } |
| 159 | 159 |
| 160 void ServiceWorkerRegistration::contextDestroyed() { | 160 void ServiceWorkerRegistration::contextDestroyed() { |
| 161 if (m_stopped) | 161 if (m_stopped) |
| 162 return; | 162 return; |
| 163 m_stopped = true; | 163 m_stopped = true; |
| 164 m_handle->registration()->proxyStopped(); | 164 m_handle->registration()->proxyStopped(); |
| 165 } | 165 } |
| 166 | 166 |
| 167 } // namespace blink | 167 } // namespace blink |
| OLD | NEW |