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

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

Issue 2433773006: Remove ExecutionContext::activeDOMObjectsAreStopped()
Patch Set: Created 4 years, 2 months 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())
155 getExecutionContext()->activeDOMObjectsAreStopped())
156 return; 155 return;
157 156
157 // TODO(dcheng): Shouldn't this be redundant with getExecutionContext()?
158 if (!m_scriptState->contextIsValid()) 158 if (!m_scriptState->contextIsValid())
159 return; 159 return;
160 160
161 element->setV0CustomElementState(Element::V0Upgraded); 161 element->setV0CustomElementState(Element::V0Upgraded);
162 162
163 ScriptState::Scope scope(m_scriptState.get()); 163 ScriptState::Scope scope(m_scriptState.get());
164 v8::Isolate* isolate = m_scriptState->isolate(); 164 v8::Isolate* isolate = m_scriptState->isolate();
165 v8::Local<v8::Context> context = m_scriptState->context(); 165 v8::Local<v8::Context> context = m_scriptState->context();
166 v8::Local<v8::Value> receiverValue = 166 v8::Local<v8::Value> receiverValue =
167 toV8(element, context->Global(), isolate); 167 toV8(element, context->Global(), isolate);
(...skipping 27 matching lines...) Expand all
195 } 195 }
196 196
197 void V8V0CustomElementLifecycleCallbacks::attributeChanged( 197 void V8V0CustomElementLifecycleCallbacks::attributeChanged(
198 Element* element, 198 Element* element,
199 const AtomicString& name, 199 const AtomicString& name,
200 const AtomicString& oldValue, 200 const AtomicString& oldValue,
201 const AtomicString& newValue) { 201 const AtomicString& newValue) {
202 // FIXME: callbacks while paused should be queued up for execution to 202 // FIXME: callbacks while paused should be queued up for execution to
203 // continue then be delivered in order rather than delivered immediately. 203 // continue then be delivered in order rather than delivered immediately.
204 // Bug 329665 tracks similar behavior for other synchronous events. 204 // Bug 329665 tracks similar behavior for other synchronous events.
205 if (!getExecutionContext() || 205 if (!getExecutionContext())
206 getExecutionContext()->activeDOMObjectsAreStopped())
207 return; 206 return;
208 207
209 if (!m_scriptState->contextIsValid()) 208 if (!m_scriptState->contextIsValid())
210 return; 209 return;
211 ScriptState::Scope scope(m_scriptState.get()); 210 ScriptState::Scope scope(m_scriptState.get());
212 v8::Isolate* isolate = m_scriptState->isolate(); 211 v8::Isolate* isolate = m_scriptState->isolate();
213 v8::Local<v8::Context> context = m_scriptState->context(); 212 v8::Local<v8::Context> context = m_scriptState->context();
214 v8::Local<v8::Value> receiver = toV8(element, context->Global(), isolate); 213 v8::Local<v8::Value> receiver = toV8(element, context->Global(), isolate);
215 if (receiver.IsEmpty()) 214 if (receiver.IsEmpty())
216 return; 215 return;
(...skipping 14 matching lines...) Expand all
231 V8ScriptRunner::callFunction(callback, getExecutionContext(), receiver, 230 V8ScriptRunner::callFunction(callback, getExecutionContext(), receiver,
232 WTF_ARRAY_LENGTH(argv), argv, isolate); 231 WTF_ARRAY_LENGTH(argv), argv, isolate);
233 } 232 }
234 233
235 void V8V0CustomElementLifecycleCallbacks::call( 234 void V8V0CustomElementLifecycleCallbacks::call(
236 const ScopedPersistent<v8::Function>& weakCallback, 235 const ScopedPersistent<v8::Function>& weakCallback,
237 Element* element) { 236 Element* element) {
238 // FIXME: callbacks while paused should be queued up for execution to 237 // FIXME: callbacks while paused should be queued up for execution to
239 // continue then be delivered in order rather than delivered immediately. 238 // continue then be delivered in order rather than delivered immediately.
240 // Bug 329665 tracks similar behavior for other synchronous events. 239 // Bug 329665 tracks similar behavior for other synchronous events.
241 if (!getExecutionContext() || 240 if (!getExecutionContext())
242 getExecutionContext()->activeDOMObjectsAreStopped())
243 return; 241 return;
244 242
245 if (!m_scriptState->contextIsValid()) 243 if (!m_scriptState->contextIsValid())
246 return; 244 return;
247 ScriptState::Scope scope(m_scriptState.get()); 245 ScriptState::Scope scope(m_scriptState.get());
248 v8::Isolate* isolate = m_scriptState->isolate(); 246 v8::Isolate* isolate = m_scriptState->isolate();
249 v8::Local<v8::Context> context = m_scriptState->context(); 247 v8::Local<v8::Context> context = m_scriptState->context();
250 v8::Local<v8::Function> callback = weakCallback.newLocal(isolate); 248 v8::Local<v8::Function> callback = weakCallback.newLocal(isolate);
251 if (callback.IsEmpty()) 249 if (callback.IsEmpty())
252 return; 250 return;
253 251
254 v8::Local<v8::Value> receiver = toV8(element, context->Global(), isolate); 252 v8::Local<v8::Value> receiver = toV8(element, context->Global(), isolate);
255 if (receiver.IsEmpty()) 253 if (receiver.IsEmpty())
256 return; 254 return;
257 255
258 v8::TryCatch exceptionCatcher(isolate); 256 v8::TryCatch exceptionCatcher(isolate);
259 exceptionCatcher.SetVerbose(true); 257 exceptionCatcher.SetVerbose(true);
260 V8ScriptRunner::callFunction(callback, getExecutionContext(), receiver, 0, 0, 258 V8ScriptRunner::callFunction(callback, getExecutionContext(), receiver, 0, 0,
261 isolate); 259 isolate);
262 } 260 }
263 261
264 DEFINE_TRACE(V8V0CustomElementLifecycleCallbacks) { 262 DEFINE_TRACE(V8V0CustomElementLifecycleCallbacks) {
265 V0CustomElementLifecycleCallbacks::trace(visitor); 263 V0CustomElementLifecycleCallbacks::trace(visitor);
266 ContextLifecycleObserver::trace(visitor); 264 ContextLifecycleObserver::trace(visitor);
267 } 265 }
268 266
269 } // namespace blink 267 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698