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

Side by Side Diff: trunk/Source/bindings/v8/V8CustomElementLifecycleCallbacks.cpp

Issue 218813002: Revert 170357 "Revert of Make DOMWrapperWorld::current() return ..." (Closed) Base URL: svn://svn.chromium.org/blink/
Patch Set: Created 6 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « trunk/Source/bindings/v8/V8Binding.cpp ('k') | trunk/Source/bindings/v8/V8DOMConfiguration.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 109
110 CALLBACK_LIST(MAKE_WEAK) 110 CALLBACK_LIST(MAKE_WEAK)
111 #undef MAKE_WEAK 111 #undef MAKE_WEAK
112 } 112 }
113 113
114 V8PerContextData* V8CustomElementLifecycleCallbacks::creationContextData() 114 V8PerContextData* V8CustomElementLifecycleCallbacks::creationContextData()
115 { 115 {
116 if (!executionContext()) 116 if (!executionContext())
117 return 0; 117 return 0;
118 118
119 v8::Handle<v8::Context> context = toV8Context(executionContext(), m_world.ge t()); 119 v8::Handle<v8::Context> context = toV8Context(executionContext(), *m_world);
120 if (context.IsEmpty()) 120 if (context.IsEmpty())
121 return 0; 121 return 0;
122 122
123 return V8PerContextData::from(context); 123 return V8PerContextData::from(context);
124 } 124 }
125 125
126 V8CustomElementLifecycleCallbacks::~V8CustomElementLifecycleCallbacks() 126 V8CustomElementLifecycleCallbacks::~V8CustomElementLifecycleCallbacks()
127 { 127 {
128 if (!m_owner) 128 if (!m_owner)
129 return; 129 return;
(...skipping 23 matching lines...) Expand all
153 { 153 {
154 // FIXME: callbacks while paused should be queued up for execution to 154 // FIXME: callbacks while paused should be queued up for execution to
155 // continue then be delivered in order rather than delivered immediately. 155 // continue then be delivered in order rather than delivered immediately.
156 // Bug 329665 tracks similar behavior for other synchronous events. 156 // Bug 329665 tracks similar behavior for other synchronous events.
157 if (!executionContext() || executionContext()->activeDOMObjectsAreStopped()) 157 if (!executionContext() || executionContext()->activeDOMObjectsAreStopped())
158 return; 158 return;
159 159
160 element->setCustomElementState(Element::Upgraded); 160 element->setCustomElementState(Element::Upgraded);
161 161
162 v8::HandleScope handleScope(m_isolate); 162 v8::HandleScope handleScope(m_isolate);
163 v8::Handle<v8::Context> context = toV8Context(executionContext(), m_world.ge t()); 163 v8::Handle<v8::Context> context = toV8Context(executionContext(), *m_world);
164 if (context.IsEmpty()) 164 if (context.IsEmpty())
165 return; 165 return;
166 166
167 v8::Context::Scope scope(context); 167 v8::Context::Scope scope(context);
168 168
169 v8::Handle<v8::Object> receiver = DOMDataStore::current(m_isolate).get<V8Ele ment>(element, m_isolate); 169 v8::Handle<v8::Object> receiver = DOMDataStore::current(m_isolate).get<V8Ele ment>(element, m_isolate);
170 if (!receiver.IsEmpty()) { 170 if (!receiver.IsEmpty()) {
171 // Swizzle the prototype of the existing wrapper. We don't need to 171 // Swizzle the prototype of the existing wrapper. We don't need to
172 // worry about non-existent wrappers; they will get the right 172 // worry about non-existent wrappers; they will get the right
173 // prototype when wrapped. 173 // prototype when wrapped.
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 205
206 void V8CustomElementLifecycleCallbacks::attributeChanged(Element* element, const AtomicString& name, const AtomicString& oldValue, const AtomicString& newValue) 206 void V8CustomElementLifecycleCallbacks::attributeChanged(Element* element, const AtomicString& name, const AtomicString& oldValue, const AtomicString& newValue)
207 { 207 {
208 // FIXME: callbacks while paused should be queued up for execution to 208 // FIXME: callbacks while paused should be queued up for execution to
209 // continue then be delivered in order rather than delivered immediately. 209 // continue then be delivered in order rather than delivered immediately.
210 // Bug 329665 tracks similar behavior for other synchronous events. 210 // Bug 329665 tracks similar behavior for other synchronous events.
211 if (!executionContext() || executionContext()->activeDOMObjectsAreStopped()) 211 if (!executionContext() || executionContext()->activeDOMObjectsAreStopped())
212 return; 212 return;
213 213
214 v8::HandleScope handleScope(m_isolate); 214 v8::HandleScope handleScope(m_isolate);
215 v8::Handle<v8::Context> context = toV8Context(executionContext(), m_world.ge t()); 215 v8::Handle<v8::Context> context = toV8Context(executionContext(), *m_world);
216 if (context.IsEmpty()) 216 if (context.IsEmpty())
217 return; 217 return;
218 218
219 v8::Context::Scope scope(context); 219 v8::Context::Scope scope(context);
220 220
221 v8::Handle<v8::Object> receiver = toV8(element, context->Global(), m_isolate ).As<v8::Object>(); 221 v8::Handle<v8::Object> receiver = toV8(element, context->Global(), m_isolate ).As<v8::Object>();
222 ASSERT(!receiver.IsEmpty()); 222 ASSERT(!receiver.IsEmpty());
223 223
224 v8::Handle<v8::Function> callback = m_attributeChanged.newLocal(m_isolate); 224 v8::Handle<v8::Function> callback = m_attributeChanged.newLocal(m_isolate);
225 if (callback.IsEmpty()) 225 if (callback.IsEmpty())
(...skipping 14 matching lines...) Expand all
240 240
241 void V8CustomElementLifecycleCallbacks::call(const ScopedPersistent<v8::Function >& weakCallback, Element* element) 241 void V8CustomElementLifecycleCallbacks::call(const ScopedPersistent<v8::Function >& weakCallback, Element* element)
242 { 242 {
243 // FIXME: callbacks while paused should be queued up for execution to 243 // FIXME: callbacks while paused should be queued up for execution to
244 // continue then be delivered in order rather than delivered immediately. 244 // continue then be delivered in order rather than delivered immediately.
245 // Bug 329665 tracks similar behavior for other synchronous events. 245 // Bug 329665 tracks similar behavior for other synchronous events.
246 if (!executionContext() || executionContext()->activeDOMObjectsAreStopped()) 246 if (!executionContext() || executionContext()->activeDOMObjectsAreStopped())
247 return; 247 return;
248 248
249 v8::HandleScope handleScope(m_isolate); 249 v8::HandleScope handleScope(m_isolate);
250 v8::Handle<v8::Context> context = toV8Context(executionContext(), m_world.ge t()); 250 v8::Handle<v8::Context> context = toV8Context(executionContext(), *m_world);
251 if (context.IsEmpty()) 251 if (context.IsEmpty())
252 return; 252 return;
253 253
254 v8::Context::Scope scope(context); 254 v8::Context::Scope scope(context);
255 255
256 v8::Handle<v8::Function> callback = weakCallback.newLocal(m_isolate); 256 v8::Handle<v8::Function> callback = weakCallback.newLocal(m_isolate);
257 if (callback.IsEmpty()) 257 if (callback.IsEmpty())
258 return; 258 return;
259 259
260 v8::Handle<v8::Object> receiver = toV8(element, context->Global(), m_isolate ).As<v8::Object>(); 260 v8::Handle<v8::Object> receiver = toV8(element, context->Global(), m_isolate ).As<v8::Object>();
261 ASSERT(!receiver.IsEmpty()); 261 ASSERT(!receiver.IsEmpty());
262 262
263 InspectorInstrumentation::willExecuteCustomElementCallback(element); 263 InspectorInstrumentation::willExecuteCustomElementCallback(element);
264 264
265 v8::TryCatch exceptionCatcher; 265 v8::TryCatch exceptionCatcher;
266 exceptionCatcher.SetVerbose(true); 266 exceptionCatcher.SetVerbose(true);
267 ScriptController::callFunction(executionContext(), callback, receiver, 0, 0, m_isolate); 267 ScriptController::callFunction(executionContext(), callback, receiver, 0, 0, m_isolate);
268 } 268 }
269 269
270 } // namespace WebCore 270 } // namespace WebCore
OLDNEW
« no previous file with comments | « trunk/Source/bindings/v8/V8Binding.cpp ('k') | trunk/Source/bindings/v8/V8DOMConfiguration.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698