| 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 "V8TestSpecialOperationsInt.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(TestSpecialOperationsInt* obje
ct) |
| 26 { | 24 { |
| 27 if (ScriptWrappable::wrapperCanBeStoredInObject(object)) | 25 if (ScriptWrappable::wrapperCanBeStoredInObject(object)) |
| 28 ScriptWrappable::setTypeInfoInObject(object, &V8TestSpecialOperations::w
rapperTypeInfo); | 26 ScriptWrappable::setTypeInfoInObject(object, &V8TestSpecialOperationsInt
::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
Int* 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 V8TestSpecialOperationsInt::wrapperTypeInfo = { gin::kEmbe
dderBlink, V8TestSpecialOperationsInt::domTemplate, V8TestSpecialOperationsInt::
derefObject, 0, 0, 0, V8TestSpecialOperationsInt::installPerContextEnabledMethod
s, 0, WrapperTypeObjectPrototype, false }; |
| 42 | 40 |
| 43 namespace TestSpecialOperationsV8Internal { | 41 namespace TestSpecialOperationsIntV8Internal { |
| 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) | 45 static void indexedPropertyGetter(uint32_t index, const v8::PropertyCallbackInfo
<v8::Value>& info) |
| 48 { | 46 { |
| 49 if (UNLIKELY(info.Length() < 1)) { | 47 TestSpecialOperationsInt* impl = V8TestSpecialOperationsInt::toNative(info.H
older()); |
| 50 throwTypeError(ExceptionMessages::failedToExecute("namedItem", "TestSpec
ialOperations", ExceptionMessages::notEnoughArguments(1, info.Length())), info.G
etIsolate()); | 48 int result = impl->anonymousIndexedGetter(index); |
| 49 if () |
| 51 return; | 50 return; |
| 52 } | 51 v8SetReturnValueInt(info, result); |
| 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 } | 52 } |
| 70 | 53 |
| 71 static void namedItemMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& i
nfo) | 54 static void indexedPropertyGetterCallback(uint32_t index, const v8::PropertyCall
backInfo<v8::Value>& info) |
| 72 { | 55 { |
| 73 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); | 56 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMIndexedProperty"); |
| 74 TestSpecialOperationsV8Internal::namedItemMethod(info); | 57 TestSpecialOperationsIntV8Internal::indexedPropertyGetter(index, info); |
| 58 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
| 59 } |
| 60 |
| 61 static void indexedPropertySetter(uint32_t index, v8::Local<v8::Value> v8Value,
const v8::PropertyCallbackInfo<v8::Value>& info) |
| 62 { |
| 63 TestSpecialOperationsInt* impl = V8TestSpecialOperationsInt::toNative(info.H
older()); |
| 64 V8TRYCATCH_EXCEPTION_VOID(unsigned, propertyValue, toUInt32(v8Value, excepti
onState), exceptionState); |
| 65 ExceptionState exceptionState(ExceptionState::IndexedSetterContext, "TestSpe
cialOperationsInt", info.Holder(), info.GetIsolate()); |
| 66 bool result = impl->anonymousIndexedSetter(index, propertyValue); |
| 67 if (!result) |
| 68 return; |
| 69 v8SetReturnValue(info, v8Value); |
| 70 } |
| 71 |
| 72 static void indexedPropertySetterCallback(uint32_t index, v8::Local<v8::Value> v
8Value, const v8::PropertyCallbackInfo<v8::Value>& info) |
| 73 { |
| 74 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMIndexedProperty"); |
| 75 TestSpecialOperationsIntV8Internal::indexedPropertySetter(index, v8Value, in
fo); |
| 75 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 76 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
| 76 } | 77 } |
| 77 | 78 |
| 78 static void namedPropertyGetter(v8::Local<v8::String> name, const v8::PropertyCa
llbackInfo<v8::Value>& info) | 79 static void namedPropertyGetter(v8::Local<v8::String> name, const v8::PropertyCa
llbackInfo<v8::Value>& info) |
| 79 { | 80 { |
| 80 TestSpecialOperations* impl = V8TestSpecialOperations::toNative(info.Holder(
)); | 81 if (info.Holder()->HasRealNamedProperty(name)) |
| 82 return; |
| 83 if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty()) |
| 84 return; |
| 85 |
| 86 TestSpecialOperationsInt* impl = V8TestSpecialOperationsInt::toNative(info.H
older()); |
| 81 AtomicString propertyName = toCoreAtomicString(name); | 87 AtomicString propertyName = toCoreAtomicString(name); |
| 82 bool result0Enabled = false; | 88 int result = impl->anonymousNamedGetter(propertyName); |
| 83 RefPtr<Node> result0; | 89 if () |
| 84 bool result1Enabled = false; | |
| 85 RefPtr<NodeList> result1; | |
| 86 impl->getItem(propertyName, result0Enabled, result0, result1Enabled, result1
); | |
| 87 if (!result0Enabled && !result1Enabled) | |
| 88 return; | 90 return; |
| 89 if (result0Enabled) { | 91 v8SetReturnValueInt(info, result); |
| 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 } | 92 } |
| 99 | 93 |
| 100 static void namedPropertyGetterCallback(v8::Local<v8::String> name, const v8::Pr
opertyCallbackInfo<v8::Value>& info) | 94 static void namedPropertyGetterCallback(v8::Local<v8::String> name, const v8::Pr
opertyCallbackInfo<v8::Value>& info) |
| 101 { | 95 { |
| 102 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); | 96 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); |
| 103 TestSpecialOperationsV8Internal::namedPropertyGetter(name, info); | 97 TestSpecialOperationsIntV8Internal::namedPropertyGetter(name, info); |
| 104 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 98 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
| 105 } | 99 } |
| 106 | 100 |
| 107 static void namedPropertySetter(v8::Local<v8::String> name, v8::Local<v8::Value>
v8Value, const v8::PropertyCallbackInfo<v8::Value>& info) | 101 static void namedPropertySetter(v8::Local<v8::String> name, v8::Local<v8::Value>
v8Value, const v8::PropertyCallbackInfo<v8::Value>& info) |
| 108 { | 102 { |
| 109 TestSpecialOperations* impl = V8TestSpecialOperations::toNative(info.Holder(
)); | 103 if (info.Holder()->HasRealNamedProperty(name)) |
| 104 return; |
| 105 if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty()) |
| 106 return; |
| 107 |
| 108 TestSpecialOperationsInt* impl = V8TestSpecialOperationsInt::toNative(info.H
older()); |
| 110 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, propertyName, name)
; | 109 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, propertyName, name)
; |
| 111 V8TRYCATCH_VOID(Node*, propertyValue, V8Node::toNativeWithTypeCheck(info.Get
Isolate(), v8Value)); | 110 V8TRYCATCH_EXCEPTION_VOID(unsigned, propertyValue, toUInt32(v8Value, excepti
onState), exceptionState); |
| 111 v8::String::Utf8Value namedProperty(name); |
| 112 ExceptionState exceptionState(ExceptionState::SetterContext, *namedProperty,
"TestSpecialOperationsInt", info.Holder(), info.GetIsolate()); |
| 112 bool result = impl->anonymousNamedSetter(propertyName, propertyValue); | 113 bool result = impl->anonymousNamedSetter(propertyName, propertyValue); |
| 113 if (!result) | 114 if (!result) |
| 114 return; | 115 return; |
| 115 v8SetReturnValue(info, v8Value); | 116 v8SetReturnValue(info, v8Value); |
| 116 } | 117 } |
| 117 | 118 |
| 118 static void namedPropertySetterCallback(v8::Local<v8::String> name, v8::Local<v8
::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info) | 119 static void namedPropertySetterCallback(v8::Local<v8::String> name, v8::Local<v8
::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info) |
| 119 { | 120 { |
| 120 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); | 121 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); |
| 121 TestSpecialOperationsV8Internal::namedPropertySetter(name, v8Value, info); | 122 TestSpecialOperationsIntV8Internal::namedPropertySetter(name, v8Value, info)
; |
| 122 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 123 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
| 123 } | 124 } |
| 124 | 125 |
| 125 static void namedPropertyQuery(v8::Local<v8::String> name, const v8::PropertyCal
lbackInfo<v8::Integer>& info) | 126 static void namedPropertyQuery(v8::Local<v8::String> name, const v8::PropertyCal
lbackInfo<v8::Integer>& info) |
| 126 { | 127 { |
| 127 TestSpecialOperations* impl = V8TestSpecialOperations::toNative(info.Holder(
)); | 128 TestSpecialOperationsInt* impl = V8TestSpecialOperationsInt::toNative(info.H
older()); |
| 128 AtomicString propertyName = toCoreAtomicString(name); | 129 AtomicString propertyName = toCoreAtomicString(name); |
| 129 v8::String::Utf8Value namedProperty(name); | 130 v8::String::Utf8Value namedProperty(name); |
| 130 ExceptionState exceptionState(ExceptionState::GetterContext, *namedProperty,
"TestSpecialOperations", info.Holder(), info.GetIsolate()); | 131 ExceptionState exceptionState(ExceptionState::GetterContext, *namedProperty,
"TestSpecialOperationsInt", info.Holder(), info.GetIsolate()); |
| 131 bool result = impl->namedPropertyQuery(propertyName, exceptionState); | 132 bool result = impl->namedPropertyQuery(propertyName, exceptionState); |
| 132 if (exceptionState.throwIfNeeded()) | 133 if (exceptionState.throwIfNeeded()) |
| 133 return; | 134 return; |
| 134 if (!result) | 135 if (!result) |
| 135 return; | 136 return; |
| 136 v8SetReturnValueInt(info, v8::None); | 137 v8SetReturnValueInt(info, v8::None); |
| 137 } | 138 } |
| 138 | 139 |
| 139 static void namedPropertyQueryCallback(v8::Local<v8::String> name, const v8::Pro
pertyCallbackInfo<v8::Integer>& info) | 140 static void namedPropertyQueryCallback(v8::Local<v8::String> name, const v8::Pro
pertyCallbackInfo<v8::Integer>& info) |
| 140 { | 141 { |
| 141 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); | 142 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); |
| 142 TestSpecialOperationsV8Internal::namedPropertyQuery(name, info); | 143 TestSpecialOperationsIntV8Internal::namedPropertyQuery(name, info); |
| 143 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 144 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
| 144 } | 145 } |
| 145 | 146 |
| 146 static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& i
nfo) | 147 static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& i
nfo) |
| 147 { | 148 { |
| 148 TestSpecialOperations* impl = V8TestSpecialOperations::toNative(info.Holder(
)); | 149 TestSpecialOperationsInt* impl = V8TestSpecialOperationsInt::toNative(info.H
older()); |
| 149 v8::Isolate* isolate = info.GetIsolate(); | 150 v8::Isolate* isolate = info.GetIsolate(); |
| 150 Vector<String> names; | 151 Vector<String> names; |
| 151 ExceptionState exceptionState(ExceptionState::EnumerationContext, "TestSpeci
alOperations", info.Holder(), isolate); | 152 ExceptionState exceptionState(ExceptionState::EnumerationContext, "TestSpeci
alOperationsInt", info.Holder(), isolate); |
| 152 impl->namedPropertyEnumerator(names, exceptionState); | 153 impl->namedPropertyEnumerator(names, exceptionState); |
| 153 if (exceptionState.throwIfNeeded()) | 154 if (exceptionState.throwIfNeeded()) |
| 154 return; | 155 return; |
| 155 v8::Handle<v8::Array> v8names = v8::Array::New(isolate, names.size()); | 156 v8::Handle<v8::Array> v8names = v8::Array::New(isolate, names.size()); |
| 156 for (size_t i = 0; i < names.size(); ++i) | 157 for (size_t i = 0; i < names.size(); ++i) |
| 157 v8names->Set(v8::Integer::New(isolate, i), v8String(isolate, names[i])); | 158 v8names->Set(v8::Integer::New(isolate, i), v8String(isolate, names[i])); |
| 158 v8SetReturnValue(info, v8names); | 159 v8SetReturnValue(info, v8names); |
| 159 } | 160 } |
| 160 | 161 |
| 161 static void namedPropertyEnumeratorCallback(const v8::PropertyCallbackInfo<v8::A
rray>& info) | 162 static void namedPropertyEnumeratorCallback(const v8::PropertyCallbackInfo<v8::A
rray>& info) |
| 162 { | 163 { |
| 163 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); | 164 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); |
| 164 TestSpecialOperationsV8Internal::namedPropertyEnumerator(info); | 165 TestSpecialOperationsIntV8Internal::namedPropertyEnumerator(info); |
| 165 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 166 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
| 166 } | 167 } |
| 167 | 168 |
| 168 } // namespace TestSpecialOperationsV8Internal | 169 } // namespace TestSpecialOperationsIntV8Internal |
| 169 | 170 |
| 170 static const V8DOMConfiguration::MethodConfiguration V8TestSpecialOperationsMeth
ods[] = { | 171 static void configureV8TestSpecialOperationsIntTemplate(v8::Handle<v8::FunctionT
emplate> 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 { | 172 { |
| 176 functionTemplate->ReadOnlyPrototype(); | 173 functionTemplate->ReadOnlyPrototype(); |
| 177 | 174 |
| 178 v8::Local<v8::Signature> defaultSignature; | 175 v8::Local<v8::Signature> defaultSignature; |
| 179 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestSpecialOperations", v8::Local<v8::FunctionTemplate>(), V8TestSpecialOp
erations::internalFieldCount, | 176 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestSpecialOperationsInt", v8::Local<v8::FunctionTemplate>(), V8TestSpecia
lOperationsInt::internalFieldCount, |
| 180 0, 0, | 177 0, 0, |
| 181 0, 0, | 178 0, 0, |
| 182 V8TestSpecialOperationsMethods, WTF_ARRAY_LENGTH(V8TestSpecialOperations
Methods), | 179 0, 0, |
| 183 isolate); | 180 isolate); |
| 184 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla
te->InstanceTemplate(); | 181 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla
te->InstanceTemplate(); |
| 185 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTempl
ate->PrototypeTemplate(); | 182 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); | 183 functionTemplate->InstanceTemplate()->SetIndexedPropertyHandler(TestSpecialO
perationsIntV8Internal::indexedPropertyGetterCallback, TestSpecialOperationsIntV
8Internal::indexedPropertySetterCallback, 0, 0, indexedPropertyEnumerator<TestSp
ecialOperationsInt>); |
| 184 functionTemplate->InstanceTemplate()->SetNamedPropertyHandler(TestSpecialOpe
rationsIntV8Internal::namedPropertyGetterCallback, TestSpecialOperationsIntV8Int
ernal::namedPropertySetterCallback, TestSpecialOperationsIntV8Internal::namedPro
pertyQueryCallback, 0, TestSpecialOperationsIntV8Internal::namedPropertyEnumerat
orCallback); |
| 187 | 185 |
| 188 // Custom toString template | 186 // Custom toString template |
| 189 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData:
:current()->toStringTemplate()); | 187 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData:
:current()->toStringTemplate()); |
| 190 } | 188 } |
| 191 | 189 |
| 192 v8::Handle<v8::FunctionTemplate> V8TestSpecialOperations::domTemplate(v8::Isolat
e* isolate) | 190 v8::Handle<v8::FunctionTemplate> V8TestSpecialOperationsInt::domTemplate(v8::Iso
late* isolate) |
| 193 { | 191 { |
| 194 V8PerIsolateData* data = V8PerIsolateData::from(isolate); | 192 V8PerIsolateData* data = V8PerIsolateData::from(isolate); |
| 195 v8::Local<v8::FunctionTemplate> result = data->existingDOMTemplate(const_cas
t<WrapperTypeInfo*>(&wrapperTypeInfo)); | 193 v8::Local<v8::FunctionTemplate> result = data->existingDOMTemplate(const_cas
t<WrapperTypeInfo*>(&wrapperTypeInfo)); |
| 196 if (!result.IsEmpty()) | 194 if (!result.IsEmpty()) |
| 197 return result; | 195 return result; |
| 198 | 196 |
| 199 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); | 197 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); |
| 200 result = v8::FunctionTemplate::New(isolate, V8ObjectConstructor::isValidCons
tructorMode); | 198 result = v8::FunctionTemplate::New(isolate, V8ObjectConstructor::isValidCons
tructorMode); |
| 201 configureV8TestSpecialOperationsTemplate(result, isolate); | 199 configureV8TestSpecialOperationsIntTemplate(result, isolate); |
| 202 data->setDOMTemplate(const_cast<WrapperTypeInfo*>(&wrapperTypeInfo), result)
; | 200 data->setDOMTemplate(const_cast<WrapperTypeInfo*>(&wrapperTypeInfo), result)
; |
| 203 return result; | 201 return result; |
| 204 } | 202 } |
| 205 | 203 |
| 206 bool V8TestSpecialOperations::hasInstance(v8::Handle<v8::Value> v8Value, v8::Iso
late* isolate) | 204 bool V8TestSpecialOperationsInt::hasInstance(v8::Handle<v8::Value> v8Value, v8::
Isolate* isolate) |
| 207 { | 205 { |
| 208 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Valu
e); | 206 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Valu
e); |
| 209 } | 207 } |
| 210 | 208 |
| 211 v8::Handle<v8::Object> V8TestSpecialOperations::findInstanceInPrototypeChain(v8:
:Handle<v8::Value> v8Value, v8::Isolate* isolate) | 209 v8::Handle<v8::Object> V8TestSpecialOperationsInt::findInstanceInPrototypeChain(
v8::Handle<v8::Value> v8Value, v8::Isolate* isolate) |
| 212 { | 210 { |
| 213 return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrappe
rTypeInfo, v8Value); | 211 return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrappe
rTypeInfo, v8Value); |
| 214 } | 212 } |
| 215 | 213 |
| 216 TestSpecialOperations* V8TestSpecialOperations::toNativeWithTypeCheck(v8::Isolat
e* isolate, v8::Handle<v8::Value> value) | 214 TestSpecialOperationsInt* V8TestSpecialOperationsInt::toNativeWithTypeCheck(v8::
Isolate* isolate, v8::Handle<v8::Value> value) |
| 217 { | 215 { |
| 218 return hasInstance(value, isolate) ? fromInternalPointer(v8::Handle<v8::Obje
ct>::Cast(value)->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex)) :
0; | 216 return hasInstance(value, isolate) ? fromInternalPointer(v8::Handle<v8::Obje
ct>::Cast(value)->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex)) :
0; |
| 219 } | 217 } |
| 220 | 218 |
| 221 v8::Handle<v8::Object> V8TestSpecialOperations::createWrapper(PassRefPtr<TestSpe
cialOperations> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isola
te) | 219 v8::Handle<v8::Object> V8TestSpecialOperationsInt::createWrapper(PassRefPtr<Test
SpecialOperationsInt> impl, v8::Handle<v8::Object> creationContext, v8::Isolate*
isolate) |
| 222 { | 220 { |
| 223 ASSERT(impl); | 221 ASSERT(impl); |
| 224 ASSERT(!DOMDataStore::containsWrapper<V8TestSpecialOperations>(impl.get(), i
solate)); | 222 ASSERT(!DOMDataStore::containsWrapper<V8TestSpecialOperationsInt>(impl.get()
, isolate)); |
| 225 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { | 223 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { |
| 226 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje
ct(impl.get()); | 224 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje
ct(impl.get()); |
| 227 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper
TypeInfo. These will both have | 225 // 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. | 226 // 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); | 227 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction
== wrapperTypeInfo.derefObjectFunction); |
| 230 } | 228 } |
| 231 | 229 |
| 232 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext
, &wrapperTypeInfo, toInternalPointer(impl.get()), isolate); | 230 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext
, &wrapperTypeInfo, toInternalPointer(impl.get()), isolate); |
| 233 if (UNLIKELY(wrapper.IsEmpty())) | 231 if (UNLIKELY(wrapper.IsEmpty())) |
| 234 return wrapper; | 232 return wrapper; |
| 235 | 233 |
| 236 installPerContextEnabledProperties(wrapper, impl.get(), isolate); | 234 installPerContextEnabledProperties(wrapper, impl.get(), isolate); |
| 237 V8DOMWrapper::associateObjectWithWrapper<V8TestSpecialOperations>(impl, &wra
pperTypeInfo, wrapper, isolate, WrapperConfiguration::Independent); | 235 V8DOMWrapper::associateObjectWithWrapper<V8TestSpecialOperationsInt>(impl, &
wrapperTypeInfo, wrapper, isolate, WrapperConfiguration::Independent); |
| 238 return wrapper; | 236 return wrapper; |
| 239 } | 237 } |
| 240 | 238 |
| 241 void V8TestSpecialOperations::derefObject(void* object) | 239 void V8TestSpecialOperationsInt::derefObject(void* object) |
| 242 { | 240 { |
| 243 fromInternalPointer(object)->deref(); | 241 fromInternalPointer(object)->deref(); |
| 244 } | 242 } |
| 245 | 243 |
| 246 template<> | 244 template<> |
| 247 v8::Handle<v8::Value> toV8NoInline(TestSpecialOperations* impl, v8::Handle<v8::O
bject> creationContext, v8::Isolate* isolate) | 245 v8::Handle<v8::Value> toV8NoInline(TestSpecialOperationsInt* impl, v8::Handle<v8
::Object> creationContext, v8::Isolate* isolate) |
| 248 { | 246 { |
| 249 return toV8(impl, creationContext, isolate); | 247 return toV8(impl, creationContext, isolate); |
| 250 } | 248 } |
| 251 | 249 |
| 252 } // namespace WebCore | 250 } // namespace WebCore |
| OLD | NEW |