| 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 13 matching lines...) Expand all Loading... |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 // This file has been auto-generated by code_generator_v8.pm. DO NOT MODIFY! | 31 // This file has been auto-generated by code_generator_v8.pm. DO NOT MODIFY! |
| 32 | 32 |
| 33 #include "config.h" | 33 #include "config.h" |
| 34 #include "V8TestSpecialOperationsAnonymous.h" | 34 #include "V8TestSpecialOperationsInt.h" |
| 35 | 35 |
| 36 #include "RuntimeEnabledFeatures.h" | 36 #include "RuntimeEnabledFeatures.h" |
| 37 #include "bindings/v8/ExceptionState.h" | 37 #include "bindings/v8/ExceptionState.h" |
| 38 #include "bindings/v8/V8DOMConfiguration.h" | 38 #include "bindings/v8/V8DOMConfiguration.h" |
| 39 #include "bindings/v8/V8ObjectConstructor.h" | 39 #include "bindings/v8/V8ObjectConstructor.h" |
| 40 #include "core/dom/ContextFeatures.h" | 40 #include "core/dom/ContextFeatures.h" |
| 41 #include "core/dom/Document.h" | 41 #include "core/dom/Document.h" |
| 42 #include "platform/TraceEvent.h" | 42 #include "platform/TraceEvent.h" |
| 43 | 43 |
| 44 namespace WebCore { | 44 namespace WebCore { |
| 45 | 45 |
| 46 static void initializeScriptWrappableForInterface(TestSpecialOperationsAnonymous
* object) | 46 static void initializeScriptWrappableForInterface(TestSpecialOperationsInt* obje
ct) |
| 47 { | 47 { |
| 48 if (ScriptWrappable::wrapperCanBeStoredInObject(object)) | 48 if (ScriptWrappable::wrapperCanBeStoredInObject(object)) |
| 49 ScriptWrappable::setTypeInfoInObject(object, &V8TestSpecialOperationsAno
nymous::wrapperTypeInfo); | 49 ScriptWrappable::setTypeInfoInObject(object, &V8TestSpecialOperationsInt
::wrapperTypeInfo); |
| 50 else | 50 else |
| 51 ASSERT_NOT_REACHED(); | 51 ASSERT_NOT_REACHED(); |
| 52 } | 52 } |
| 53 | 53 |
| 54 } // namespace WebCore | 54 } // namespace WebCore |
| 55 | 55 |
| 56 // In ScriptWrappable::init, the use of a local function declaration has an issu
e on Windows: | 56 // In ScriptWrappable::init, the use of a local function declaration has an issu
e on Windows: |
| 57 // the local declaration does not pick up the surrounding namespace. Therefore,
we provide this function | 57 // the local declaration does not pick up the surrounding namespace. Therefore,
we provide this function |
| 58 // in the global namespace. | 58 // in the global namespace. |
| 59 // (More info on the MSVC bug here: http://connect.microsoft.com/VisualStudio/fe
edback/details/664619/the-namespace-of-local-function-declarations-in-c) | 59 // (More info on the MSVC bug here: http://connect.microsoft.com/VisualStudio/fe
edback/details/664619/the-namespace-of-local-function-declarations-in-c) |
| 60 void webCoreInitializeScriptWrappableForInterface(WebCore::TestSpecialOperations
Anonymous* object) | 60 void webCoreInitializeScriptWrappableForInterface(WebCore::TestSpecialOperations
Int* object) |
| 61 { | 61 { |
| 62 WebCore::initializeScriptWrappableForInterface(object); | 62 WebCore::initializeScriptWrappableForInterface(object); |
| 63 } | 63 } |
| 64 | 64 |
| 65 namespace WebCore { | 65 namespace WebCore { |
| 66 const WrapperTypeInfo V8TestSpecialOperationsAnonymous::wrapperTypeInfo = { gin:
:kEmbedderBlink, V8TestSpecialOperationsAnonymous::domTemplate, V8TestSpecialOpe
rationsAnonymous::derefObject, 0, 0, 0, V8TestSpecialOperationsAnonymous::instal
lPerContextEnabledMethods, 0, WrapperTypeObjectPrototype }; | 66 const WrapperTypeInfo V8TestSpecialOperationsInt::wrapperTypeInfo = { gin::kEmbe
dderBlink, V8TestSpecialOperationsInt::domTemplate, V8TestSpecialOperationsInt::
derefObject, 0, 0, 0, V8TestSpecialOperationsInt::installPerContextEnabledMethod
s, 0, WrapperTypeObjectPrototype }; |
| 67 | 67 |
| 68 namespace TestSpecialOperationsAnonymousV8Internal { | 68 namespace TestSpecialOperationsIntV8Internal { |
| 69 | 69 |
| 70 template <typename T> void V8_USE(T) { } | 70 template <typename T> void V8_USE(T) { } |
| 71 | 71 |
| 72 static void indexedPropertyGetter(uint32_t index, const v8::PropertyCallbackInfo
<v8::Value>& info) | 72 static void indexedPropertyGetter(uint32_t index, const v8::PropertyCallbackInfo
<v8::Value>& info) |
| 73 { | 73 { |
| 74 TestSpecialOperationsAnonymous* collection = V8TestSpecialOperationsAnonymou
s::toNative(info.Holder()); | 74 TestSpecialOperationsInt* collection = V8TestSpecialOperationsInt::toNative(
info.Holder()); |
| 75 String element = collection->anonymousIndexedGetter(index); | 75 int element = collection->anonymousIndexedGetter(index); |
| 76 if (element.isNull()) | 76 if () |
| 77 return; | 77 return; |
| 78 v8SetReturnValueString(info, element, info.GetIsolate()); | 78 v8SetReturnValueInt(info, element); |
| 79 } | 79 } |
| 80 | 80 |
| 81 static void indexedPropertyGetterCallback(uint32_t index, const v8::PropertyCall
backInfo<v8::Value>& info) | 81 static void indexedPropertyGetterCallback(uint32_t index, const v8::PropertyCall
backInfo<v8::Value>& info) |
| 82 { | 82 { |
| 83 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMIndexedProperty"); | 83 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMIndexedProperty"); |
| 84 TestSpecialOperationsAnonymousV8Internal::indexedPropertyGetter(index, info)
; | 84 TestSpecialOperationsIntV8Internal::indexedPropertyGetter(index, info); |
| 85 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 85 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
| 86 } | 86 } |
| 87 | 87 |
| 88 static void indexedPropertySetter(uint32_t index, v8::Local<v8::Value> jsValue,
const v8::PropertyCallbackInfo<v8::Value>& info) | 88 static void indexedPropertySetter(uint32_t index, v8::Local<v8::Value> jsValue,
const v8::PropertyCallbackInfo<v8::Value>& info) |
| 89 { | 89 { |
| 90 TestSpecialOperationsAnonymous* collection = V8TestSpecialOperationsAnonymou
s::toNative(info.Holder()); | 90 TestSpecialOperationsInt* collection = V8TestSpecialOperationsInt::toNative(
info.Holder()); |
| 91 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, propertyValue, jsVa
lue); | 91 V8TRYCATCH_EXCEPTION_VOID(unsigned, propertyValue, toUInt32(jsValue, excepti
onState), exceptionState); |
| 92 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); |
| 92 bool result = collection->anonymousIndexedSetter(index, propertyValue); | 93 bool result = collection->anonymousIndexedSetter(index, propertyValue); |
| 93 if (!result) | 94 if (!result) |
| 94 return; | 95 return; |
| 95 v8SetReturnValue(info, jsValue); | 96 v8SetReturnValue(info, jsValue); |
| 96 } | 97 } |
| 97 | 98 |
| 98 static void indexedPropertySetterCallback(uint32_t index, v8::Local<v8::Value> j
sValue, const v8::PropertyCallbackInfo<v8::Value>& info) | 99 static void indexedPropertySetterCallback(uint32_t index, v8::Local<v8::Value> j
sValue, const v8::PropertyCallbackInfo<v8::Value>& info) |
| 99 { | 100 { |
| 100 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMIndexedProperty"); | 101 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMIndexedProperty"); |
| 101 TestSpecialOperationsAnonymousV8Internal::indexedPropertySetter(index, jsVal
ue, info); | 102 TestSpecialOperationsIntV8Internal::indexedPropertySetter(index, jsValue, in
fo); |
| 102 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 103 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
| 103 } | 104 } |
| 104 | 105 |
| 105 static void indexedPropertyDeleter(uint32_t index, const v8::PropertyCallbackInf
o<v8::Boolean>& info) | |
| 106 { | |
| 107 TestSpecialOperationsAnonymous* collection = V8TestSpecialOperationsAnonymou
s::toNative(info.Holder()); | |
| 108 DeleteResult result = collection->anonymousIndexedDeleter(index); | |
| 109 if (result != DeleteUnknownProperty) | |
| 110 return v8SetReturnValueBool(info, result == DeleteSuccess); | |
| 111 } | |
| 112 | |
| 113 static void indexedPropertyDeleterCallback(uint32_t index, const v8::PropertyCal
lbackInfo<v8::Boolean>& info) | |
| 114 { | |
| 115 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMIndexedProperty"); | |
| 116 TestSpecialOperationsAnonymousV8Internal::indexedPropertyDeleter(index, info
); | |
| 117 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | |
| 118 } | |
| 119 | |
| 120 static void namedPropertyGetter(v8::Local<v8::String> name, const v8::PropertyCa
llbackInfo<v8::Value>& info) | 106 static void namedPropertyGetter(v8::Local<v8::String> name, const v8::PropertyCa
llbackInfo<v8::Value>& info) |
| 121 { | 107 { |
| 122 if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty()) | 108 if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty()) |
| 123 return; | 109 return; |
| 124 if (info.Holder()->HasRealNamedCallbackProperty(name)) | 110 if (info.Holder()->HasRealNamedCallbackProperty(name)) |
| 125 return; | 111 return; |
| 126 if (info.Holder()->HasRealNamedProperty(name)) | 112 if (info.Holder()->HasRealNamedProperty(name)) |
| 127 return; | 113 return; |
| 128 | 114 |
| 129 TestSpecialOperationsAnonymous* collection = V8TestSpecialOperationsAnonymou
s::toNative(info.Holder()); | 115 TestSpecialOperationsInt* collection = V8TestSpecialOperationsInt::toNative(
info.Holder()); |
| 130 AtomicString propertyName = toCoreAtomicString(name); | 116 AtomicString propertyName = toCoreAtomicString(name); |
| 131 String element = collection->anonymousNamedGetter(propertyName); | 117 int element = collection->anonymousNamedGetter(propertyName); |
| 132 if (element.isNull()) | 118 if () |
| 133 return; | 119 return; |
| 134 v8SetReturnValueString(info, element, info.GetIsolate()); | 120 v8SetReturnValueInt(info, element); |
| 135 } | 121 } |
| 136 | 122 |
| 137 static void namedPropertyGetterCallback(v8::Local<v8::String> name, const v8::Pr
opertyCallbackInfo<v8::Value>& info) | 123 static void namedPropertyGetterCallback(v8::Local<v8::String> name, const v8::Pr
opertyCallbackInfo<v8::Value>& info) |
| 138 { | 124 { |
| 139 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); | 125 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); |
| 140 TestSpecialOperationsAnonymousV8Internal::namedPropertyGetter(name, info); | 126 TestSpecialOperationsIntV8Internal::namedPropertyGetter(name, info); |
| 141 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 127 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
| 142 } | 128 } |
| 143 | 129 |
| 144 static void namedPropertySetter(v8::Local<v8::String> name, v8::Local<v8::Value>
jsValue, const v8::PropertyCallbackInfo<v8::Value>& info) | 130 static void namedPropertySetter(v8::Local<v8::String> name, v8::Local<v8::Value>
jsValue, const v8::PropertyCallbackInfo<v8::Value>& info) |
| 145 { | 131 { |
| 146 if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty()) | 132 if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty()) |
| 147 return; | 133 return; |
| 148 if (info.Holder()->HasRealNamedCallbackProperty(name)) | 134 if (info.Holder()->HasRealNamedCallbackProperty(name)) |
| 149 return; | 135 return; |
| 150 if (info.Holder()->HasRealNamedProperty(name)) | 136 if (info.Holder()->HasRealNamedProperty(name)) |
| 151 return; | 137 return; |
| 152 | 138 |
| 153 TestSpecialOperationsAnonymous* collection = V8TestSpecialOperationsAnonymou
s::toNative(info.Holder()); | 139 TestSpecialOperationsInt* collection = V8TestSpecialOperationsInt::toNative(
info.Holder()); |
| 154 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, propertyName, name)
; | 140 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, propertyName, name)
; |
| 155 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, propertyValue, jsVa
lue); | 141 V8TRYCATCH_EXCEPTION_VOID(unsigned, propertyValue, toUInt32(jsValue, excepti
onState), exceptionState); |
| 142 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); |
| 156 bool result = collection->anonymousNamedSetter(propertyName, propertyValue); | 143 bool result = collection->anonymousNamedSetter(propertyName, propertyValue); |
| 157 if (!result) | 144 if (!result) |
| 158 return; | 145 return; |
| 159 v8SetReturnValue(info, jsValue); | 146 v8SetReturnValue(info, jsValue); |
| 160 } | 147 } |
| 161 | 148 |
| 162 static void namedPropertySetterCallback(v8::Local<v8::String> name, v8::Local<v8
::Value> jsValue, const v8::PropertyCallbackInfo<v8::Value>& info) | 149 static void namedPropertySetterCallback(v8::Local<v8::String> name, v8::Local<v8
::Value> jsValue, const v8::PropertyCallbackInfo<v8::Value>& info) |
| 163 { | 150 { |
| 164 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); | 151 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); |
| 165 TestSpecialOperationsAnonymousV8Internal::namedPropertySetter(name, jsValue,
info); | 152 TestSpecialOperationsIntV8Internal::namedPropertySetter(name, jsValue, info)
; |
| 166 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 153 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
| 167 } | 154 } |
| 168 | 155 |
| 169 static void namedPropertyQuery(v8::Local<v8::String> name, const v8::PropertyCal
lbackInfo<v8::Integer>& info) | 156 static void namedPropertyQuery(v8::Local<v8::String> name, const v8::PropertyCal
lbackInfo<v8::Integer>& info) |
| 170 { | 157 { |
| 171 TestSpecialOperationsAnonymous* collection = V8TestSpecialOperationsAnonymou
s::toNative(info.Holder()); | 158 TestSpecialOperationsInt* collection = V8TestSpecialOperationsInt::toNative(
info.Holder()); |
| 172 AtomicString propertyName = toCoreAtomicString(name); | 159 AtomicString propertyName = toCoreAtomicString(name); |
| 173 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); | 160 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); |
| 174 bool result = collection->namedPropertyQuery(propertyName, exceptionState); | 161 bool result = collection->namedPropertyQuery(propertyName, exceptionState); |
| 175 if (exceptionState.throwIfNeeded()) | 162 if (exceptionState.throwIfNeeded()) |
| 176 return; | 163 return; |
| 177 if (!result) | 164 if (!result) |
| 178 return; | 165 return; |
| 179 v8SetReturnValueInt(info, v8::None); | 166 v8SetReturnValueInt(info, v8::None); |
| 180 } | 167 } |
| 181 | 168 |
| 182 static void namedPropertyQueryCallback(v8::Local<v8::String> name, const v8::Pro
pertyCallbackInfo<v8::Integer>& info) | 169 static void namedPropertyQueryCallback(v8::Local<v8::String> name, const v8::Pro
pertyCallbackInfo<v8::Integer>& info) |
| 183 { | 170 { |
| 184 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); | 171 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); |
| 185 TestSpecialOperationsAnonymousV8Internal::namedPropertyQuery(name, info); | 172 TestSpecialOperationsIntV8Internal::namedPropertyQuery(name, info); |
| 186 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | |
| 187 } | |
| 188 | |
| 189 static void namedPropertyDeleter(v8::Local<v8::String> name, const v8::PropertyC
allbackInfo<v8::Boolean>& info) | |
| 190 { | |
| 191 TestSpecialOperationsAnonymous* collection = V8TestSpecialOperationsAnonymou
s::toNative(info.Holder()); | |
| 192 AtomicString propertyName = toCoreAtomicString(name); | |
| 193 DeleteResult result = collection->anonymousNamedDeleter(propertyName); | |
| 194 if (result != DeleteUnknownProperty) | |
| 195 return v8SetReturnValueBool(info, result == DeleteSuccess); | |
| 196 } | |
| 197 | |
| 198 static void namedPropertyDeleterCallback(v8::Local<v8::String> name, const v8::P
ropertyCallbackInfo<v8::Boolean>& info) | |
| 199 { | |
| 200 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); | |
| 201 TestSpecialOperationsAnonymousV8Internal::namedPropertyDeleter(name, info); | |
| 202 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 173 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
| 203 } | 174 } |
| 204 | 175 |
| 205 static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& i
nfo) | 176 static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& i
nfo) |
| 206 { | 177 { |
| 207 TestSpecialOperationsAnonymous* collection = V8TestSpecialOperationsAnonymou
s::toNative(info.Holder()); | 178 TestSpecialOperationsInt* collection = V8TestSpecialOperationsInt::toNative(
info.Holder()); |
| 208 Vector<String> names; | 179 Vector<String> names; |
| 209 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); | 180 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); |
| 210 collection->namedPropertyEnumerator(names, exceptionState); | 181 collection->namedPropertyEnumerator(names, exceptionState); |
| 211 if (exceptionState.throwIfNeeded()) | 182 if (exceptionState.throwIfNeeded()) |
| 212 return; | 183 return; |
| 213 v8::Handle<v8::Array> v8names = v8::Array::New(info.GetIsolate(), names.size
()); | 184 v8::Handle<v8::Array> v8names = v8::Array::New(info.GetIsolate(), names.size
()); |
| 214 for (size_t i = 0; i < names.size(); ++i) | 185 for (size_t i = 0; i < names.size(); ++i) |
| 215 v8names->Set(v8::Integer::New(info.GetIsolate(), i), v8String(info.GetIs
olate(), names[i])); | 186 v8names->Set(v8::Integer::New(info.GetIsolate(), i), v8String(info.GetIs
olate(), names[i])); |
| 216 v8SetReturnValue(info, v8names); | 187 v8SetReturnValue(info, v8names); |
| 217 } | 188 } |
| 218 | 189 |
| 219 static void namedPropertyEnumeratorCallback(const v8::PropertyCallbackInfo<v8::A
rray>& info) | 190 static void namedPropertyEnumeratorCallback(const v8::PropertyCallbackInfo<v8::A
rray>& info) |
| 220 { | 191 { |
| 221 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); | 192 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); |
| 222 TestSpecialOperationsAnonymousV8Internal::namedPropertyEnumerator(info); | 193 TestSpecialOperationsIntV8Internal::namedPropertyEnumerator(info); |
| 223 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 194 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
| 224 } | 195 } |
| 225 | 196 |
| 226 } // namespace TestSpecialOperationsAnonymousV8Internal | 197 } // namespace TestSpecialOperationsIntV8Internal |
| 227 | 198 |
| 228 static void configureV8TestSpecialOperationsAnonymousTemplate(v8::Handle<v8::Fun
ctionTemplate> functionTemplate, v8::Isolate* isolate, WrapperWorldType currentW
orldType) | 199 static void configureV8TestSpecialOperationsIntTemplate(v8::Handle<v8::FunctionT
emplate> functionTemplate, v8::Isolate* isolate, WrapperWorldType currentWorldTy
pe) |
| 229 { | 200 { |
| 230 functionTemplate->ReadOnlyPrototype(); | 201 functionTemplate->ReadOnlyPrototype(); |
| 231 | 202 |
| 232 v8::Local<v8::Signature> defaultSignature; | 203 v8::Local<v8::Signature> defaultSignature; |
| 233 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestSpecialOperationsAnonymous", v8::Local<v8::FunctionTemplate>(), V8Test
SpecialOperationsAnonymous::internalFieldCount, | 204 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestSpecialOperationsInt", v8::Local<v8::FunctionTemplate>(), V8TestSpecia
lOperationsInt::internalFieldCount, |
| 234 0, 0, | 205 0, 0, |
| 235 0, 0, | 206 0, 0, |
| 236 0, 0, | 207 0, 0, |
| 237 isolate, currentWorldType); | 208 isolate, currentWorldType); |
| 238 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla
te->InstanceTemplate(); | 209 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla
te->InstanceTemplate(); |
| 239 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTempl
ate->PrototypeTemplate(); | 210 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTempl
ate->PrototypeTemplate(); |
| 240 functionTemplate->InstanceTemplate()->SetIndexedPropertyHandler(TestSpecialO
perationsAnonymousV8Internal::indexedPropertyGetterCallback, TestSpecialOperatio
nsAnonymousV8Internal::indexedPropertySetterCallback, 0, TestSpecialOperationsAn
onymousV8Internal::indexedPropertyDeleterCallback, indexedPropertyEnumerator<Tes
tSpecialOperationsAnonymous>); | 211 functionTemplate->InstanceTemplate()->SetIndexedPropertyHandler(TestSpecialO
perationsIntV8Internal::indexedPropertyGetterCallback, TestSpecialOperationsIntV
8Internal::indexedPropertySetterCallback, 0, 0, indexedPropertyEnumerator<TestSp
ecialOperationsInt>); |
| 241 functionTemplate->InstanceTemplate()->SetNamedPropertyHandler(TestSpecialOpe
rationsAnonymousV8Internal::namedPropertyGetterCallback, TestSpecialOperationsAn
onymousV8Internal::namedPropertySetterCallback, TestSpecialOperationsAnonymousV8
Internal::namedPropertyQueryCallback, TestSpecialOperationsAnonymousV8Internal::
namedPropertyDeleterCallback, TestSpecialOperationsAnonymousV8Internal::namedPro
pertyEnumeratorCallback); | 212 functionTemplate->InstanceTemplate()->SetNamedPropertyHandler(TestSpecialOpe
rationsIntV8Internal::namedPropertyGetterCallback, TestSpecialOperationsIntV8Int
ernal::namedPropertySetterCallback, TestSpecialOperationsIntV8Internal::namedPro
pertyQueryCallback, 0, TestSpecialOperationsIntV8Internal::namedPropertyEnumerat
orCallback); |
| 242 | 213 |
| 243 // Custom toString template | 214 // Custom toString template |
| 244 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData:
:current()->toStringTemplate()); | 215 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData:
:current()->toStringTemplate()); |
| 245 } | 216 } |
| 246 | 217 |
| 247 v8::Handle<v8::FunctionTemplate> V8TestSpecialOperationsAnonymous::domTemplate(v
8::Isolate* isolate, WrapperWorldType currentWorldType) | 218 v8::Handle<v8::FunctionTemplate> V8TestSpecialOperationsInt::domTemplate(v8::Iso
late* isolate, WrapperWorldType currentWorldType) |
| 248 { | 219 { |
| 249 V8PerIsolateData* data = V8PerIsolateData::from(isolate); | 220 V8PerIsolateData* data = V8PerIsolateData::from(isolate); |
| 250 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&wrapperTypeInfo); | 221 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&wrapperTypeInfo); |
| 251 if (result != data->templateMap(currentWorldType).end()) | 222 if (result != data->templateMap(currentWorldType).end()) |
| 252 return result->value.newLocal(isolate); | 223 return result->value.newLocal(isolate); |
| 253 | 224 |
| 254 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); | 225 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); |
| 255 v8::EscapableHandleScope handleScope(isolate); | 226 v8::EscapableHandleScope handleScope(isolate); |
| 256 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate, V
8ObjectConstructor::isValidConstructorMode); | 227 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate, V
8ObjectConstructor::isValidConstructorMode); |
| 257 configureV8TestSpecialOperationsAnonymousTemplate(templ, isolate, currentWor
ldType); | 228 configureV8TestSpecialOperationsIntTemplate(templ, isolate, currentWorldType
); |
| 258 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); | 229 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); |
| 259 return handleScope.Escape(templ); | 230 return handleScope.Escape(templ); |
| 260 } | 231 } |
| 261 | 232 |
| 262 bool V8TestSpecialOperationsAnonymous::hasInstance(v8::Handle<v8::Value> jsValue
, v8::Isolate* isolate) | 233 bool V8TestSpecialOperationsInt::hasInstance(v8::Handle<v8::Value> jsValue, v8::
Isolate* isolate) |
| 263 { | 234 { |
| 264 return V8PerIsolateData::from(isolate)->hasInstanceInMainWorld(&wrapperTypeI
nfo, jsValue) | 235 return V8PerIsolateData::from(isolate)->hasInstanceInMainWorld(&wrapperTypeI
nfo, jsValue) |
| 265 || V8PerIsolateData::from(isolate)->hasInstanceInNonMainWorld(&wrapperTy
peInfo, jsValue); | 236 || V8PerIsolateData::from(isolate)->hasInstanceInNonMainWorld(&wrapperTy
peInfo, jsValue); |
| 266 } | 237 } |
| 267 | 238 |
| 268 v8::Handle<v8::Object> V8TestSpecialOperationsAnonymous::createWrapper(PassRefPt
r<TestSpecialOperationsAnonymous> impl, v8::Handle<v8::Object> creationContext,
v8::Isolate* isolate) | 239 v8::Handle<v8::Object> V8TestSpecialOperationsInt::createWrapper(PassRefPtr<Test
SpecialOperationsInt> impl, v8::Handle<v8::Object> creationContext, v8::Isolate*
isolate) |
| 269 { | 240 { |
| 270 ASSERT(impl); | 241 ASSERT(impl); |
| 271 ASSERT(!DOMDataStore::containsWrapper<V8TestSpecialOperationsAnonymous>(impl
.get(), isolate)); | 242 ASSERT(!DOMDataStore::containsWrapper<V8TestSpecialOperationsInt>(impl.get()
, isolate)); |
| 272 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { | 243 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { |
| 273 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje
ct(impl.get()); | 244 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje
ct(impl.get()); |
| 274 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper
TypeInfo. These will both have | 245 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper
TypeInfo. These will both have |
| 275 // the same object de-ref functions, though, so use that as the basis of
the check. | 246 // the same object de-ref functions, though, so use that as the basis of
the check. |
| 276 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction
== wrapperTypeInfo.derefObjectFunction); | 247 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction
== wrapperTypeInfo.derefObjectFunction); |
| 277 } | 248 } |
| 278 | 249 |
| 279 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext
, &wrapperTypeInfo, toInternalPointer(impl.get()), isolate); | 250 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext
, &wrapperTypeInfo, toInternalPointer(impl.get()), isolate); |
| 280 if (UNLIKELY(wrapper.IsEmpty())) | 251 if (UNLIKELY(wrapper.IsEmpty())) |
| 281 return wrapper; | 252 return wrapper; |
| 282 | 253 |
| 283 installPerContextEnabledProperties(wrapper, impl.get(), isolate); | 254 installPerContextEnabledProperties(wrapper, impl.get(), isolate); |
| 284 V8DOMWrapper::associateObjectWithWrapper<V8TestSpecialOperationsAnonymous>(i
mpl, &wrapperTypeInfo, wrapper, isolate, WrapperConfiguration::Independent); | 255 V8DOMWrapper::associateObjectWithWrapper<V8TestSpecialOperationsInt>(impl, &
wrapperTypeInfo, wrapper, isolate, WrapperConfiguration::Independent); |
| 285 return wrapper; | 256 return wrapper; |
| 286 } | 257 } |
| 287 | 258 |
| 288 void V8TestSpecialOperationsAnonymous::derefObject(void* object) | 259 void V8TestSpecialOperationsInt::derefObject(void* object) |
| 289 { | 260 { |
| 290 fromInternalPointer(object)->deref(); | 261 fromInternalPointer(object)->deref(); |
| 291 } | 262 } |
| 292 | 263 |
| 293 template<> | 264 template<> |
| 294 v8::Handle<v8::Value> toV8NoInline(TestSpecialOperationsAnonymous* impl, v8::Han
dle<v8::Object> creationContext, v8::Isolate* isolate) | 265 v8::Handle<v8::Value> toV8NoInline(TestSpecialOperationsInt* impl, v8::Handle<v8
::Object> creationContext, v8::Isolate* isolate) |
| 295 { | 266 { |
| 296 return toV8(impl, creationContext, isolate); | 267 return toV8(impl, creationContext, isolate); |
| 297 } | 268 } |
| 298 | 269 |
| 299 } // namespace WebCore | 270 } // namespace WebCore |
| OLD | NEW |