| 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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 { | 127 { |
| 128 RefPtrWillBeRawPtr<ServiceWorkerRegistration> registration = adoptRefWillBeR
efCountedGarbageCollected(new ServiceWorkerRegistration(executionContext, outerR
egistration)); | 128 RefPtrWillBeRawPtr<ServiceWorkerRegistration> registration = adoptRefWillBeR
efCountedGarbageCollected(new ServiceWorkerRegistration(executionContext, outerR
egistration)); |
| 129 registration->suspendIfNeeded(); | 129 registration->suspendIfNeeded(); |
| 130 return registration.release(); | 130 return registration.release(); |
| 131 } | 131 } |
| 132 | 132 |
| 133 ServiceWorkerRegistration::ServiceWorkerRegistration(ExecutionContext* execution
Context, PassOwnPtr<WebServiceWorkerRegistration> outerRegistration) | 133 ServiceWorkerRegistration::ServiceWorkerRegistration(ExecutionContext* execution
Context, PassOwnPtr<WebServiceWorkerRegistration> outerRegistration) |
| 134 : ActiveDOMObject(executionContext) | 134 : ActiveDOMObject(executionContext) |
| 135 , m_outerRegistration(outerRegistration) | 135 , m_outerRegistration(outerRegistration) |
| 136 , m_provider(0) | 136 , m_provider(0) |
| 137 , m_stopped(false) |
| 137 { | 138 { |
| 138 ASSERT(m_outerRegistration); | 139 ASSERT(m_outerRegistration); |
| 139 ScriptWrappable::init(this); | 140 ScriptWrappable::init(this); |
| 140 | 141 |
| 141 if (!executionContext) | 142 if (!executionContext) |
| 142 return; | 143 return; |
| 143 if (ServiceWorkerContainerClient* client = ServiceWorkerContainerClient::fro
m(executionContext)) | 144 if (ServiceWorkerContainerClient* client = ServiceWorkerContainerClient::fro
m(executionContext)) |
| 144 m_provider = client->provider(); | 145 m_provider = client->provider(); |
| 145 m_outerRegistration->setProxy(this); | 146 m_outerRegistration->setProxy(this); |
| 146 } | 147 } |
| 147 | 148 |
| 148 void ServiceWorkerRegistration::trace(Visitor* visitor) | 149 void ServiceWorkerRegistration::trace(Visitor* visitor) |
| 149 { | 150 { |
| 150 visitor->trace(m_installing); | 151 visitor->trace(m_installing); |
| 151 visitor->trace(m_waiting); | 152 visitor->trace(m_waiting); |
| 152 visitor->trace(m_active); | 153 visitor->trace(m_active); |
| 153 EventTargetWithInlineData::trace(visitor); | 154 EventTargetWithInlineData::trace(visitor); |
| 154 } | 155 } |
| 155 | 156 |
| 157 bool ServiceWorkerRegistration::hasPendingActivity() const |
| 158 { |
| 159 return !m_stopped; |
| 160 } |
| 161 |
| 162 void ServiceWorkerRegistration::stop() |
| 163 { |
| 164 if (m_stopped) |
| 165 return; |
| 166 m_stopped = true; |
| 167 m_outerRegistration->proxyStopped(); |
| 168 } |
| 169 |
| 156 } // namespace blink | 170 } // namespace blink |
| OLD | NEW |