| OLD | NEW |
| (Empty) |
| 1 /* | |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | |
| 3 * | |
| 4 * Redistribution and use in source and binary forms, with or without | |
| 5 * modification, are permitted provided that the following conditions are | |
| 6 * met: | |
| 7 * | |
| 8 * * Redistributions of source code must retain the above copyright | |
| 9 * notice, this list of conditions and the following disclaimer. | |
| 10 * * Redistributions in binary form must reproduce the above | |
| 11 * copyright notice, this list of conditions and the following disclaimer | |
| 12 * in the documentation and/or other materials provided with the | |
| 13 * distribution. | |
| 14 * * Neither the name of Google Inc. nor the names of its | |
| 15 * contributors may be used to endorse or promote products derived from | |
| 16 * this software without specific prior written permission. | |
| 17 * | |
| 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
| 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
| 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
| 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
| 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
| 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. | |
| 29 */ | |
| 30 | |
| 31 // This file has been auto-generated by code_generator_v8.pm. DO NOT MODIFY! | |
| 32 | |
| 33 #include "config.h" | |
| 34 #if ENABLE(Condition1) || ENABLE(Condition2) | |
| 35 #include "V8TestSerializedScriptValueInterface.h" | |
| 36 | |
| 37 #include "RuntimeEnabledFeatures.h" | |
| 38 #include "bindings/v8/ExceptionMessages.h" | |
| 39 #include "bindings/v8/ExceptionState.h" | |
| 40 #include "bindings/v8/ScriptController.h" | |
| 41 #include "bindings/v8/ScriptState.h" | |
| 42 #include "bindings/v8/ScriptValue.h" | |
| 43 #include "bindings/v8/SerializedScriptValue.h" | |
| 44 #include "bindings/v8/V8Binding.h" | |
| 45 #include "bindings/v8/V8DOMConfiguration.h" | |
| 46 #include "bindings/v8/V8DOMWrapper.h" | |
| 47 #include "core/dom/ContextFeatures.h" | |
| 48 #include "core/dom/Document.h" | |
| 49 #include "platform/TraceEvent.h" | |
| 50 | |
| 51 namespace WebCore { | |
| 52 | |
| 53 static void initializeScriptWrappableForInterface(TestSerializedScriptValueInter
face* object) | |
| 54 { | |
| 55 if (ScriptWrappable::wrapperCanBeStoredInObject(object)) | |
| 56 ScriptWrappable::setTypeInfoInObject(object, &V8TestSerializedScriptValu
eInterface::wrapperTypeInfo); | |
| 57 else | |
| 58 ASSERT_NOT_REACHED(); | |
| 59 } | |
| 60 | |
| 61 } // namespace WebCore | |
| 62 | |
| 63 // In ScriptWrappable::init, the use of a local function declaration has an issu
e on Windows: | |
| 64 // the local declaration does not pick up the surrounding namespace. Therefore,
we provide this function | |
| 65 // in the global namespace. | |
| 66 // (More info on the MSVC bug here: http://connect.microsoft.com/VisualStudio/fe
edback/details/664619/the-namespace-of-local-function-declarations-in-c) | |
| 67 void webCoreInitializeScriptWrappableForInterface(WebCore::TestSerializedScriptV
alueInterface* object) | |
| 68 { | |
| 69 WebCore::initializeScriptWrappableForInterface(object); | |
| 70 } | |
| 71 | |
| 72 namespace WebCore { | |
| 73 const WrapperTypeInfo V8TestSerializedScriptValueInterface::wrapperTypeInfo = {
gin::kEmbedderBlink, V8TestSerializedScriptValueInterface::GetTemplate, V8TestSe
rializedScriptValueInterface::derefObject, 0, 0, 0, V8TestSerializedScriptValueI
nterface::installPerContextEnabledMethods, 0, WrapperTypeObjectPrototype }; | |
| 74 | |
| 75 namespace TestSerializedScriptValueInterfaceV8Internal { | |
| 76 | |
| 77 template <typename T> void V8_USE(T) { } | |
| 78 | |
| 79 static void valueAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info
) | |
| 80 { | |
| 81 TestSerializedScriptValueInterface* imp = V8TestSerializedScriptValueInterfa
ce::toNative(info.Holder()); | |
| 82 v8SetReturnValue(info, imp->value() ? imp->value()->deserialize() : v8::Hand
le<v8::Value>(v8::Null(info.GetIsolate()))); | |
| 83 } | |
| 84 | |
| 85 static void valueAttributeGetterCallback(v8::Local<v8::String>, const v8::Proper
tyCallbackInfo<v8::Value>& info) | |
| 86 { | |
| 87 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); | |
| 88 TestSerializedScriptValueInterfaceV8Internal::valueAttributeGetter(info); | |
| 89 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | |
| 90 } | |
| 91 | |
| 92 static void valueAttributeSetter(v8::Local<v8::Value> jsValue, const v8::Propert
yCallbackInfo<void>& info) | |
| 93 { | |
| 94 ExceptionState exceptionState(ExceptionState::SetterContext, "value", "TestS
erializedScriptValueInterface", info.Holder(), info.GetIsolate()); | |
| 95 TestSerializedScriptValueInterface* imp = V8TestSerializedScriptValueInterfa
ce::toNative(info.Holder()); | |
| 96 V8TRYCATCH_VOID(RefPtr<SerializedScriptValue>, cppValue, SerializedScriptVal
ue::create(jsValue, info.GetIsolate())); | |
| 97 imp->setValue(WTF::getPtr(cppValue)); | |
| 98 } | |
| 99 | |
| 100 static void valueAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Va
lue> jsValue, const v8::PropertyCallbackInfo<void>& info) | |
| 101 { | |
| 102 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); | |
| 103 TestSerializedScriptValueInterfaceV8Internal::valueAttributeSetter(jsValue,
info); | |
| 104 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | |
| 105 } | |
| 106 | |
| 107 static void readonlyValueAttributeGetter(const v8::PropertyCallbackInfo<v8::Valu
e>& info) | |
| 108 { | |
| 109 TestSerializedScriptValueInterface* imp = V8TestSerializedScriptValueInterfa
ce::toNative(info.Holder()); | |
| 110 v8SetReturnValue(info, imp->readonlyValue() ? imp->readonlyValue()->deserial
ize() : v8::Handle<v8::Value>(v8::Null(info.GetIsolate()))); | |
| 111 } | |
| 112 | |
| 113 static void readonlyValueAttributeGetterCallback(v8::Local<v8::String>, const v8
::PropertyCallbackInfo<v8::Value>& info) | |
| 114 { | |
| 115 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); | |
| 116 TestSerializedScriptValueInterfaceV8Internal::readonlyValueAttributeGetter(i
nfo); | |
| 117 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | |
| 118 } | |
| 119 | |
| 120 static void dirtySerializedValueAttributeGetter(const v8::PropertyCallbackInfo<v
8::Value>& info) | |
| 121 { | |
| 122 v8::Handle<v8::String> propertyName = v8::String::NewFromUtf8(info.GetIsolat
e(), "dirtySerializedValue", v8::String::kInternalizedString); | |
| 123 TestSerializedScriptValueInterface* imp = V8TestSerializedScriptValueInterfa
ce::toNative(info.Holder()); | |
| 124 if (!imp->isValueDirty()) { | |
| 125 v8::Handle<v8::Value> jsValue = info.Holder()->GetHiddenValue(propertyNa
me); | |
| 126 if (!jsValue.IsEmpty()) { | |
| 127 v8SetReturnValue(info, jsValue); | |
| 128 return; | |
| 129 } | |
| 130 } | |
| 131 RefPtr<SerializedScriptValue> serialized = imp->dirtySerializedValue(); | |
| 132 ScriptValue jsValue = serialized ? serialized->deserialize() : v8::Handle<v8
::Value>(v8::Null(info.GetIsolate())); | |
| 133 info.Holder()->SetHiddenValue(propertyName, jsValue); | |
| 134 v8SetReturnValue(info, jsValue); | |
| 135 } | |
| 136 | |
| 137 static void dirtySerializedValueAttributeGetterCallback(v8::Local<v8::String>, c
onst v8::PropertyCallbackInfo<v8::Value>& info) | |
| 138 { | |
| 139 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); | |
| 140 TestSerializedScriptValueInterfaceV8Internal::dirtySerializedValueAttributeG
etter(info); | |
| 141 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | |
| 142 } | |
| 143 | |
| 144 static void dirtySerializedValueAttributeSetter(v8::Local<v8::Value> jsValue, co
nst v8::PropertyCallbackInfo<void>& info) | |
| 145 { | |
| 146 ExceptionState exceptionState(ExceptionState::SetterContext, "dirtySerialize
dValue", "TestSerializedScriptValueInterface", info.Holder(), info.GetIsolate())
; | |
| 147 TestSerializedScriptValueInterface* imp = V8TestSerializedScriptValueInterfa
ce::toNative(info.Holder()); | |
| 148 V8TRYCATCH_VOID(RefPtr<SerializedScriptValue>, cppValue, SerializedScriptVal
ue::create(jsValue, info.GetIsolate())); | |
| 149 imp->setDirtySerializedValue(WTF::getPtr(cppValue)); | |
| 150 info.Holder()->DeleteHiddenValue(v8::String::NewFromUtf8(info.GetIsolate(),
"dirtySerializedValue", v8::String::kInternalizedString)); // Invalidate the cac
hed value. | |
| 151 } | |
| 152 | |
| 153 static void dirtySerializedValueAttributeSetterCallback(v8::Local<v8::String>, v
8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) | |
| 154 { | |
| 155 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); | |
| 156 TestSerializedScriptValueInterfaceV8Internal::dirtySerializedValueAttributeS
etter(jsValue, info); | |
| 157 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | |
| 158 } | |
| 159 | |
| 160 static void dirtyScriptValueAttributeGetter(const v8::PropertyCallbackInfo<v8::V
alue>& info) | |
| 161 { | |
| 162 v8::Handle<v8::String> propertyName = v8::String::NewFromUtf8(info.GetIsolat
e(), "dirtyScriptValue", v8::String::kInternalizedString); | |
| 163 TestSerializedScriptValueInterface* imp = V8TestSerializedScriptValueInterfa
ce::toNative(info.Holder()); | |
| 164 if (!imp->isValueDirty()) { | |
| 165 v8::Handle<v8::Value> jsValue = info.Holder()->GetHiddenValue(propertyNa
me); | |
| 166 if (!jsValue.IsEmpty()) { | |
| 167 v8SetReturnValue(info, jsValue); | |
| 168 return; | |
| 169 } | |
| 170 } | |
| 171 ScriptValue jsValue = imp->dirtyScriptValue(); | |
| 172 info.Holder()->SetHiddenValue(propertyName, jsValue.v8Value()); | |
| 173 v8SetReturnValue(info, jsValue.v8Value()); | |
| 174 } | |
| 175 | |
| 176 static void dirtyScriptValueAttributeGetterCallback(v8::Local<v8::String>, const
v8::PropertyCallbackInfo<v8::Value>& info) | |
| 177 { | |
| 178 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); | |
| 179 TestSerializedScriptValueInterfaceV8Internal::dirtyScriptValueAttributeGette
r(info); | |
| 180 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | |
| 181 } | |
| 182 | |
| 183 static void dirtyScriptValueAttributeSetter(v8::Local<v8::Value> jsValue, const
v8::PropertyCallbackInfo<void>& info) | |
| 184 { | |
| 185 ExceptionState exceptionState(ExceptionState::SetterContext, "dirtyScriptVal
ue", "TestSerializedScriptValueInterface", info.Holder(), info.GetIsolate()); | |
| 186 TestSerializedScriptValueInterface* imp = V8TestSerializedScriptValueInterfa
ce::toNative(info.Holder()); | |
| 187 V8TRYCATCH_VOID(ScriptValue, cppValue, ScriptValue(jsValue, info.GetIsolate(
))); | |
| 188 imp->setDirtyScriptValue(cppValue); | |
| 189 info.Holder()->DeleteHiddenValue(v8::String::NewFromUtf8(info.GetIsolate(),
"dirtyScriptValue", v8::String::kInternalizedString)); // Invalidate the cached
value. | |
| 190 } | |
| 191 | |
| 192 static void dirtyScriptValueAttributeSetterCallback(v8::Local<v8::String>, v8::L
ocal<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) | |
| 193 { | |
| 194 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); | |
| 195 TestSerializedScriptValueInterfaceV8Internal::dirtyScriptValueAttributeSette
r(jsValue, info); | |
| 196 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | |
| 197 } | |
| 198 | |
| 199 static void cachedValueCallWithAttributeGetter(const v8::PropertyCallbackInfo<v8
::Value>& info) | |
| 200 { | |
| 201 v8::Handle<v8::String> propertyName = v8::String::NewFromUtf8(info.GetIsolat
e(), "cachedValueCallWith", v8::String::kInternalizedString); | |
| 202 TestSerializedScriptValueInterface* imp = V8TestSerializedScriptValueInterfa
ce::toNative(info.Holder()); | |
| 203 if (!imp->isValueDirty()) { | |
| 204 v8::Handle<v8::Value> jsValue = info.Holder()->GetHiddenValue(propertyNa
me); | |
| 205 if (!jsValue.IsEmpty()) { | |
| 206 v8SetReturnValue(info, jsValue); | |
| 207 return; | |
| 208 } | |
| 209 } | |
| 210 ScriptState* currentState = ScriptState::current(); | |
| 211 if (!currentState) | |
| 212 return v8Undefined(); | |
| 213 ScriptState& state = *currentState; | |
| 214 RefPtr<SerializedScriptValue> serialized = imp->cachedValueCallWith(&state); | |
| 215 ScriptValue jsValue = serialized ? serialized->deserialize() : v8::Handle<v8
::Value>(v8::Null(info.GetIsolate())); | |
| 216 info.Holder()->SetHiddenValue(propertyName, jsValue); | |
| 217 v8SetReturnValue(info, jsValue); | |
| 218 } | |
| 219 | |
| 220 static void cachedValueCallWithAttributeGetterCallback(v8::Local<v8::String>, co
nst v8::PropertyCallbackInfo<v8::Value>& info) | |
| 221 { | |
| 222 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); | |
| 223 TestSerializedScriptValueInterfaceV8Internal::cachedValueCallWithAttributeGe
tter(info); | |
| 224 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | |
| 225 } | |
| 226 | |
| 227 static void cachedValueCallWithAttributeSetter(v8::Local<v8::Value> jsValue, con
st v8::PropertyCallbackInfo<void>& info) | |
| 228 { | |
| 229 ExceptionState exceptionState(ExceptionState::SetterContext, "cachedValueCal
lWith", "TestSerializedScriptValueInterface", info.Holder(), info.GetIsolate()); | |
| 230 TestSerializedScriptValueInterface* imp = V8TestSerializedScriptValueInterfa
ce::toNative(info.Holder()); | |
| 231 V8TRYCATCH_VOID(RefPtr<SerializedScriptValue>, cppValue, SerializedScriptVal
ue::create(jsValue, info.GetIsolate())); | |
| 232 ScriptState* currentState = ScriptState::current(); | |
| 233 if (!currentState) | |
| 234 return; | |
| 235 ScriptState& state = *currentState; | |
| 236 imp->setCachedValueCallWith(&state, WTF::getPtr(cppValue)); | |
| 237 if (state.hadException()) | |
| 238 throwError(state.exception(), info.GetIsolate()); | |
| 239 info.Holder()->DeleteHiddenValue(v8::String::NewFromUtf8(info.GetIsolate(),
"cachedValueCallWith", v8::String::kInternalizedString)); // Invalidate the cach
ed value. | |
| 240 } | |
| 241 | |
| 242 static void cachedValueCallWithAttributeSetterCallback(v8::Local<v8::String>, v8
::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) | |
| 243 { | |
| 244 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); | |
| 245 TestSerializedScriptValueInterfaceV8Internal::cachedValueCallWithAttributeSe
tter(jsValue, info); | |
| 246 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | |
| 247 } | |
| 248 | |
| 249 } // namespace TestSerializedScriptValueInterfaceV8Internal | |
| 250 | |
| 251 static const V8DOMConfiguration::AttributeConfiguration V8TestSerializedScriptVa
lueInterfaceAttributes[] = { | |
| 252 {"value", TestSerializedScriptValueInterfaceV8Internal::valueAttributeGetter
Callback, TestSerializedScriptValueInterfaceV8Internal::valueAttributeSetterCall
back, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::Prop
ertyAttribute>(v8::None), 0 /* on instance */}, | |
| 253 {"readonlyValue", TestSerializedScriptValueInterfaceV8Internal::readonlyValu
eAttributeGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT
), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, | |
| 254 {"dirtySerializedValue", TestSerializedScriptValueInterfaceV8Internal::dirty
SerializedValueAttributeGetterCallback, TestSerializedScriptValueInterfaceV8Inte
rnal::dirtySerializedValueAttributeSetterCallback, 0, 0, 0, static_cast<v8::Acce
ssControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on i
nstance */}, | |
| 255 {"dirtyScriptValue", TestSerializedScriptValueInterfaceV8Internal::dirtyScri
ptValueAttributeGetterCallback, TestSerializedScriptValueInterfaceV8Internal::di
rtyScriptValueAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v
8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, | |
| 256 {"cachedValueCallWith", TestSerializedScriptValueInterfaceV8Internal::cached
ValueCallWithAttributeGetterCallback, TestSerializedScriptValueInterfaceV8Intern
al::cachedValueCallWithAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessC
ontrol>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on inst
ance */}, | |
| 257 }; | |
| 258 | |
| 259 static v8::Handle<v8::FunctionTemplate> ConfigureV8TestSerializedScriptValueInte
rfaceTemplate(v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* is
olate, WrapperWorldType currentWorldType) | |
| 260 { | |
| 261 functionTemplate->ReadOnlyPrototype(); | |
| 262 | |
| 263 v8::Local<v8::Signature> defaultSignature; | |
| 264 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestSerializedScriptValueInterface", v8::Local<v8::FunctionTemplate>(), V8
TestSerializedScriptValueInterface::internalFieldCount, | |
| 265 V8TestSerializedScriptValueInterfaceAttributes, WTF_ARRAY_LENGTH(V8TestS
erializedScriptValueInterfaceAttributes), | |
| 266 0, 0, | |
| 267 0, 0, | |
| 268 isolate, currentWorldType); | |
| 269 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla
te->InstanceTemplate(); | |
| 270 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTempl
ate->PrototypeTemplate(); | |
| 271 | |
| 272 // Custom toString template | |
| 273 functionTemplate->Set(v8::String::NewFromUtf8(isolate, "toString", v8::Strin
g::kInternalizedString), V8PerIsolateData::current()->toStringTemplate()); | |
| 274 return functionTemplate; | |
| 275 } | |
| 276 | |
| 277 v8::Handle<v8::FunctionTemplate> V8TestSerializedScriptValueInterface::GetTempla
te(v8::Isolate* isolate, WrapperWorldType currentWorldType) | |
| 278 { | |
| 279 V8PerIsolateData* data = V8PerIsolateData::from(isolate); | |
| 280 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&wrapperTypeInfo); | |
| 281 if (result != data->templateMap(currentWorldType).end()) | |
| 282 return result->value.newLocal(isolate); | |
| 283 | |
| 284 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); | |
| 285 v8::EscapableHandleScope handleScope(isolate); | |
| 286 v8::Local<v8::FunctionTemplate> templ = | |
| 287 ConfigureV8TestSerializedScriptValueInterfaceTemplate(data->rawTemplate(
&wrapperTypeInfo, currentWorldType), isolate, currentWorldType); | |
| 288 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); | |
| 289 return handleScope.Escape(templ); | |
| 290 } | |
| 291 | |
| 292 bool V8TestSerializedScriptValueInterface::hasInstance(v8::Handle<v8::Value> jsV
alue, v8::Isolate* isolate, WrapperWorldType currentWorldType) | |
| 293 { | |
| 294 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, currentWorldType); | |
| 295 } | |
| 296 | |
| 297 bool V8TestSerializedScriptValueInterface::hasInstanceInAnyWorld(v8::Handle<v8::
Value> jsValue, v8::Isolate* isolate) | |
| 298 { | |
| 299 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, MainWorld) | |
| 300 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, IsolatedWorld) | |
| 301 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, WorkerWorld); | |
| 302 } | |
| 303 | |
| 304 v8::Handle<v8::Object> V8TestSerializedScriptValueInterface::createWrapper(PassR
efPtr<TestSerializedScriptValueInterface> impl, v8::Handle<v8::Object> creationC
ontext, v8::Isolate* isolate) | |
| 305 { | |
| 306 ASSERT(impl); | |
| 307 ASSERT(!DOMDataStore::containsWrapper<V8TestSerializedScriptValueInterface>(
impl.get(), isolate)); | |
| 308 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { | |
| 309 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje
ct(impl.get()); | |
| 310 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper
TypeInfo. These will both have | |
| 311 // the same object de-ref functions, though, so use that as the basis of
the check. | |
| 312 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction
== wrapperTypeInfo.derefObjectFunction); | |
| 313 } | |
| 314 | |
| 315 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext
, &wrapperTypeInfo, toInternalPointer(impl.get()), isolate); | |
| 316 if (UNLIKELY(wrapper.IsEmpty())) | |
| 317 return wrapper; | |
| 318 | |
| 319 installPerContextEnabledProperties(wrapper, impl.get(), isolate); | |
| 320 V8DOMWrapper::associateObjectWithWrapper<V8TestSerializedScriptValueInterfac
e>(impl, &wrapperTypeInfo, wrapper, isolate, WrapperConfiguration::Independent); | |
| 321 return wrapper; | |
| 322 } | |
| 323 | |
| 324 void V8TestSerializedScriptValueInterface::derefObject(void* object) | |
| 325 { | |
| 326 fromInternalPointer(object)->deref(); | |
| 327 } | |
| 328 | |
| 329 template<> | |
| 330 v8::Handle<v8::Value> toV8NoInline(TestSerializedScriptValueInterface* impl, v8:
:Handle<v8::Object> creationContext, v8::Isolate* isolate) | |
| 331 { | |
| 332 return toV8(impl, creationContext, isolate); | |
| 333 } | |
| 334 | |
| 335 } // namespace WebCore | |
| 336 #endif // ENABLE(Condition1) || ENABLE(Condition2) | |
| OLD | NEW |