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

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/V8V0CustomElementLifecycleCallbacks.cpp

Issue 2552993002: Rename activeDOMObjectsAreStopped to isContextDestroyed (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 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 // alive. This in turn keeps callbacks alive through hidden 144 // alive. This in turn keeps callbacks alive through hidden
145 // references; see CALLBACK_LIST(SET_HIDDEN_VALUE). 145 // references; see CALLBACK_LIST(SET_HIDDEN_VALUE).
146 perContextData->addCustomElementBinding(std::move(binding)); 146 perContextData->addCustomElementBinding(std::move(binding));
147 return true; 147 return true;
148 } 148 }
149 149
150 void V8V0CustomElementLifecycleCallbacks::created(Element* element) { 150 void V8V0CustomElementLifecycleCallbacks::created(Element* element) {
151 // FIXME: callbacks while paused should be queued up for execution to 151 // FIXME: callbacks while paused should be queued up for execution to
152 // continue then be delivered in order rather than delivered immediately. 152 // continue then be delivered in order rather than delivered immediately.
153 // Bug 329665 tracks similar behavior for other synchronous events. 153 // Bug 329665 tracks similar behavior for other synchronous events.
154 if (!getExecutionContext() || 154 if (!getExecutionContext() || getExecutionContext()->isContextDestroyed())
155 getExecutionContext()->activeDOMObjectsAreStopped())
156 return; 155 return;
157 156
158 if (!m_scriptState->contextIsValid()) 157 if (!m_scriptState->contextIsValid())
159 return; 158 return;
160 159
161 element->setV0CustomElementState(Element::V0Upgraded); 160 element->setV0CustomElementState(Element::V0Upgraded);
162 161
163 ScriptState::Scope scope(m_scriptState.get()); 162 ScriptState::Scope scope(m_scriptState.get());
164 v8::Isolate* isolate = m_scriptState->isolate(); 163 v8::Isolate* isolate = m_scriptState->isolate();
165 v8::Local<v8::Context> context = m_scriptState->context(); 164 v8::Local<v8::Context> context = m_scriptState->context();
(...skipping 29 matching lines...) Expand all
195 } 194 }
196 195
197 void V8V0CustomElementLifecycleCallbacks::attributeChanged( 196 void V8V0CustomElementLifecycleCallbacks::attributeChanged(
198 Element* element, 197 Element* element,
199 const AtomicString& name, 198 const AtomicString& name,
200 const AtomicString& oldValue, 199 const AtomicString& oldValue,
201 const AtomicString& newValue) { 200 const AtomicString& newValue) {
202 // FIXME: callbacks while paused should be queued up for execution to 201 // FIXME: callbacks while paused should be queued up for execution to
203 // continue then be delivered in order rather than delivered immediately. 202 // continue then be delivered in order rather than delivered immediately.
204 // Bug 329665 tracks similar behavior for other synchronous events. 203 // Bug 329665 tracks similar behavior for other synchronous events.
205 if (!getExecutionContext() || 204 if (!getExecutionContext() || getExecutionContext()->isContextDestroyed())
206 getExecutionContext()->activeDOMObjectsAreStopped())
207 return; 205 return;
208 206
209 if (!m_scriptState->contextIsValid()) 207 if (!m_scriptState->contextIsValid())
210 return; 208 return;
211 ScriptState::Scope scope(m_scriptState.get()); 209 ScriptState::Scope scope(m_scriptState.get());
212 v8::Isolate* isolate = m_scriptState->isolate(); 210 v8::Isolate* isolate = m_scriptState->isolate();
213 v8::Local<v8::Context> context = m_scriptState->context(); 211 v8::Local<v8::Context> context = m_scriptState->context();
214 v8::Local<v8::Value> receiver = toV8(element, context->Global(), isolate); 212 v8::Local<v8::Value> receiver = toV8(element, context->Global(), isolate);
215 if (receiver.IsEmpty()) 213 if (receiver.IsEmpty())
216 return; 214 return;
(...skipping 14 matching lines...) Expand all
231 V8ScriptRunner::callFunction(callback, getExecutionContext(), receiver, 229 V8ScriptRunner::callFunction(callback, getExecutionContext(), receiver,
232 WTF_ARRAY_LENGTH(argv), argv, isolate); 230 WTF_ARRAY_LENGTH(argv), argv, isolate);
233 } 231 }
234 232
235 void V8V0CustomElementLifecycleCallbacks::call( 233 void V8V0CustomElementLifecycleCallbacks::call(
236 const ScopedPersistent<v8::Function>& weakCallback, 234 const ScopedPersistent<v8::Function>& weakCallback,
237 Element* element) { 235 Element* element) {
238 // FIXME: callbacks while paused should be queued up for execution to 236 // FIXME: callbacks while paused should be queued up for execution to
239 // continue then be delivered in order rather than delivered immediately. 237 // continue then be delivered in order rather than delivered immediately.
240 // Bug 329665 tracks similar behavior for other synchronous events. 238 // Bug 329665 tracks similar behavior for other synchronous events.
241 if (!getExecutionContext() || 239 if (!getExecutionContext() || getExecutionContext()->isContextDestroyed())
242 getExecutionContext()->activeDOMObjectsAreStopped())
243 return; 240 return;
244 241
245 if (!m_scriptState->contextIsValid()) 242 if (!m_scriptState->contextIsValid())
246 return; 243 return;
247 ScriptState::Scope scope(m_scriptState.get()); 244 ScriptState::Scope scope(m_scriptState.get());
248 v8::Isolate* isolate = m_scriptState->isolate(); 245 v8::Isolate* isolate = m_scriptState->isolate();
249 v8::Local<v8::Context> context = m_scriptState->context(); 246 v8::Local<v8::Context> context = m_scriptState->context();
250 v8::Local<v8::Function> callback = weakCallback.newLocal(isolate); 247 v8::Local<v8::Function> callback = weakCallback.newLocal(isolate);
251 if (callback.IsEmpty()) 248 if (callback.IsEmpty())
252 return; 249 return;
253 250
254 v8::Local<v8::Value> receiver = toV8(element, context->Global(), isolate); 251 v8::Local<v8::Value> receiver = toV8(element, context->Global(), isolate);
255 if (receiver.IsEmpty()) 252 if (receiver.IsEmpty())
256 return; 253 return;
257 254
258 v8::TryCatch exceptionCatcher(isolate); 255 v8::TryCatch exceptionCatcher(isolate);
259 exceptionCatcher.SetVerbose(true); 256 exceptionCatcher.SetVerbose(true);
260 V8ScriptRunner::callFunction(callback, getExecutionContext(), receiver, 0, 0, 257 V8ScriptRunner::callFunction(callback, getExecutionContext(), receiver, 0, 0,
261 isolate); 258 isolate);
262 } 259 }
263 260
264 DEFINE_TRACE(V8V0CustomElementLifecycleCallbacks) { 261 DEFINE_TRACE(V8V0CustomElementLifecycleCallbacks) {
265 V0CustomElementLifecycleCallbacks::trace(visitor); 262 V0CustomElementLifecycleCallbacks::trace(visitor);
266 ContextLifecycleObserver::trace(visitor); 263 ContextLifecycleObserver::trace(visitor);
267 } 264 }
268 265
269 } // namespace blink 266 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698