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 10 matching lines...) Expand all Loading... |
21 const AtomicString& ServiceWorkerRegistration::interfaceName() const | 21 const AtomicString& ServiceWorkerRegistration::interfaceName() const |
22 { | 22 { |
23 return EventTargetNames::ServiceWorkerRegistration; | 23 return EventTargetNames::ServiceWorkerRegistration; |
24 } | 24 } |
25 | 25 |
26 void ServiceWorkerRegistration::dispatchUpdateFoundEvent() | 26 void ServiceWorkerRegistration::dispatchUpdateFoundEvent() |
27 { | 27 { |
28 dispatchEvent(Event::create(EventTypeNames::updatefound)); | 28 dispatchEvent(Event::create(EventTypeNames::updatefound)); |
29 } | 29 } |
30 | 30 |
31 void ServiceWorkerRegistration::setInstalling(WebPassOwnPtr<WebServiceWorker::Ha
ndle> handle) | 31 void ServiceWorkerRegistration::setInstalling(std::unique_ptr<WebServiceWorker::
Handle> handle) |
32 { | 32 { |
33 if (!getExecutionContext()) | 33 if (!getExecutionContext()) |
34 return; | 34 return; |
35 m_installing = ServiceWorker::from(getExecutionContext(), handle.release()); | 35 m_installing = ServiceWorker::from(getExecutionContext(), adoptPtr(handle.re
lease())); |
36 } | 36 } |
37 | 37 |
38 void ServiceWorkerRegistration::setWaiting(WebPassOwnPtr<WebServiceWorker::Handl
e> handle) | 38 void ServiceWorkerRegistration::setWaiting(std::unique_ptr<WebServiceWorker::Han
dle> handle) |
39 { | 39 { |
40 if (!getExecutionContext()) | 40 if (!getExecutionContext()) |
41 return; | 41 return; |
42 m_waiting = ServiceWorker::from(getExecutionContext(), handle.release()); | 42 m_waiting = ServiceWorker::from(getExecutionContext(), adoptPtr(handle.relea
se())); |
43 } | 43 } |
44 | 44 |
45 void ServiceWorkerRegistration::setActive(WebPassOwnPtr<WebServiceWorker::Handle
> handle) | 45 void ServiceWorkerRegistration::setActive(std::unique_ptr<WebServiceWorker::Hand
le> handle) |
46 { | 46 { |
47 if (!getExecutionContext()) | 47 if (!getExecutionContext()) |
48 return; | 48 return; |
49 m_active = ServiceWorker::from(getExecutionContext(), handle.release()); | 49 m_active = ServiceWorker::from(getExecutionContext(), adoptPtr(handle.releas
e())); |
50 } | 50 } |
51 | 51 |
52 ServiceWorkerRegistration* ServiceWorkerRegistration::getOrCreate(ExecutionConte
xt* executionContext, PassOwnPtr<WebServiceWorkerRegistration::Handle> handle) | 52 ServiceWorkerRegistration* ServiceWorkerRegistration::getOrCreate(ExecutionConte
xt* executionContext, PassOwnPtr<WebServiceWorkerRegistration::Handle> handle) |
53 { | 53 { |
54 ASSERT(handle); | 54 ASSERT(handle); |
55 | 55 |
56 ServiceWorkerRegistration* existingRegistration = static_cast<ServiceWorkerR
egistration*>(handle->registration()->proxy()); | 56 ServiceWorkerRegistration* existingRegistration = static_cast<ServiceWorkerR
egistration*>(handle->registration()->proxy()); |
57 if (existingRegistration) { | 57 if (existingRegistration) { |
58 ASSERT(existingRegistration->getExecutionContext() == executionContext); | 58 ASSERT(existingRegistration->getExecutionContext() == executionContext); |
59 return existingRegistration; | 59 return existingRegistration; |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 | 135 |
136 void ServiceWorkerRegistration::stop() | 136 void ServiceWorkerRegistration::stop() |
137 { | 137 { |
138 if (m_stopped) | 138 if (m_stopped) |
139 return; | 139 return; |
140 m_stopped = true; | 140 m_stopped = true; |
141 m_handle->registration()->proxyStopped(); | 141 m_handle->registration()->proxyStopped(); |
142 } | 142 } |
143 | 143 |
144 } // namespace blink | 144 } // namespace blink |
OLD | NEW |