| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 namespace WebCore { | 44 namespace WebCore { |
| 45 | 45 |
| 46 #define CALLBACK_LIST(V) \ | 46 #define CALLBACK_LIST(V) \ |
| 47 V(created, Created) \ | 47 V(created, Created) \ |
| 48 V(enteredView, EnteredView) \ | 48 V(enteredView, EnteredView) \ |
| 49 V(leftView, LeftView) \ | 49 V(leftView, LeftView) \ |
| 50 V(attributeChanged, AttributeChanged) | 50 V(attributeChanged, AttributeChanged) |
| 51 | 51 |
| 52 PassRefPtr<V8CustomElementLifecycleCallbacks> V8CustomElementLifecycleCallbacks:
:create(ScriptExecutionContext* scriptExecutionContext, v8::Handle<v8::Object> p
rototype, v8::Handle<v8::Function> created, v8::Handle<v8::Function> enteredView
, v8::Handle<v8::Function> leftView, v8::Handle<v8::Function> attributeChanged) | 52 PassRefPtr<V8CustomElementLifecycleCallbacks> V8CustomElementLifecycleCallbacks:
:create(ScriptExecutionContext* scriptExecutionContext, v8::Handle<v8::Object> p
rototype, v8::Handle<v8::Function> created, v8::Handle<v8::Function> enteredView
, v8::Handle<v8::Function> leftView, v8::Handle<v8::Function> attributeChanged) |
| 53 { | 53 { |
| 54 v8::Isolate* isolate = toIsolate(scriptExecutionContext); |
| 54 // A given object can only be used as a Custom Element prototype | 55 // A given object can only be used as a Custom Element prototype |
| 55 // once; see customElementIsInterfacePrototypeObject | 56 // once; see customElementIsInterfacePrototypeObject |
| 56 #define SET_HIDDEN_PROPERTY(Value, Name) \ | 57 #define SET_HIDDEN_PROPERTY(Value, Name) \ |
| 57 ASSERT(prototype->GetHiddenValue(V8HiddenPropertyName::customElement##Name()
).IsEmpty()); \ | 58 ASSERT(prototype->GetHiddenValue(V8HiddenPropertyName::customElement##Name(i
solate)).IsEmpty()); \ |
| 58 if (!Value.IsEmpty()) \ | 59 if (!Value.IsEmpty()) \ |
| 59 prototype->SetHiddenValue(V8HiddenPropertyName::customElement##Name(), V
alue); | 60 prototype->SetHiddenValue(V8HiddenPropertyName::customElement##Name(isol
ate), Value); |
| 60 | 61 |
| 61 CALLBACK_LIST(SET_HIDDEN_PROPERTY) | 62 CALLBACK_LIST(SET_HIDDEN_PROPERTY) |
| 62 #undef SET_HIDDEN_PROPERTY | 63 #undef SET_HIDDEN_PROPERTY |
| 63 | 64 |
| 64 return adoptRef(new V8CustomElementLifecycleCallbacks(scriptExecutionContext
, prototype, created, enteredView, leftView, attributeChanged)); | 65 return adoptRef(new V8CustomElementLifecycleCallbacks(scriptExecutionContext
, prototype, created, enteredView, leftView, attributeChanged)); |
| 65 } | 66 } |
| 66 | 67 |
| 67 static CustomElementLifecycleCallbacks::CallbackType flagSet(v8::Handle<v8::Func
tion> enteredView, v8::Handle<v8::Function> leftView, v8::Handle<v8::Function> a
ttributeChanged) | 68 static CustomElementLifecycleCallbacks::CallbackType flagSet(v8::Handle<v8::Func
tion> enteredView, v8::Handle<v8::Function> leftView, v8::Handle<v8::Function> a
ttributeChanged) |
| 68 { | 69 { |
| 69 // V8 Custom Elements always run created to swizzle prototypes. | 70 // V8 Custom Elements always run created to swizzle prototypes. |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 | 247 |
| 247 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>(); |
| 248 ASSERT(!receiver.IsEmpty()); | 249 ASSERT(!receiver.IsEmpty()); |
| 249 | 250 |
| 250 v8::TryCatch exceptionCatcher; | 251 v8::TryCatch exceptionCatcher; |
| 251 exceptionCatcher.SetVerbose(true); | 252 exceptionCatcher.SetVerbose(true); |
| 252 ScriptController::callFunctionWithInstrumentation(scriptExecutionContext(),
callback, receiver, 0, 0, isolate); | 253 ScriptController::callFunctionWithInstrumentation(scriptExecutionContext(),
callback, receiver, 0, 0, isolate); |
| 253 } | 254 } |
| 254 | 255 |
| 255 } // namespace WebCore | 256 } // namespace WebCore |
| OLD | NEW |