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