Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Side by Side Diff: third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerRegistration.cpp

Issue 2567913002: Rename ActiveDOMObject to SuspendableObject (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 client->provider(), 120 client->provider(),
121 WTF::makeUnique<CallbackPromiseAdapter<bool, ServiceWorkerError>>( 121 WTF::makeUnique<CallbackPromiseAdapter<bool, ServiceWorkerError>>(
122 resolver)); 122 resolver));
123 return promise; 123 return promise;
124 } 124 }
125 125
126 ServiceWorkerRegistration::ServiceWorkerRegistration( 126 ServiceWorkerRegistration::ServiceWorkerRegistration(
127 ExecutionContext* executionContext, 127 ExecutionContext* executionContext,
128 std::unique_ptr<WebServiceWorkerRegistration::Handle> handle) 128 std::unique_ptr<WebServiceWorkerRegistration::Handle> handle)
129 : ActiveScriptWrappable(this), 129 : ActiveScriptWrappable(this),
130 ActiveDOMObject(executionContext), 130 SuspendableObject(executionContext),
131 m_handle(std::move(handle)), 131 m_handle(std::move(handle)),
132 m_stopped(false) { 132 m_stopped(false) {
133 ASSERT(m_handle); 133 ASSERT(m_handle);
134 ASSERT(!m_handle->registration()->proxy()); 134 ASSERT(!m_handle->registration()->proxy());
135 ThreadState::current()->registerPreFinalizer(this); 135 ThreadState::current()->registerPreFinalizer(this);
136 136
137 if (!executionContext) 137 if (!executionContext)
138 return; 138 return;
139 m_handle->registration()->setProxy(this); 139 m_handle->registration()->setProxy(this);
140 } 140 }
141 141
142 ServiceWorkerRegistration::~ServiceWorkerRegistration() {} 142 ServiceWorkerRegistration::~ServiceWorkerRegistration() {}
143 143
144 void ServiceWorkerRegistration::dispose() { 144 void ServiceWorkerRegistration::dispose() {
145 // Promptly clears a raw reference from content/ to an on-heap object 145 // Promptly clears a raw reference from content/ to an on-heap object
146 // so that content/ doesn't access it in a lazy sweeping phase. 146 // so that content/ doesn't access it in a lazy sweeping phase.
147 m_handle.reset(); 147 m_handle.reset();
148 } 148 }
149 149
150 DEFINE_TRACE(ServiceWorkerRegistration) { 150 DEFINE_TRACE(ServiceWorkerRegistration) {
151 visitor->trace(m_installing); 151 visitor->trace(m_installing);
152 visitor->trace(m_waiting); 152 visitor->trace(m_waiting);
153 visitor->trace(m_active); 153 visitor->trace(m_active);
154 visitor->trace(m_navigationPreload); 154 visitor->trace(m_navigationPreload);
155 EventTargetWithInlineData::trace(visitor); 155 EventTargetWithInlineData::trace(visitor);
156 ActiveDOMObject::trace(visitor); 156 SuspendableObject::trace(visitor);
157 Supplementable<ServiceWorkerRegistration>::trace(visitor); 157 Supplementable<ServiceWorkerRegistration>::trace(visitor);
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698