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

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

Issue 2595543003: Rename toV8(...) function in Blink to ToV8(...). (Closed)
Patch Set: Rebasing... Created 3 years, 11 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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 // Bug 329665 tracks similar behavior for other synchronous events. 152 // Bug 329665 tracks similar behavior for other synchronous events.
153 if (!m_scriptState->contextIsValid()) 153 if (!m_scriptState->contextIsValid())
154 return; 154 return;
155 155
156 element->setV0CustomElementState(Element::V0Upgraded); 156 element->setV0CustomElementState(Element::V0Upgraded);
157 157
158 ScriptState::Scope scope(m_scriptState.get()); 158 ScriptState::Scope scope(m_scriptState.get());
159 v8::Isolate* isolate = m_scriptState->isolate(); 159 v8::Isolate* isolate = m_scriptState->isolate();
160 v8::Local<v8::Context> context = m_scriptState->context(); 160 v8::Local<v8::Context> context = m_scriptState->context();
161 v8::Local<v8::Value> receiverValue = 161 v8::Local<v8::Value> receiverValue =
162 toV8(element, context->Global(), isolate); 162 ToV8(element, context->Global(), isolate);
163 if (receiverValue.IsEmpty()) 163 if (receiverValue.IsEmpty())
164 return; 164 return;
165 v8::Local<v8::Object> receiver = receiverValue.As<v8::Object>(); 165 v8::Local<v8::Object> receiver = receiverValue.As<v8::Object>();
166 166
167 // Swizzle the prototype of the wrapper. 167 // Swizzle the prototype of the wrapper.
168 v8::Local<v8::Object> prototype = m_prototype.newLocal(isolate); 168 v8::Local<v8::Object> prototype = m_prototype.newLocal(isolate);
169 if (prototype.IsEmpty()) 169 if (prototype.IsEmpty())
170 return; 170 return;
171 if (!v8CallBoolean(receiver->SetPrototype(context, prototype))) 171 if (!v8CallBoolean(receiver->SetPrototype(context, prototype)))
172 return; 172 return;
(...skipping 22 matching lines...) Expand all
195 const AtomicString& oldValue, 195 const AtomicString& oldValue,
196 const AtomicString& newValue) { 196 const AtomicString& newValue) {
197 // FIXME: callbacks while paused should be queued up for execution to 197 // FIXME: callbacks while paused should be queued up for execution to
198 // continue then be delivered in order rather than delivered immediately. 198 // continue then be delivered in order rather than delivered immediately.
199 // Bug 329665 tracks similar behavior for other synchronous events. 199 // Bug 329665 tracks similar behavior for other synchronous events.
200 if (!m_scriptState->contextIsValid()) 200 if (!m_scriptState->contextIsValid())
201 return; 201 return;
202 ScriptState::Scope scope(m_scriptState.get()); 202 ScriptState::Scope scope(m_scriptState.get());
203 v8::Isolate* isolate = m_scriptState->isolate(); 203 v8::Isolate* isolate = m_scriptState->isolate();
204 v8::Local<v8::Context> context = m_scriptState->context(); 204 v8::Local<v8::Context> context = m_scriptState->context();
205 v8::Local<v8::Value> receiver = toV8(element, context->Global(), isolate); 205 v8::Local<v8::Value> receiver = ToV8(element, context->Global(), isolate);
206 if (receiver.IsEmpty()) 206 if (receiver.IsEmpty())
207 return; 207 return;
208 208
209 v8::Local<v8::Function> callback = m_attributeChanged.newLocal(isolate); 209 v8::Local<v8::Function> callback = m_attributeChanged.newLocal(isolate);
210 if (callback.IsEmpty()) 210 if (callback.IsEmpty())
211 return; 211 return;
212 212
213 v8::Local<v8::Value> argv[] = { 213 v8::Local<v8::Value> argv[] = {
214 v8String(isolate, name), 214 v8String(isolate, name),
215 oldValue.isNull() ? v8::Local<v8::Value>(v8::Null(isolate)) 215 oldValue.isNull() ? v8::Local<v8::Value>(v8::Null(isolate))
(...skipping 15 matching lines...) Expand all
231 // Bug 329665 tracks similar behavior for other synchronous events. 231 // Bug 329665 tracks similar behavior for other synchronous events.
232 if (!m_scriptState->contextIsValid()) 232 if (!m_scriptState->contextIsValid())
233 return; 233 return;
234 ScriptState::Scope scope(m_scriptState.get()); 234 ScriptState::Scope scope(m_scriptState.get());
235 v8::Isolate* isolate = m_scriptState->isolate(); 235 v8::Isolate* isolate = m_scriptState->isolate();
236 v8::Local<v8::Context> context = m_scriptState->context(); 236 v8::Local<v8::Context> context = m_scriptState->context();
237 v8::Local<v8::Function> callback = weakCallback.newLocal(isolate); 237 v8::Local<v8::Function> callback = weakCallback.newLocal(isolate);
238 if (callback.IsEmpty()) 238 if (callback.IsEmpty())
239 return; 239 return;
240 240
241 v8::Local<v8::Value> receiver = toV8(element, context->Global(), isolate); 241 v8::Local<v8::Value> receiver = ToV8(element, context->Global(), isolate);
242 if (receiver.IsEmpty()) 242 if (receiver.IsEmpty())
243 return; 243 return;
244 244
245 v8::TryCatch exceptionCatcher(isolate); 245 v8::TryCatch exceptionCatcher(isolate);
246 exceptionCatcher.SetVerbose(true); 246 exceptionCatcher.SetVerbose(true);
247 V8ScriptRunner::callFunction(callback, m_scriptState->getExecutionContext(), 247 V8ScriptRunner::callFunction(callback, m_scriptState->getExecutionContext(),
248 receiver, 0, 0, isolate); 248 receiver, 0, 0, isolate);
249 } 249 }
250 250
251 DEFINE_TRACE(V8V0CustomElementLifecycleCallbacks) { 251 DEFINE_TRACE(V8V0CustomElementLifecycleCallbacks) {
252 V0CustomElementLifecycleCallbacks::trace(visitor); 252 V0CustomElementLifecycleCallbacks::trace(visitor);
253 } 253 }
254 254
255 } // namespace blink 255 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698