| 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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 if (callback.IsEmpty()) | 177 if (callback.IsEmpty()) |
| 178 return; | 178 return; |
| 179 | 179 |
| 180 if (receiver.IsEmpty()) | 180 if (receiver.IsEmpty()) |
| 181 receiver = toV8(element, context->Global(), isolate).As<v8::Object>(); | 181 receiver = toV8(element, context->Global(), isolate).As<v8::Object>(); |
| 182 | 182 |
| 183 ASSERT(!receiver.IsEmpty()); | 183 ASSERT(!receiver.IsEmpty()); |
| 184 | 184 |
| 185 v8::TryCatch exceptionCatcher; | 185 v8::TryCatch exceptionCatcher; |
| 186 exceptionCatcher.SetVerbose(true); | 186 exceptionCatcher.SetVerbose(true); |
| 187 ScriptController::callFunctionWithInstrumentation(scriptExecutionContext(),
callback, receiver, 0, 0, isolate); | 187 ScriptController::callFunction(scriptExecutionContext(), callback, receiver,
0, 0, isolate); |
| 188 } | 188 } |
| 189 | 189 |
| 190 void V8CustomElementLifecycleCallbacks::enteredView(Element* element) | 190 void V8CustomElementLifecycleCallbacks::enteredView(Element* element) |
| 191 { | 191 { |
| 192 call(m_enteredView, element); | 192 call(m_enteredView, element); |
| 193 } | 193 } |
| 194 | 194 |
| 195 void V8CustomElementLifecycleCallbacks::leftView(Element* element) | 195 void V8CustomElementLifecycleCallbacks::leftView(Element* element) |
| 196 { | 196 { |
| 197 call(m_leftView, element); | 197 call(m_leftView, element); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 218 return; | 218 return; |
| 219 | 219 |
| 220 v8::Handle<v8::Value> argv[] = { | 220 v8::Handle<v8::Value> argv[] = { |
| 221 v8String(name, isolate), | 221 v8String(name, isolate), |
| 222 oldValue.isNull() ? v8::Handle<v8::Value>(v8::Null(isolate)) : v8::Handl
e<v8::Value>(v8String(oldValue, isolate)), | 222 oldValue.isNull() ? v8::Handle<v8::Value>(v8::Null(isolate)) : v8::Handl
e<v8::Value>(v8String(oldValue, isolate)), |
| 223 newValue.isNull() ? v8::Handle<v8::Value>(v8::Null(isolate)) : v8::Handl
e<v8::Value>(v8String(newValue, isolate)) | 223 newValue.isNull() ? v8::Handle<v8::Value>(v8::Null(isolate)) : v8::Handl
e<v8::Value>(v8String(newValue, isolate)) |
| 224 }; | 224 }; |
| 225 | 225 |
| 226 v8::TryCatch exceptionCatcher; | 226 v8::TryCatch exceptionCatcher; |
| 227 exceptionCatcher.SetVerbose(true); | 227 exceptionCatcher.SetVerbose(true); |
| 228 ScriptController::callFunctionWithInstrumentation(scriptExecutionContext(),
callback, receiver, WTF_ARRAY_LENGTH(argv), argv, isolate); | 228 ScriptController::callFunction(scriptExecutionContext(), callback, receiver,
WTF_ARRAY_LENGTH(argv), argv, isolate); |
| 229 } | 229 } |
| 230 | 230 |
| 231 void V8CustomElementLifecycleCallbacks::call(const ScopedPersistent<v8::Function
>& weakCallback, Element* element) | 231 void V8CustomElementLifecycleCallbacks::call(const ScopedPersistent<v8::Function
>& weakCallback, Element* element) |
| 232 { | 232 { |
| 233 if (!canInvokeCallback()) | 233 if (!canInvokeCallback()) |
| 234 return; | 234 return; |
| 235 | 235 |
| 236 v8::HandleScope handleScope(toIsolate(scriptExecutionContext())); | 236 v8::HandleScope handleScope(toIsolate(scriptExecutionContext())); |
| 237 v8::Handle<v8::Context> context = toV8Context(scriptExecutionContext(), m_wo
rld.get()); | 237 v8::Handle<v8::Context> context = toV8Context(scriptExecutionContext(), m_wo
rld.get()); |
| 238 if (context.IsEmpty()) | 238 if (context.IsEmpty()) |
| 239 return; | 239 return; |
| 240 | 240 |
| 241 v8::Context::Scope scope(context); | 241 v8::Context::Scope scope(context); |
| 242 v8::Isolate* isolate = context->GetIsolate(); | 242 v8::Isolate* isolate = context->GetIsolate(); |
| 243 | 243 |
| 244 v8::Handle<v8::Function> callback = weakCallback.newLocal(isolate); | 244 v8::Handle<v8::Function> callback = weakCallback.newLocal(isolate); |
| 245 if (callback.IsEmpty()) | 245 if (callback.IsEmpty()) |
| 246 return; | 246 return; |
| 247 | 247 |
| 248 v8::Handle<v8::Object> receiver = toV8(element, context->Global(), isolate).
As<v8::Object>(); | 248 v8::Handle<v8::Object> receiver = toV8(element, context->Global(), isolate).
As<v8::Object>(); |
| 249 ASSERT(!receiver.IsEmpty()); | 249 ASSERT(!receiver.IsEmpty()); |
| 250 | 250 |
| 251 v8::TryCatch exceptionCatcher; | 251 v8::TryCatch exceptionCatcher; |
| 252 exceptionCatcher.SetVerbose(true); | 252 exceptionCatcher.SetVerbose(true); |
| 253 ScriptController::callFunctionWithInstrumentation(scriptExecutionContext(),
callback, receiver, 0, 0, isolate); | 253 ScriptController::callFunction(scriptExecutionContext(), callback, receiver,
0, 0, isolate); |
| 254 } | 254 } |
| 255 | 255 |
| 256 } // namespace WebCore | 256 } // namespace WebCore |
| OLD | NEW |