| 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 12 matching lines...) Expand all  Loading... | 
| 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(WebPassOwnPtr<WebServiceWorker::Ha
     ndle> handle) | 
| 32 { | 32 { | 
| 33     if (!executionContext()) | 33     if (!getExecutionContext()) | 
| 34         return; | 34         return; | 
| 35     m_installing = ServiceWorker::from(executionContext(), handle.release()); | 35     m_installing = ServiceWorker::from(getExecutionContext(), handle.release()); | 
| 36 } | 36 } | 
| 37 | 37 | 
| 38 void ServiceWorkerRegistration::setWaiting(WebPassOwnPtr<WebServiceWorker::Handl
     e> handle) | 38 void ServiceWorkerRegistration::setWaiting(WebPassOwnPtr<WebServiceWorker::Handl
     e> handle) | 
| 39 { | 39 { | 
| 40     if (!executionContext()) | 40     if (!getExecutionContext()) | 
| 41         return; | 41         return; | 
| 42     m_waiting = ServiceWorker::from(executionContext(), handle.release()); | 42     m_waiting = ServiceWorker::from(getExecutionContext(), handle.release()); | 
| 43 } | 43 } | 
| 44 | 44 | 
| 45 void ServiceWorkerRegistration::setActive(WebPassOwnPtr<WebServiceWorker::Handle
     > handle) | 45 void ServiceWorkerRegistration::setActive(WebPassOwnPtr<WebServiceWorker::Handle
     > handle) | 
| 46 { | 46 { | 
| 47     if (!executionContext()) | 47     if (!getExecutionContext()) | 
| 48         return; | 48         return; | 
| 49     m_active = ServiceWorker::from(executionContext(), handle.release()); | 49     m_active = ServiceWorker::from(getExecutionContext(), handle.release()); | 
| 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->executionContext() == executionContext); | 58         ASSERT(existingRegistration->getExecutionContext() == executionContext); | 
| 59         return existingRegistration; | 59         return existingRegistration; | 
| 60     } | 60     } | 
| 61 | 61 | 
| 62     ServiceWorkerRegistration* newRegistration = new ServiceWorkerRegistration(e
     xecutionContext, handle); | 62     ServiceWorkerRegistration* newRegistration = new ServiceWorkerRegistration(e
     xecutionContext, handle); | 
| 63     newRegistration->suspendIfNeeded(); | 63     newRegistration->suspendIfNeeded(); | 
| 64     return newRegistration; | 64     return newRegistration; | 
| 65 } | 65 } | 
| 66 | 66 | 
| 67 String ServiceWorkerRegistration::scope() const | 67 String ServiceWorkerRegistration::scope() const | 
| 68 { | 68 { | 
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 134 | 134 | 
| 135 void ServiceWorkerRegistration::stop() | 135 void ServiceWorkerRegistration::stop() | 
| 136 { | 136 { | 
| 137     if (m_stopped) | 137     if (m_stopped) | 
| 138         return; | 138         return; | 
| 139     m_stopped = true; | 139     m_stopped = true; | 
| 140     m_handle->registration()->proxyStopped(); | 140     m_handle->registration()->proxyStopped(); | 
| 141 } | 141 } | 
| 142 | 142 | 
| 143 } // namespace blink | 143 } // namespace blink | 
| OLD | NEW | 
|---|