| 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 | 68 |
| 69 namespace WebCore { | 69 namespace WebCore { |
| 70 const WrapperTypeInfo V8TestNode::wrapperTypeInfo = { gin::kEmbedderBlink, V8Tes
tNode::domTemplate, V8TestNode::derefObject, 0, V8TestNode::toEventTarget, 0, V8
TestNode::installPerContextEnabledMethods, &V8Node::wrapperTypeInfo, WrapperType
ObjectPrototype, false }; | 70 const WrapperTypeInfo V8TestNode::wrapperTypeInfo = { gin::kEmbedderBlink, V8Tes
tNode::domTemplate, V8TestNode::derefObject, 0, V8TestNode::toEventTarget, 0, V8
TestNode::installPerContextEnabledMethods, &V8Node::wrapperTypeInfo, WrapperType
ObjectPrototype, false }; |
| 71 | 71 |
| 72 namespace TestNodeV8Internal { | 72 namespace TestNodeV8Internal { |
| 73 | 73 |
| 74 template <typename T> void V8_USE(T) { } | 74 template <typename T> void V8_USE(T) { } |
| 75 | 75 |
| 76 static void hrefAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info) | 76 static void hrefAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info) |
| 77 { | 77 { |
| 78 TestNode* imp = V8TestNode::toNative(info.Holder()); | 78 TestNode* impl = V8TestNode::toNative(info.Holder()); |
| 79 v8SetReturnValueString(info, imp->href(), info.GetIsolate()); | 79 v8SetReturnValueString(info, impl->href(), info.GetIsolate()); |
| 80 } | 80 } |
| 81 | 81 |
| 82 static void hrefAttributeGetterCallback(v8::Local<v8::String>, const v8::Propert
yCallbackInfo<v8::Value>& info) | 82 static void hrefAttributeGetterCallback(v8::Local<v8::String>, const v8::Propert
yCallbackInfo<v8::Value>& info) |
| 83 { | 83 { |
| 84 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); | 84 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |
| 85 TestNodeV8Internal::hrefAttributeGetter(info); | 85 TestNodeV8Internal::hrefAttributeGetter(info); |
| 86 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 86 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
| 87 } | 87 } |
| 88 | 88 |
| 89 static void hrefAttributeSetter(v8::Local<v8::Value> jsValue, const v8::Property
CallbackInfo<void>& info) | 89 static void hrefAttributeSetter(v8::Local<v8::Value> jsValue, const v8::Property
CallbackInfo<void>& info) |
| 90 { | 90 { |
| 91 TestNode* imp = V8TestNode::toNative(info.Holder()); | 91 TestNode* impl = V8TestNode::toNative(info.Holder()); |
| 92 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, cppValue, jsValue); | 92 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, cppValue, jsValue); |
| 93 imp->setHref(cppValue); | 93 impl->setHref(cppValue); |
| 94 } | 94 } |
| 95 | 95 |
| 96 static void hrefAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Val
ue> jsValue, const v8::PropertyCallbackInfo<void>& info) | 96 static void hrefAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Val
ue> jsValue, const v8::PropertyCallbackInfo<void>& info) |
| 97 { | 97 { |
| 98 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); | 98 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); |
| 99 TestNodeV8Internal::hrefAttributeSetter(jsValue, info); | 99 TestNodeV8Internal::hrefAttributeSetter(jsValue, info); |
| 100 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 100 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
| 101 } | 101 } |
| 102 | 102 |
| 103 static void hrefThrowsAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>&
info) | 103 static void hrefThrowsAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>&
info) |
| 104 { | 104 { |
| 105 TestNode* imp = V8TestNode::toNative(info.Holder()); | 105 TestNode* impl = V8TestNode::toNative(info.Holder()); |
| 106 v8SetReturnValueString(info, imp->hrefThrows(), info.GetIsolate()); | 106 v8SetReturnValueString(info, impl->hrefThrows(), info.GetIsolate()); |
| 107 } | 107 } |
| 108 | 108 |
| 109 static void hrefThrowsAttributeGetterCallback(v8::Local<v8::String>, const v8::P
ropertyCallbackInfo<v8::Value>& info) | 109 static void hrefThrowsAttributeGetterCallback(v8::Local<v8::String>, const v8::P
ropertyCallbackInfo<v8::Value>& info) |
| 110 { | 110 { |
| 111 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); | 111 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |
| 112 TestNodeV8Internal::hrefThrowsAttributeGetter(info); | 112 TestNodeV8Internal::hrefThrowsAttributeGetter(info); |
| 113 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 113 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
| 114 } | 114 } |
| 115 | 115 |
| 116 static void hrefThrowsAttributeSetter(v8::Local<v8::Value> jsValue, const v8::Pr
opertyCallbackInfo<void>& info) | 116 static void hrefThrowsAttributeSetter(v8::Local<v8::Value> jsValue, const v8::Pr
opertyCallbackInfo<void>& info) |
| 117 { | 117 { |
| 118 ExceptionState exceptionState(ExceptionState::SetterContext, "hrefThrows", "
TestNode", info.Holder(), info.GetIsolate()); | 118 ExceptionState exceptionState(ExceptionState::SetterContext, "hrefThrows", "
TestNode", info.Holder(), info.GetIsolate()); |
| 119 TestNode* imp = V8TestNode::toNative(info.Holder()); | 119 TestNode* impl = V8TestNode::toNative(info.Holder()); |
| 120 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, cppValue, jsValue); | 120 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, cppValue, jsValue); |
| 121 imp->setHrefThrows(cppValue, exceptionState); | 121 impl->setHrefThrows(cppValue, exceptionState); |
| 122 exceptionState.throwIfNeeded(); | 122 exceptionState.throwIfNeeded(); |
| 123 } | 123 } |
| 124 | 124 |
| 125 static void hrefThrowsAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v
8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) | 125 static void hrefThrowsAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v
8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) |
| 126 { | 126 { |
| 127 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); | 127 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); |
| 128 TestNodeV8Internal::hrefThrowsAttributeSetter(jsValue, info); | 128 TestNodeV8Internal::hrefThrowsAttributeSetter(jsValue, info); |
| 129 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 129 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
| 130 } | 130 } |
| 131 | 131 |
| 132 static void hrefCallWithAttributeGetter(const v8::PropertyCallbackInfo<v8::Value
>& info) | 132 static void hrefCallWithAttributeGetter(const v8::PropertyCallbackInfo<v8::Value
>& info) |
| 133 { | 133 { |
| 134 TestNode* imp = V8TestNode::toNative(info.Holder()); | 134 TestNode* impl = V8TestNode::toNative(info.Holder()); |
| 135 v8SetReturnValueString(info, imp->hrefCallWith(), info.GetIsolate()); | 135 v8SetReturnValueString(info, impl->hrefCallWith(), info.GetIsolate()); |
| 136 } | 136 } |
| 137 | 137 |
| 138 static void hrefCallWithAttributeGetterCallback(v8::Local<v8::String>, const v8:
:PropertyCallbackInfo<v8::Value>& info) | 138 static void hrefCallWithAttributeGetterCallback(v8::Local<v8::String>, const v8:
:PropertyCallbackInfo<v8::Value>& info) |
| 139 { | 139 { |
| 140 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); | 140 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |
| 141 TestNodeV8Internal::hrefCallWithAttributeGetter(info); | 141 TestNodeV8Internal::hrefCallWithAttributeGetter(info); |
| 142 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 142 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
| 143 } | 143 } |
| 144 | 144 |
| 145 static void hrefCallWithAttributeSetter(v8::Local<v8::Value> jsValue, const v8::
PropertyCallbackInfo<void>& info) | 145 static void hrefCallWithAttributeSetter(v8::Local<v8::Value> jsValue, const v8::
PropertyCallbackInfo<void>& info) |
| 146 { | 146 { |
| 147 TestNode* imp = V8TestNode::toNative(info.Holder()); | 147 TestNode* impl = V8TestNode::toNative(info.Holder()); |
| 148 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, cppValue, jsValue); | 148 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, cppValue, jsValue); |
| 149 imp->setHrefCallWith(callingDOMWindow(info.GetIsolate()), enteredDOMWindow(i
nfo.GetIsolate()), cppValue); | 149 impl->setHrefCallWith(callingDOMWindow(info.GetIsolate()), enteredDOMWindow(
info.GetIsolate()), cppValue); |
| 150 } | 150 } |
| 151 | 151 |
| 152 static void hrefCallWithAttributeSetterCallback(v8::Local<v8::String>, v8::Local
<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) | 152 static void hrefCallWithAttributeSetterCallback(v8::Local<v8::String>, v8::Local
<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) |
| 153 { | 153 { |
| 154 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); | 154 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); |
| 155 TestNodeV8Internal::hrefCallWithAttributeSetter(jsValue, info); | 155 TestNodeV8Internal::hrefCallWithAttributeSetter(jsValue, info); |
| 156 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 156 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
| 157 } | 157 } |
| 158 | 158 |
| 159 static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info) | 159 static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info) |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 fromInternalPointer(object)->deref(); | 267 fromInternalPointer(object)->deref(); |
| 268 } | 268 } |
| 269 | 269 |
| 270 template<> | 270 template<> |
| 271 v8::Handle<v8::Value> toV8NoInline(TestNode* impl, v8::Handle<v8::Object> creati
onContext, v8::Isolate* isolate) | 271 v8::Handle<v8::Value> toV8NoInline(TestNode* impl, v8::Handle<v8::Object> creati
onContext, v8::Isolate* isolate) |
| 272 { | 272 { |
| 273 return toV8(impl, creationContext, isolate); | 273 return toV8(impl, creationContext, isolate); |
| 274 } | 274 } |
| 275 | 275 |
| 276 } // namespace WebCore | 276 } // namespace WebCore |
| OLD | NEW |