| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY! | 5 // This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY! |
| 6 | 6 |
| 7 #include "config.h" | 7 #include "config.h" |
| 8 #include "V8TestSpecialOperations.h" | 8 #include "V8TestSpecialOperationsOverrideBuiltins.h" |
| 9 | 9 |
| 10 #include "RuntimeEnabledFeatures.h" | 10 #include "RuntimeEnabledFeatures.h" |
| 11 #include "V8Node.h" | |
| 12 #include "V8NodeList.h" | |
| 13 #include "bindings/v8/ExceptionState.h" | 11 #include "bindings/v8/ExceptionState.h" |
| 14 #include "bindings/v8/V8DOMConfiguration.h" | 12 #include "bindings/v8/V8DOMConfiguration.h" |
| 15 #include "bindings/v8/V8HiddenValue.h" | 13 #include "bindings/v8/V8HiddenValue.h" |
| 16 #include "bindings/v8/V8ObjectConstructor.h" | 14 #include "bindings/v8/V8ObjectConstructor.h" |
| 17 #include "core/dom/ContextFeatures.h" | 15 #include "core/dom/ContextFeatures.h" |
| 18 #include "core/dom/Document.h" | 16 #include "core/dom/Document.h" |
| 19 #include "platform/TraceEvent.h" | 17 #include "platform/TraceEvent.h" |
| 20 #include "wtf/GetPtr.h" | 18 #include "wtf/GetPtr.h" |
| 21 #include "wtf/RefPtr.h" | 19 #include "wtf/RefPtr.h" |
| 22 | 20 |
| 23 namespace WebCore { | 21 namespace WebCore { |
| 24 | 22 |
| 25 static void initializeScriptWrappableForInterface(TestSpecialOperations* object) | 23 static void initializeScriptWrappableForInterface(TestSpecialOperationsOverrideB
uiltins* object) |
| 26 { | 24 { |
| 27 if (ScriptWrappable::wrapperCanBeStoredInObject(object)) | 25 if (ScriptWrappable::wrapperCanBeStoredInObject(object)) |
| 28 ScriptWrappable::setTypeInfoInObject(object, &V8TestSpecialOperations::w
rapperTypeInfo); | 26 ScriptWrappable::setTypeInfoInObject(object, &V8TestSpecialOperationsOve
rrideBuiltins::wrapperTypeInfo); |
| 29 else | 27 else |
| 30 ASSERT_NOT_REACHED(); | 28 ASSERT_NOT_REACHED(); |
| 31 } | 29 } |
| 32 | 30 |
| 33 } // namespace WebCore | 31 } // namespace WebCore |
| 34 | 32 |
| 35 void webCoreInitializeScriptWrappableForInterface(WebCore::TestSpecialOperations
* object) | 33 void webCoreInitializeScriptWrappableForInterface(WebCore::TestSpecialOperations
OverrideBuiltins* object) |
| 36 { | 34 { |
| 37 WebCore::initializeScriptWrappableForInterface(object); | 35 WebCore::initializeScriptWrappableForInterface(object); |
| 38 } | 36 } |
| 39 | 37 |
| 40 namespace WebCore { | 38 namespace WebCore { |
| 41 const WrapperTypeInfo V8TestSpecialOperations::wrapperTypeInfo = { gin::kEmbedde
rBlink, V8TestSpecialOperations::domTemplate, V8TestSpecialOperations::derefObje
ct, 0, 0, 0, V8TestSpecialOperations::installPerContextEnabledMethods, 0, Wrappe
rTypeObjectPrototype, false }; | 39 const WrapperTypeInfo V8TestSpecialOperationsOverrideBuiltins::wrapperTypeInfo =
{ gin::kEmbedderBlink, V8TestSpecialOperationsOverrideBuiltins::domTemplate, V8
TestSpecialOperationsOverrideBuiltins::derefObject, 0, 0, 0, V8TestSpecialOperat
ionsOverrideBuiltins::installPerContextEnabledMethods, 0, WrapperTypeObjectProto
type, false }; |
| 42 | 40 |
| 43 namespace TestSpecialOperationsV8Internal { | 41 namespace TestSpecialOperationsOverrideBuiltinsV8Internal { |
| 44 | 42 |
| 45 template <typename T> void V8_USE(T) { } | 43 template <typename T> void V8_USE(T) { } |
| 46 | 44 |
| 47 static void namedItemMethod(const v8::FunctionCallbackInfo<v8::Value>& info) | |
| 48 { | |
| 49 if (UNLIKELY(info.Length() < 1)) { | |
| 50 throwTypeError(ExceptionMessages::failedToExecute("namedItem", "TestSpec
ialOperations", ExceptionMessages::notEnoughArguments(1, info.Length())), info.G
etIsolate()); | |
| 51 return; | |
| 52 } | |
| 53 TestSpecialOperations* impl = V8TestSpecialOperations::toNative(info.Holder(
)); | |
| 54 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, name, info[0]); | |
| 55 bool result0Enabled = false; | |
| 56 RefPtr<Node> result0; | |
| 57 bool result1Enabled = false; | |
| 58 RefPtr<NodeList> result1; | |
| 59 impl->getItem(name, result0Enabled, result0, result1Enabled, result1); | |
| 60 if (result0Enabled) { | |
| 61 v8SetReturnValue(info, result0.release()); | |
| 62 return; | |
| 63 } | |
| 64 if (result1Enabled) { | |
| 65 v8SetReturnValue(info, result1.release()); | |
| 66 return; | |
| 67 } | |
| 68 v8SetReturnValueNull(info); | |
| 69 } | |
| 70 | |
| 71 static void namedItemMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& i
nfo) | |
| 72 { | |
| 73 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); | |
| 74 TestSpecialOperationsV8Internal::namedItemMethod(info); | |
| 75 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | |
| 76 } | |
| 77 | |
| 78 static void namedPropertyGetter(v8::Local<v8::String> name, const v8::PropertyCa
llbackInfo<v8::Value>& info) | 45 static void namedPropertyGetter(v8::Local<v8::String> name, const v8::PropertyCa
llbackInfo<v8::Value>& info) |
| 79 { | 46 { |
| 80 TestSpecialOperations* impl = V8TestSpecialOperations::toNative(info.Holder(
)); | 47 TestSpecialOperationsOverrideBuiltins* impl = V8TestSpecialOperationsOverrid
eBuiltins::toNative(info.Holder()); |
| 81 AtomicString propertyName = toCoreAtomicString(name); | 48 AtomicString propertyName = toCoreAtomicString(name); |
| 82 bool result0Enabled = false; | 49 String result = impl->anonymousNamedGetter(propertyName); |
| 83 RefPtr<Node> result0; | 50 if (result.isNull()) |
| 84 bool result1Enabled = false; | |
| 85 RefPtr<NodeList> result1; | |
| 86 impl->getItem(propertyName, result0Enabled, result0, result1Enabled, result1
); | |
| 87 if (!result0Enabled && !result1Enabled) | |
| 88 return; | 51 return; |
| 89 if (result0Enabled) { | 52 v8SetReturnValueString(info, result, info.GetIsolate()); |
| 90 v8SetReturnValueFast(info, WTF::getPtr(result0.release()), impl); | |
| 91 return; | |
| 92 } | |
| 93 if (result1Enabled) { | |
| 94 v8SetReturnValueFast(info, WTF::getPtr(result1.release()), impl); | |
| 95 return; | |
| 96 } | |
| 97 v8SetReturnValueNull(info); | |
| 98 } | 53 } |
| 99 | 54 |
| 100 static void namedPropertyGetterCallback(v8::Local<v8::String> name, const v8::Pr
opertyCallbackInfo<v8::Value>& info) | 55 static void namedPropertyGetterCallback(v8::Local<v8::String> name, const v8::Pr
opertyCallbackInfo<v8::Value>& info) |
| 101 { | 56 { |
| 102 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); | 57 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); |
| 103 TestSpecialOperationsV8Internal::namedPropertyGetter(name, info); | 58 TestSpecialOperationsOverrideBuiltinsV8Internal::namedPropertyGetter(name, i
nfo); |
| 104 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 59 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
| 105 } | 60 } |
| 106 | 61 |
| 107 static void namedPropertySetter(v8::Local<v8::String> name, v8::Local<v8::Value>
v8Value, const v8::PropertyCallbackInfo<v8::Value>& info) | 62 static void namedPropertySetter(v8::Local<v8::String> name, v8::Local<v8::Value>
v8Value, const v8::PropertyCallbackInfo<v8::Value>& info) |
| 108 { | 63 { |
| 109 TestSpecialOperations* impl = V8TestSpecialOperations::toNative(info.Holder(
)); | 64 TestSpecialOperationsOverrideBuiltins* impl = V8TestSpecialOperationsOverrid
eBuiltins::toNative(info.Holder()); |
| 110 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, propertyName, name)
; | 65 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, propertyName, name)
; |
| 111 V8TRYCATCH_VOID(Node*, propertyValue, V8Node::toNativeWithTypeCheck(info.Get
Isolate(), v8Value)); | 66 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, propertyValue, v8Va
lue); |
| 112 bool result = impl->anonymousNamedSetter(propertyName, propertyValue); | 67 bool result = impl->anonymousNamedSetter(propertyName, propertyValue); |
| 113 if (!result) | 68 if (!result) |
| 114 return; | 69 return; |
| 115 v8SetReturnValue(info, v8Value); | 70 v8SetReturnValue(info, v8Value); |
| 116 } | 71 } |
| 117 | 72 |
| 118 static void namedPropertySetterCallback(v8::Local<v8::String> name, v8::Local<v8
::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info) | 73 static void namedPropertySetterCallback(v8::Local<v8::String> name, v8::Local<v8
::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info) |
| 119 { | 74 { |
| 120 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); | 75 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); |
| 121 TestSpecialOperationsV8Internal::namedPropertySetter(name, v8Value, info); | 76 TestSpecialOperationsOverrideBuiltinsV8Internal::namedPropertySetter(name, v
8Value, info); |
| 122 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 77 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
| 123 } | 78 } |
| 124 | 79 |
| 125 static void namedPropertyQuery(v8::Local<v8::String> name, const v8::PropertyCal
lbackInfo<v8::Integer>& info) | 80 static void namedPropertyQuery(v8::Local<v8::String> name, const v8::PropertyCal
lbackInfo<v8::Integer>& info) |
| 126 { | 81 { |
| 127 TestSpecialOperations* impl = V8TestSpecialOperations::toNative(info.Holder(
)); | 82 TestSpecialOperationsOverrideBuiltins* impl = V8TestSpecialOperationsOverrid
eBuiltins::toNative(info.Holder()); |
| 128 AtomicString propertyName = toCoreAtomicString(name); | 83 AtomicString propertyName = toCoreAtomicString(name); |
| 129 v8::String::Utf8Value namedProperty(name); | 84 v8::String::Utf8Value namedProperty(name); |
| 130 ExceptionState exceptionState(ExceptionState::GetterContext, *namedProperty,
"TestSpecialOperations", info.Holder(), info.GetIsolate()); | 85 ExceptionState exceptionState(ExceptionState::GetterContext, *namedProperty,
"TestSpecialOperationsOverrideBuiltins", info.Holder(), info.GetIsolate()); |
| 131 bool result = impl->namedPropertyQuery(propertyName, exceptionState); | 86 bool result = impl->namedPropertyQuery(propertyName, exceptionState); |
| 132 if (exceptionState.throwIfNeeded()) | 87 if (exceptionState.throwIfNeeded()) |
| 133 return; | 88 return; |
| 134 if (!result) | 89 if (!result) |
| 135 return; | 90 return; |
| 136 v8SetReturnValueInt(info, v8::None); | 91 v8SetReturnValueInt(info, v8::None); |
| 137 } | 92 } |
| 138 | 93 |
| 139 static void namedPropertyQueryCallback(v8::Local<v8::String> name, const v8::Pro
pertyCallbackInfo<v8::Integer>& info) | 94 static void namedPropertyQueryCallback(v8::Local<v8::String> name, const v8::Pro
pertyCallbackInfo<v8::Integer>& info) |
| 140 { | 95 { |
| 141 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); | 96 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); |
| 142 TestSpecialOperationsV8Internal::namedPropertyQuery(name, info); | 97 TestSpecialOperationsOverrideBuiltinsV8Internal::namedPropertyQuery(name, in
fo); |
| 143 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 98 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
| 144 } | 99 } |
| 145 | 100 |
| 146 static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& i
nfo) | 101 static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& i
nfo) |
| 147 { | 102 { |
| 148 TestSpecialOperations* impl = V8TestSpecialOperations::toNative(info.Holder(
)); | 103 TestSpecialOperationsOverrideBuiltins* impl = V8TestSpecialOperationsOverrid
eBuiltins::toNative(info.Holder()); |
| 149 v8::Isolate* isolate = info.GetIsolate(); | 104 v8::Isolate* isolate = info.GetIsolate(); |
| 150 Vector<String> names; | 105 Vector<String> names; |
| 151 ExceptionState exceptionState(ExceptionState::EnumerationContext, "TestSpeci
alOperations", info.Holder(), isolate); | 106 ExceptionState exceptionState(ExceptionState::EnumerationContext, "TestSpeci
alOperationsOverrideBuiltins", info.Holder(), isolate); |
| 152 impl->namedPropertyEnumerator(names, exceptionState); | 107 impl->namedPropertyEnumerator(names, exceptionState); |
| 153 if (exceptionState.throwIfNeeded()) | 108 if (exceptionState.throwIfNeeded()) |
| 154 return; | 109 return; |
| 155 v8::Handle<v8::Array> v8names = v8::Array::New(isolate, names.size()); | 110 v8::Handle<v8::Array> v8names = v8::Array::New(isolate, names.size()); |
| 156 for (size_t i = 0; i < names.size(); ++i) | 111 for (size_t i = 0; i < names.size(); ++i) |
| 157 v8names->Set(v8::Integer::New(isolate, i), v8String(isolate, names[i])); | 112 v8names->Set(v8::Integer::New(isolate, i), v8String(isolate, names[i])); |
| 158 v8SetReturnValue(info, v8names); | 113 v8SetReturnValue(info, v8names); |
| 159 } | 114 } |
| 160 | 115 |
| 161 static void namedPropertyEnumeratorCallback(const v8::PropertyCallbackInfo<v8::A
rray>& info) | 116 static void namedPropertyEnumeratorCallback(const v8::PropertyCallbackInfo<v8::A
rray>& info) |
| 162 { | 117 { |
| 163 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); | 118 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); |
| 164 TestSpecialOperationsV8Internal::namedPropertyEnumerator(info); | 119 TestSpecialOperationsOverrideBuiltinsV8Internal::namedPropertyEnumerator(inf
o); |
| 165 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 120 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
| 166 } | 121 } |
| 167 | 122 |
| 168 } // namespace TestSpecialOperationsV8Internal | 123 } // namespace TestSpecialOperationsOverrideBuiltinsV8Internal |
| 169 | 124 |
| 170 static const V8DOMConfiguration::MethodConfiguration V8TestSpecialOperationsMeth
ods[] = { | 125 static void configureV8TestSpecialOperationsOverrideBuiltinsTemplate(v8::Handle<
v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate) |
| 171 {"namedItem", TestSpecialOperationsV8Internal::namedItemMethodCallback, 0, 1
}, | |
| 172 }; | |
| 173 | |
| 174 static void configureV8TestSpecialOperationsTemplate(v8::Handle<v8::FunctionTemp
late> functionTemplate, v8::Isolate* isolate) | |
| 175 { | 126 { |
| 176 functionTemplate->ReadOnlyPrototype(); | 127 functionTemplate->ReadOnlyPrototype(); |
| 177 | 128 |
| 178 v8::Local<v8::Signature> defaultSignature; | 129 v8::Local<v8::Signature> defaultSignature; |
| 179 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestSpecialOperations", v8::Local<v8::FunctionTemplate>(), V8TestSpecialOp
erations::internalFieldCount, | 130 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestSpecialOperationsOverrideBuiltins", v8::Local<v8::FunctionTemplate>(),
V8TestSpecialOperationsOverrideBuiltins::internalFieldCount, |
| 180 0, 0, | 131 0, 0, |
| 181 0, 0, | 132 0, 0, |
| 182 V8TestSpecialOperationsMethods, WTF_ARRAY_LENGTH(V8TestSpecialOperations
Methods), | 133 0, 0, |
| 183 isolate); | 134 isolate); |
| 184 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla
te->InstanceTemplate(); | 135 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla
te->InstanceTemplate(); |
| 185 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTempl
ate->PrototypeTemplate(); | 136 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTempl
ate->PrototypeTemplate(); |
| 186 functionTemplate->InstanceTemplate()->SetNamedPropertyHandler(TestSpecialOpe
rationsV8Internal::namedPropertyGetterCallback, TestSpecialOperationsV8Internal:
:namedPropertySetterCallback, TestSpecialOperationsV8Internal::namedPropertyQuer
yCallback, 0, TestSpecialOperationsV8Internal::namedPropertyEnumeratorCallback); | 137 functionTemplate->InstanceTemplate()->SetNamedPropertyHandler(TestSpecialOpe
rationsOverrideBuiltinsV8Internal::namedPropertyGetterCallback, TestSpecialOpera
tionsOverrideBuiltinsV8Internal::namedPropertySetterCallback, TestSpecialOperati
onsOverrideBuiltinsV8Internal::namedPropertyQueryCallback, 0, TestSpecialOperati
onsOverrideBuiltinsV8Internal::namedPropertyEnumeratorCallback); |
| 187 | 138 |
| 188 // Custom toString template | 139 // Custom toString template |
| 189 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData:
:current()->toStringTemplate()); | 140 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData:
:current()->toStringTemplate()); |
| 190 } | 141 } |
| 191 | 142 |
| 192 v8::Handle<v8::FunctionTemplate> V8TestSpecialOperations::domTemplate(v8::Isolat
e* isolate) | 143 v8::Handle<v8::FunctionTemplate> V8TestSpecialOperationsOverrideBuiltins::domTem
plate(v8::Isolate* isolate) |
| 193 { | 144 { |
| 194 V8PerIsolateData* data = V8PerIsolateData::from(isolate); | 145 V8PerIsolateData* data = V8PerIsolateData::from(isolate); |
| 195 v8::Local<v8::FunctionTemplate> result = data->existingDOMTemplate(const_cas
t<WrapperTypeInfo*>(&wrapperTypeInfo)); | 146 v8::Local<v8::FunctionTemplate> result = data->existingDOMTemplate(const_cas
t<WrapperTypeInfo*>(&wrapperTypeInfo)); |
| 196 if (!result.IsEmpty()) | 147 if (!result.IsEmpty()) |
| 197 return result; | 148 return result; |
| 198 | 149 |
| 199 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); | 150 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); |
| 200 result = v8::FunctionTemplate::New(isolate, V8ObjectConstructor::isValidCons
tructorMode); | 151 result = v8::FunctionTemplate::New(isolate, V8ObjectConstructor::isValidCons
tructorMode); |
| 201 configureV8TestSpecialOperationsTemplate(result, isolate); | 152 configureV8TestSpecialOperationsOverrideBuiltinsTemplate(result, isolate); |
| 202 data->setDOMTemplate(const_cast<WrapperTypeInfo*>(&wrapperTypeInfo), result)
; | 153 data->setDOMTemplate(const_cast<WrapperTypeInfo*>(&wrapperTypeInfo), result)
; |
| 203 return result; | 154 return result; |
| 204 } | 155 } |
| 205 | 156 |
| 206 bool V8TestSpecialOperations::hasInstance(v8::Handle<v8::Value> v8Value, v8::Iso
late* isolate) | 157 bool V8TestSpecialOperationsOverrideBuiltins::hasInstance(v8::Handle<v8::Value>
v8Value, v8::Isolate* isolate) |
| 207 { | 158 { |
| 208 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Valu
e); | 159 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Valu
e); |
| 209 } | 160 } |
| 210 | 161 |
| 211 v8::Handle<v8::Object> V8TestSpecialOperations::findInstanceInPrototypeChain(v8:
:Handle<v8::Value> v8Value, v8::Isolate* isolate) | 162 v8::Handle<v8::Object> V8TestSpecialOperationsOverrideBuiltins::findInstanceInPr
ototypeChain(v8::Handle<v8::Value> v8Value, v8::Isolate* isolate) |
| 212 { | 163 { |
| 213 return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrappe
rTypeInfo, v8Value); | 164 return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrappe
rTypeInfo, v8Value); |
| 214 } | 165 } |
| 215 | 166 |
| 216 TestSpecialOperations* V8TestSpecialOperations::toNativeWithTypeCheck(v8::Isolat
e* isolate, v8::Handle<v8::Value> value) | 167 TestSpecialOperationsOverrideBuiltins* V8TestSpecialOperationsOverrideBuiltins::
toNativeWithTypeCheck(v8::Isolate* isolate, v8::Handle<v8::Value> value) |
| 217 { | 168 { |
| 218 return hasInstance(value, isolate) ? fromInternalPointer(v8::Handle<v8::Obje
ct>::Cast(value)->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex)) :
0; | 169 return hasInstance(value, isolate) ? fromInternalPointer(v8::Handle<v8::Obje
ct>::Cast(value)->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex)) :
0; |
| 219 } | 170 } |
| 220 | 171 |
| 221 v8::Handle<v8::Object> V8TestSpecialOperations::createWrapper(PassRefPtr<TestSpe
cialOperations> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isola
te) | 172 v8::Handle<v8::Object> V8TestSpecialOperationsOverrideBuiltins::createWrapper(Pa
ssRefPtr<TestSpecialOperationsOverrideBuiltins> impl, v8::Handle<v8::Object> cre
ationContext, v8::Isolate* isolate) |
| 222 { | 173 { |
| 223 ASSERT(impl); | 174 ASSERT(impl); |
| 224 ASSERT(!DOMDataStore::containsWrapper<V8TestSpecialOperations>(impl.get(), i
solate)); | 175 ASSERT(!DOMDataStore::containsWrapper<V8TestSpecialOperationsOverrideBuiltin
s>(impl.get(), isolate)); |
| 225 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { | 176 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { |
| 226 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje
ct(impl.get()); | 177 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje
ct(impl.get()); |
| 227 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper
TypeInfo. These will both have | 178 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper
TypeInfo. These will both have |
| 228 // the same object de-ref functions, though, so use that as the basis of
the check. | 179 // the same object de-ref functions, though, so use that as the basis of
the check. |
| 229 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction
== wrapperTypeInfo.derefObjectFunction); | 180 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction
== wrapperTypeInfo.derefObjectFunction); |
| 230 } | 181 } |
| 231 | 182 |
| 232 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext
, &wrapperTypeInfo, toInternalPointer(impl.get()), isolate); | 183 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext
, &wrapperTypeInfo, toInternalPointer(impl.get()), isolate); |
| 233 if (UNLIKELY(wrapper.IsEmpty())) | 184 if (UNLIKELY(wrapper.IsEmpty())) |
| 234 return wrapper; | 185 return wrapper; |
| 235 | 186 |
| 236 installPerContextEnabledProperties(wrapper, impl.get(), isolate); | 187 installPerContextEnabledProperties(wrapper, impl.get(), isolate); |
| 237 V8DOMWrapper::associateObjectWithWrapper<V8TestSpecialOperations>(impl, &wra
pperTypeInfo, wrapper, isolate, WrapperConfiguration::Independent); | 188 V8DOMWrapper::associateObjectWithWrapper<V8TestSpecialOperationsOverrideBuil
tins>(impl, &wrapperTypeInfo, wrapper, isolate, WrapperConfiguration::Independen
t); |
| 238 return wrapper; | 189 return wrapper; |
| 239 } | 190 } |
| 240 | 191 |
| 241 void V8TestSpecialOperations::derefObject(void* object) | 192 void V8TestSpecialOperationsOverrideBuiltins::derefObject(void* object) |
| 242 { | 193 { |
| 243 fromInternalPointer(object)->deref(); | 194 fromInternalPointer(object)->deref(); |
| 244 } | 195 } |
| 245 | 196 |
| 246 template<> | 197 template<> |
| 247 v8::Handle<v8::Value> toV8NoInline(TestSpecialOperations* impl, v8::Handle<v8::O
bject> creationContext, v8::Isolate* isolate) | 198 v8::Handle<v8::Value> toV8NoInline(TestSpecialOperationsOverrideBuiltins* impl,
v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) |
| 248 { | 199 { |
| 249 return toV8(impl, creationContext, isolate); | 200 return toV8(impl, creationContext, isolate); |
| 250 } | 201 } |
| 251 | 202 |
| 252 } // namespace WebCore | 203 } // namespace WebCore |
| OLD | NEW |