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 #include "wtf/UnusedParam.h" |
| 51 |
| 52 namespace WebCore { |
| 53 |
| 54 static void initializeScriptWrappableForInterface(TestSerializedScriptValueInter
face* object) |
| 55 { |
| 56 if (ScriptWrappable::wrapperCanBeStoredInObject(object)) |
| 57 ScriptWrappable::setTypeInfoInObject(object, &V8TestSerializedScriptValu
eInterface::wrapperTypeInfo); |
| 58 else |
| 59 ASSERT_NOT_REACHED(); |
| 60 } |
| 61 |
| 62 } // namespace WebCore |
| 63 |
| 64 // In ScriptWrappable::init, the use of a local function declaration has an issu
e on Windows: |
| 65 // the local declaration does not pick up the surrounding namespace. Therefore,
we provide this function |
| 66 // in the global namespace. |
| 67 // (More info on the MSVC bug here: http://connect.microsoft.com/VisualStudio/fe
edback/details/664619/the-namespace-of-local-function-declarations-in-c) |
| 68 void webCoreInitializeScriptWrappableForInterface(WebCore::TestSerializedScriptV
alueInterface* object) |
| 69 { |
| 70 WebCore::initializeScriptWrappableForInterface(object); |
| 71 } |
| 72 |
| 73 namespace WebCore { |
| 74 const WrapperTypeInfo V8TestSerializedScriptValueInterface::wrapperTypeInfo = {
gin::kEmbedderBlink, V8TestSerializedScriptValueInterface::GetTemplate, V8TestSe
rializedScriptValueInterface::derefObject, 0, 0, 0, V8TestSerializedScriptValueI
nterface::installPerContextEnabledMethods, 0, WrapperTypeObjectPrototype }; |
| 75 |
| 76 namespace TestSerializedScriptValueInterfaceV8Internal { |
| 77 |
| 78 template <typename T> void V8_USE(T) { } |
| 79 |
| 80 static void valueAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info
) |
| 81 { |
| 82 TestSerializedScriptValueInterface* imp = V8TestSerializedScriptValueInterfa
ce::toNative(info.Holder()); |
| 83 v8SetReturnValue(info, imp->value() ? imp->value()->deserialize() : v8::Hand
le<v8::Value>(v8::Null(info.GetIsolate()))); |
| 84 } |
| 85 |
| 86 static void valueAttributeGetterCallback(v8::Local<v8::String>, const v8::Proper
tyCallbackInfo<v8::Value>& info) |
| 87 { |
| 88 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |
| 89 TestSerializedScriptValueInterfaceV8Internal::valueAttributeGetter(info); |
| 90 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 91 } |
| 92 |
| 93 static void valueAttributeSetter(v8::Local<v8::Value> jsValue, const v8::Propert
yCallbackInfo<void>& info) |
| 94 { |
| 95 ExceptionState exceptionState(ExceptionState::SetterContext, "value", "TestS
erializedScriptValueInterface", info.Holder(), info.GetIsolate()); |
| 96 TestSerializedScriptValueInterface* imp = V8TestSerializedScriptValueInterfa
ce::toNative(info.Holder()); |
| 97 V8TRYCATCH_VOID(RefPtr<SerializedScriptValue>, cppValue, SerializedScriptVal
ue::create(jsValue, info.GetIsolate())); |
| 98 imp->setValue(WTF::getPtr(cppValue)); |
| 99 } |
| 100 |
| 101 static void valueAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Va
lue> jsValue, const v8::PropertyCallbackInfo<void>& info) |
| 102 { |
| 103 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); |
| 104 TestSerializedScriptValueInterfaceV8Internal::valueAttributeSetter(jsValue,
info); |
| 105 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 106 } |
| 107 |
| 108 static void readonlyValueAttributeGetter(const v8::PropertyCallbackInfo<v8::Valu
e>& info) |
| 109 { |
| 110 TestSerializedScriptValueInterface* imp = V8TestSerializedScriptValueInterfa
ce::toNative(info.Holder()); |
| 111 v8SetReturnValue(info, imp->readonlyValue() ? imp->readonlyValue()->deserial
ize() : v8::Handle<v8::Value>(v8::Null(info.GetIsolate()))); |
| 112 } |
| 113 |
| 114 static void readonlyValueAttributeGetterCallback(v8::Local<v8::String>, const v8
::PropertyCallbackInfo<v8::Value>& info) |
| 115 { |
| 116 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |
| 117 TestSerializedScriptValueInterfaceV8Internal::readonlyValueAttributeGetter(i
nfo); |
| 118 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 119 } |
| 120 |
| 121 static void dirtySerializedValueAttributeGetter(const v8::PropertyCallbackInfo<v
8::Value>& info) |
| 122 { |
| 123 v8::Handle<v8::String> propertyName = v8::String::NewFromUtf8(info.GetIsolat
e(), "dirtySerializedValue", v8::String::kInternalizedString); |
| 124 TestSerializedScriptValueInterface* imp = V8TestSerializedScriptValueInterfa
ce::toNative(info.Holder()); |
| 125 if (!imp->isValueDirty()) { |
| 126 v8::Handle<v8::Value> jsValue = info.Holder()->GetHiddenValue(propertyNa
me); |
| 127 if (!jsValue.IsEmpty()) { |
| 128 v8SetReturnValue(info, jsValue); |
| 129 return; |
| 130 } |
| 131 } |
| 132 RefPtr<SerializedScriptValue> serialized = imp->dirtySerializedValue(); |
| 133 ScriptValue jsValue = serialized ? serialized->deserialize() : v8::Handle<v8
::Value>(v8::Null(info.GetIsolate())); |
| 134 info.Holder()->SetHiddenValue(propertyName, jsValue); |
| 135 v8SetReturnValue(info, jsValue); |
| 136 } |
| 137 |
| 138 static void dirtySerializedValueAttributeGetterCallback(v8::Local<v8::String>, c
onst v8::PropertyCallbackInfo<v8::Value>& info) |
| 139 { |
| 140 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |
| 141 TestSerializedScriptValueInterfaceV8Internal::dirtySerializedValueAttributeG
etter(info); |
| 142 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 143 } |
| 144 |
| 145 static void dirtySerializedValueAttributeSetter(v8::Local<v8::Value> jsValue, co
nst v8::PropertyCallbackInfo<void>& info) |
| 146 { |
| 147 ExceptionState exceptionState(ExceptionState::SetterContext, "dirtySerialize
dValue", "TestSerializedScriptValueInterface", info.Holder(), info.GetIsolate())
; |
| 148 TestSerializedScriptValueInterface* imp = V8TestSerializedScriptValueInterfa
ce::toNative(info.Holder()); |
| 149 V8TRYCATCH_VOID(RefPtr<SerializedScriptValue>, cppValue, SerializedScriptVal
ue::create(jsValue, info.GetIsolate())); |
| 150 imp->setDirtySerializedValue(WTF::getPtr(cppValue)); |
| 151 info.Holder()->DeleteHiddenValue(v8::String::NewFromUtf8(info.GetIsolate(),
"dirtySerializedValue", v8::String::kInternalizedString)); // Invalidate the cac
hed value. |
| 152 } |
| 153 |
| 154 static void dirtySerializedValueAttributeSetterCallback(v8::Local<v8::String>, v
8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) |
| 155 { |
| 156 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); |
| 157 TestSerializedScriptValueInterfaceV8Internal::dirtySerializedValueAttributeS
etter(jsValue, info); |
| 158 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 159 } |
| 160 |
| 161 static void dirtyScriptValueAttributeGetter(const v8::PropertyCallbackInfo<v8::V
alue>& info) |
| 162 { |
| 163 v8::Handle<v8::String> propertyName = v8::String::NewFromUtf8(info.GetIsolat
e(), "dirtyScriptValue", v8::String::kInternalizedString); |
| 164 TestSerializedScriptValueInterface* imp = V8TestSerializedScriptValueInterfa
ce::toNative(info.Holder()); |
| 165 if (!imp->isValueDirty()) { |
| 166 v8::Handle<v8::Value> jsValue = info.Holder()->GetHiddenValue(propertyNa
me); |
| 167 if (!jsValue.IsEmpty()) { |
| 168 v8SetReturnValue(info, jsValue); |
| 169 return; |
| 170 } |
| 171 } |
| 172 ScriptValue jsValue = imp->dirtyScriptValue(); |
| 173 info.Holder()->SetHiddenValue(propertyName, jsValue.v8Value()); |
| 174 v8SetReturnValue(info, jsValue.v8Value()); |
| 175 } |
| 176 |
| 177 static void dirtyScriptValueAttributeGetterCallback(v8::Local<v8::String>, const
v8::PropertyCallbackInfo<v8::Value>& info) |
| 178 { |
| 179 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |
| 180 TestSerializedScriptValueInterfaceV8Internal::dirtyScriptValueAttributeGette
r(info); |
| 181 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 182 } |
| 183 |
| 184 static void dirtyScriptValueAttributeSetter(v8::Local<v8::Value> jsValue, const
v8::PropertyCallbackInfo<void>& info) |
| 185 { |
| 186 ExceptionState exceptionState(ExceptionState::SetterContext, "dirtyScriptVal
ue", "TestSerializedScriptValueInterface", info.Holder(), info.GetIsolate()); |
| 187 TestSerializedScriptValueInterface* imp = V8TestSerializedScriptValueInterfa
ce::toNative(info.Holder()); |
| 188 V8TRYCATCH_VOID(ScriptValue, cppValue, ScriptValue(jsValue, info.GetIsolate(
))); |
| 189 imp->setDirtyScriptValue(cppValue); |
| 190 info.Holder()->DeleteHiddenValue(v8::String::NewFromUtf8(info.GetIsolate(),
"dirtyScriptValue", v8::String::kInternalizedString)); // Invalidate the cached
value. |
| 191 } |
| 192 |
| 193 static void dirtyScriptValueAttributeSetterCallback(v8::Local<v8::String>, v8::L
ocal<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) |
| 194 { |
| 195 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); |
| 196 TestSerializedScriptValueInterfaceV8Internal::dirtyScriptValueAttributeSette
r(jsValue, info); |
| 197 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 198 } |
| 199 |
| 200 static void cachedValueCallWithAttributeGetter(const v8::PropertyCallbackInfo<v8
::Value>& info) |
| 201 { |
| 202 v8::Handle<v8::String> propertyName = v8::String::NewFromUtf8(info.GetIsolat
e(), "cachedValueCallWith", v8::String::kInternalizedString); |
| 203 TestSerializedScriptValueInterface* imp = V8TestSerializedScriptValueInterfa
ce::toNative(info.Holder()); |
| 204 if (!imp->isValueDirty()) { |
| 205 v8::Handle<v8::Value> jsValue = info.Holder()->GetHiddenValue(propertyNa
me); |
| 206 if (!jsValue.IsEmpty()) { |
| 207 v8SetReturnValue(info, jsValue); |
| 208 return; |
| 209 } |
| 210 } |
| 211 ScriptState* currentState = ScriptState::current(); |
| 212 if (!currentState) |
| 213 return v8Undefined(); |
| 214 ScriptState& state = *currentState; |
| 215 RefPtr<SerializedScriptValue> serialized = imp->cachedValueCallWith(&state); |
| 216 ScriptValue jsValue = serialized ? serialized->deserialize() : v8::Handle<v8
::Value>(v8::Null(info.GetIsolate())); |
| 217 info.Holder()->SetHiddenValue(propertyName, jsValue); |
| 218 v8SetReturnValue(info, jsValue); |
| 219 } |
| 220 |
| 221 static void cachedValueCallWithAttributeGetterCallback(v8::Local<v8::String>, co
nst v8::PropertyCallbackInfo<v8::Value>& info) |
| 222 { |
| 223 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |
| 224 TestSerializedScriptValueInterfaceV8Internal::cachedValueCallWithAttributeGe
tter(info); |
| 225 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 226 } |
| 227 |
| 228 static void cachedValueCallWithAttributeSetter(v8::Local<v8::Value> jsValue, con
st v8::PropertyCallbackInfo<void>& info) |
| 229 { |
| 230 ExceptionState exceptionState(ExceptionState::SetterContext, "cachedValueCal
lWith", "TestSerializedScriptValueInterface", info.Holder(), info.GetIsolate()); |
| 231 TestSerializedScriptValueInterface* imp = V8TestSerializedScriptValueInterfa
ce::toNative(info.Holder()); |
| 232 V8TRYCATCH_VOID(RefPtr<SerializedScriptValue>, cppValue, SerializedScriptVal
ue::create(jsValue, info.GetIsolate())); |
| 233 ScriptState* currentState = ScriptState::current(); |
| 234 if (!currentState) |
| 235 return; |
| 236 ScriptState& state = *currentState; |
| 237 imp->setCachedValueCallWith(&state, WTF::getPtr(cppValue)); |
| 238 if (state.hadException()) |
| 239 throwError(state.exception(), info.GetIsolate()); |
| 240 info.Holder()->DeleteHiddenValue(v8::String::NewFromUtf8(info.GetIsolate(),
"cachedValueCallWith", v8::String::kInternalizedString)); // Invalidate the cach
ed value. |
| 241 } |
| 242 |
| 243 static void cachedValueCallWithAttributeSetterCallback(v8::Local<v8::String>, v8
::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) |
| 244 { |
| 245 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); |
| 246 TestSerializedScriptValueInterfaceV8Internal::cachedValueCallWithAttributeSe
tter(jsValue, info); |
| 247 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 248 } |
| 249 |
| 250 } // namespace TestSerializedScriptValueInterfaceV8Internal |
| 251 |
| 252 static const V8DOMConfiguration::AttributeConfiguration V8TestSerializedScriptVa
lueInterfaceAttributes[] = { |
| 253 {"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 */}, |
| 254 {"readonlyValue", TestSerializedScriptValueInterfaceV8Internal::readonlyValu
eAttributeGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT
), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, |
| 255 {"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 */}, |
| 256 {"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 */}, |
| 257 {"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 */}, |
| 258 }; |
| 259 |
| 260 static v8::Handle<v8::FunctionTemplate> ConfigureV8TestSerializedScriptValueInte
rfaceTemplate(v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* is
olate, WrapperWorldType currentWorldType) |
| 261 { |
| 262 functionTemplate->ReadOnlyPrototype(); |
| 263 |
| 264 v8::Local<v8::Signature> defaultSignature; |
| 265 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestSerializedScriptValueInterface", v8::Local<v8::FunctionTemplate>(), V8
TestSerializedScriptValueInterface::internalFieldCount, |
| 266 V8TestSerializedScriptValueInterfaceAttributes, WTF_ARRAY_LENGTH(V8TestS
erializedScriptValueInterfaceAttributes), |
| 267 0, 0, |
| 268 0, 0, |
| 269 isolate, currentWorldType); |
| 270 UNUSED_PARAM(defaultSignature); |
| 271 v8::Local<v8::ObjectTemplate> instanceTemplate = functionTemplate->InstanceT
emplate(); |
| 272 v8::Local<v8::ObjectTemplate> prototypeTemplate = functionTemplate->Prototyp
eTemplate(); |
| 273 UNUSED_PARAM(instanceTemplate); |
| 274 UNUSED_PARAM(prototypeTemplate); |
| 275 |
| 276 // Custom toString template |
| 277 functionTemplate->Set(v8::String::NewFromUtf8(isolate, "toString", v8::Strin
g::kInternalizedString), V8PerIsolateData::current()->toStringTemplate()); |
| 278 return functionTemplate; |
| 279 } |
| 280 |
| 281 v8::Handle<v8::FunctionTemplate> V8TestSerializedScriptValueInterface::GetTempla
te(v8::Isolate* isolate, WrapperWorldType currentWorldType) |
| 282 { |
| 283 V8PerIsolateData* data = V8PerIsolateData::from(isolate); |
| 284 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&wrapperTypeInfo); |
| 285 if (result != data->templateMap(currentWorldType).end()) |
| 286 return result->value.newLocal(isolate); |
| 287 |
| 288 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); |
| 289 v8::EscapableHandleScope handleScope(isolate); |
| 290 v8::Local<v8::FunctionTemplate> templ = |
| 291 ConfigureV8TestSerializedScriptValueInterfaceTemplate(data->rawTemplate(
&wrapperTypeInfo, currentWorldType), isolate, currentWorldType); |
| 292 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); |
| 293 return handleScope.Escape(templ); |
| 294 } |
| 295 |
| 296 bool V8TestSerializedScriptValueInterface::hasInstance(v8::Handle<v8::Value> jsV
alue, v8::Isolate* isolate, WrapperWorldType currentWorldType) |
| 297 { |
| 298 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, currentWorldType); |
| 299 } |
| 300 |
| 301 bool V8TestSerializedScriptValueInterface::hasInstanceInAnyWorld(v8::Handle<v8::
Value> jsValue, v8::Isolate* isolate) |
| 302 { |
| 303 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, MainWorld) |
| 304 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, IsolatedWorld) |
| 305 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, WorkerWorld); |
| 306 } |
| 307 |
| 308 v8::Handle<v8::Object> V8TestSerializedScriptValueInterface::createWrapper(PassR
efPtr<TestSerializedScriptValueInterface> impl, v8::Handle<v8::Object> creationC
ontext, v8::Isolate* isolate) |
| 309 { |
| 310 ASSERT(impl); |
| 311 ASSERT(!DOMDataStore::containsWrapper<V8TestSerializedScriptValueInterface>(
impl.get(), isolate)); |
| 312 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { |
| 313 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje
ct(impl.get()); |
| 314 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper
TypeInfo. These will both have |
| 315 // the same object de-ref functions, though, so use that as the basis of
the check. |
| 316 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction
== wrapperTypeInfo.derefObjectFunction); |
| 317 } |
| 318 |
| 319 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext
, &wrapperTypeInfo, toInternalPointer(impl.get()), isolate); |
| 320 if (UNLIKELY(wrapper.IsEmpty())) |
| 321 return wrapper; |
| 322 |
| 323 installPerContextEnabledProperties(wrapper, impl.get(), isolate); |
| 324 V8DOMWrapper::associateObjectWithWrapper<V8TestSerializedScriptValueInterfac
e>(impl, &wrapperTypeInfo, wrapper, isolate, WrapperConfiguration::Independent); |
| 325 return wrapper; |
| 326 } |
| 327 |
| 328 void V8TestSerializedScriptValueInterface::derefObject(void* object) |
| 329 { |
| 330 fromInternalPointer(object)->deref(); |
| 331 } |
| 332 |
| 333 template<> |
| 334 v8::Handle<v8::Value> toV8NoInline(TestSerializedScriptValueInterface* impl, v8:
:Handle<v8::Object> creationContext, v8::Isolate* isolate) |
| 335 { |
| 336 return toV8(impl, creationContext, isolate); |
| 337 } |
| 338 |
| 339 } // namespace WebCore |
| 340 #endif // ENABLE(Condition1) || ENABLE(Condition2) |
OLD | NEW |