OLD | NEW |
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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 | 108 |
109 CALLBACK_LIST(MAKE_WEAK) | 109 CALLBACK_LIST(MAKE_WEAK) |
110 #undef MAKE_WEAK | 110 #undef MAKE_WEAK |
111 } | 111 } |
112 | 112 |
113 V8PerContextData* V8CustomElementLifecycleCallbacks::creationContextData() | 113 V8PerContextData* V8CustomElementLifecycleCallbacks::creationContextData() |
114 { | 114 { |
115 if (!executionContext()) | 115 if (!executionContext()) |
116 return 0; | 116 return 0; |
117 | 117 |
118 v8::Handle<v8::Context> context = toV8Context(executionContext(), m_world.ge
t()); | 118 v8::Handle<v8::Context> context = toV8Context(executionContext(), m_world); |
119 if (context.IsEmpty()) | 119 if (context.IsEmpty()) |
120 return 0; | 120 return 0; |
121 | 121 |
122 return V8PerContextData::from(context); | 122 return V8PerContextData::from(context); |
123 } | 123 } |
124 | 124 |
125 V8CustomElementLifecycleCallbacks::~V8CustomElementLifecycleCallbacks() | 125 V8CustomElementLifecycleCallbacks::~V8CustomElementLifecycleCallbacks() |
126 { | 126 { |
127 if (!m_owner) | 127 if (!m_owner) |
128 return; | 128 return; |
(...skipping 23 matching lines...) Expand all Loading... |
152 { | 152 { |
153 // FIXME: callbacks while paused should be queued up for execution to | 153 // FIXME: callbacks while paused should be queued up for execution to |
154 // continue then be delivered in order rather than delivered immediately. | 154 // continue then be delivered in order rather than delivered immediately. |
155 // Bug 329665 tracks similar behavior for other synchronous events. | 155 // Bug 329665 tracks similar behavior for other synchronous events. |
156 if (!executionContext() || executionContext()->activeDOMObjectsAreStopped()) | 156 if (!executionContext() || executionContext()->activeDOMObjectsAreStopped()) |
157 return; | 157 return; |
158 | 158 |
159 element->setCustomElementState(Element::Upgraded); | 159 element->setCustomElementState(Element::Upgraded); |
160 | 160 |
161 v8::HandleScope handleScope(m_isolate); | 161 v8::HandleScope handleScope(m_isolate); |
162 v8::Handle<v8::Context> context = toV8Context(executionContext(), m_world.ge
t()); | 162 v8::Handle<v8::Context> context = toV8Context(executionContext(), m_world); |
163 if (context.IsEmpty()) | 163 if (context.IsEmpty()) |
164 return; | 164 return; |
165 | 165 |
166 v8::Context::Scope scope(context); | 166 v8::Context::Scope scope(context); |
167 | 167 |
168 v8::Handle<v8::Object> receiver = DOMDataStore::current(m_isolate).get<V8Ele
ment>(element, m_isolate); | 168 v8::Handle<v8::Object> receiver = DOMDataStore::current(m_isolate).get<V8Ele
ment>(element, m_isolate); |
169 if (!receiver.IsEmpty()) { | 169 if (!receiver.IsEmpty()) { |
170 // Swizzle the prototype of the existing wrapper. We don't need to | 170 // Swizzle the prototype of the existing wrapper. We don't need to |
171 // worry about non-existent wrappers; they will get the right | 171 // worry about non-existent wrappers; they will get the right |
172 // prototype when wrapped. | 172 // prototype when wrapped. |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 | 204 |
205 void V8CustomElementLifecycleCallbacks::attributeChanged(Element* element, const
AtomicString& name, const AtomicString& oldValue, const AtomicString& newValue) | 205 void V8CustomElementLifecycleCallbacks::attributeChanged(Element* element, const
AtomicString& name, const AtomicString& oldValue, const AtomicString& newValue) |
206 { | 206 { |
207 // FIXME: callbacks while paused should be queued up for execution to | 207 // FIXME: callbacks while paused should be queued up for execution to |
208 // continue then be delivered in order rather than delivered immediately. | 208 // continue then be delivered in order rather than delivered immediately. |
209 // Bug 329665 tracks similar behavior for other synchronous events. | 209 // Bug 329665 tracks similar behavior for other synchronous events. |
210 if (!executionContext() || executionContext()->activeDOMObjectsAreStopped()) | 210 if (!executionContext() || executionContext()->activeDOMObjectsAreStopped()) |
211 return; | 211 return; |
212 | 212 |
213 v8::HandleScope handleScope(m_isolate); | 213 v8::HandleScope handleScope(m_isolate); |
214 v8::Handle<v8::Context> context = toV8Context(executionContext(), m_world.ge
t()); | 214 v8::Handle<v8::Context> context = toV8Context(executionContext(), m_world); |
215 if (context.IsEmpty()) | 215 if (context.IsEmpty()) |
216 return; | 216 return; |
217 | 217 |
218 v8::Context::Scope scope(context); | 218 v8::Context::Scope scope(context); |
219 | 219 |
220 v8::Handle<v8::Object> receiver = toV8(element, context->Global(), m_isolate
).As<v8::Object>(); | 220 v8::Handle<v8::Object> receiver = toV8(element, context->Global(), m_isolate
).As<v8::Object>(); |
221 ASSERT(!receiver.IsEmpty()); | 221 ASSERT(!receiver.IsEmpty()); |
222 | 222 |
223 v8::Handle<v8::Function> callback = m_attributeChanged.newLocal(m_isolate); | 223 v8::Handle<v8::Function> callback = m_attributeChanged.newLocal(m_isolate); |
224 if (callback.IsEmpty()) | 224 if (callback.IsEmpty()) |
(...skipping 14 matching lines...) Expand all Loading... |
239 | 239 |
240 void V8CustomElementLifecycleCallbacks::call(const ScopedPersistent<v8::Function
>& weakCallback, Element* element) | 240 void V8CustomElementLifecycleCallbacks::call(const ScopedPersistent<v8::Function
>& weakCallback, Element* element) |
241 { | 241 { |
242 // FIXME: callbacks while paused should be queued up for execution to | 242 // FIXME: callbacks while paused should be queued up for execution to |
243 // continue then be delivered in order rather than delivered immediately. | 243 // continue then be delivered in order rather than delivered immediately. |
244 // Bug 329665 tracks similar behavior for other synchronous events. | 244 // Bug 329665 tracks similar behavior for other synchronous events. |
245 if (!executionContext() || executionContext()->activeDOMObjectsAreStopped()) | 245 if (!executionContext() || executionContext()->activeDOMObjectsAreStopped()) |
246 return; | 246 return; |
247 | 247 |
248 v8::HandleScope handleScope(m_isolate); | 248 v8::HandleScope handleScope(m_isolate); |
249 v8::Handle<v8::Context> context = toV8Context(executionContext(), m_world.ge
t()); | 249 v8::Handle<v8::Context> context = toV8Context(executionContext(), m_world); |
250 if (context.IsEmpty()) | 250 if (context.IsEmpty()) |
251 return; | 251 return; |
252 | 252 |
253 v8::Context::Scope scope(context); | 253 v8::Context::Scope scope(context); |
254 | 254 |
255 v8::Handle<v8::Function> callback = weakCallback.newLocal(m_isolate); | 255 v8::Handle<v8::Function> callback = weakCallback.newLocal(m_isolate); |
256 if (callback.IsEmpty()) | 256 if (callback.IsEmpty()) |
257 return; | 257 return; |
258 | 258 |
259 v8::Handle<v8::Object> receiver = toV8(element, context->Global(), m_isolate
).As<v8::Object>(); | 259 v8::Handle<v8::Object> receiver = toV8(element, context->Global(), m_isolate
).As<v8::Object>(); |
260 ASSERT(!receiver.IsEmpty()); | 260 ASSERT(!receiver.IsEmpty()); |
261 | 261 |
262 InspectorInstrumentation::willExecuteCustomElementCallback(element); | 262 InspectorInstrumentation::willExecuteCustomElementCallback(element); |
263 | 263 |
264 v8::TryCatch exceptionCatcher; | 264 v8::TryCatch exceptionCatcher; |
265 exceptionCatcher.SetVerbose(true); | 265 exceptionCatcher.SetVerbose(true); |
266 ScriptController::callFunction(executionContext(), callback, receiver, 0, 0,
m_isolate); | 266 ScriptController::callFunction(executionContext(), callback, receiver, 0, 0,
m_isolate); |
267 } | 267 } |
268 | 268 |
269 } // namespace WebCore | 269 } // namespace WebCore |
OLD | NEW |