| 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 // In ScriptWrappable::init, the use of a local function declaration has an issu
e on Windows: | 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 | 65 // the local declaration does not pick up the surrounding namespace. Therefore,
we provide this function |
| 66 // in the global namespace. | 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) | 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::TestInterfaceEventCon
structor* object) | 68 void webCoreInitializeScriptWrappableForInterface(WebCore::TestInterfaceEventCon
structor* object) |
| 69 { | 69 { |
| 70 WebCore::initializeScriptWrappableForInterface(object); | 70 WebCore::initializeScriptWrappableForInterface(object); |
| 71 } | 71 } |
| 72 | 72 |
| 73 namespace WebCore { | 73 namespace WebCore { |
| 74 const WrapperTypeInfo V8TestInterfaceEventConstructor::wrapperTypeInfo = { gin::
kEmbedderBlink, V8TestInterfaceEventConstructor::domTemplate, V8TestInterfaceEve
ntConstructor::derefObject, 0, 0, 0, V8TestInterfaceEventConstructor::installPer
ContextEnabledMethods, &V8Event::wrapperTypeInfo, WrapperTypeObjectPrototype, fa
lse }; | 74 const WrapperTypeInfo V8TestInterfaceEventConstructor::wrapperTypeInfo = { gin::
kEmbedderBlink, V8TestInterfaceEventConstructor::domTemplate, V8TestInterfaceEve
ntConstructor::derefObject, 0, 0, 0, V8TestInterfaceEventConstructor::installPer
ContextEnabledMethods, &V8Event::wrapperTypeInfo, WrapperTypeObjectPrototype, tr
ue }; |
| 75 | 75 |
| 76 namespace TestInterfaceEventConstructorV8Internal { | 76 namespace TestInterfaceEventConstructorV8Internal { |
| 77 | 77 |
| 78 template <typename T> void V8_USE(T) { } | 78 template <typename T> void V8_USE(T) { } |
| 79 | 79 |
| 80 static void readonlyStringAttributeAttributeGetter(const v8::PropertyCallbackInf
o<v8::Value>& info) | 80 static void readonlyStringAttributeAttributeGetter(const v8::PropertyCallbackInf
o<v8::Value>& info) |
| 81 { | 81 { |
| 82 TestInterfaceEventConstructor* imp = V8TestInterfaceEventConstructor::toNati
ve(info.Holder()); | 82 TestInterfaceEventConstructor* imp = V8TestInterfaceEventConstructor::toNati
ve(info.Holder()); |
| 83 v8SetReturnValueString(info, imp->readonlyStringAttribute(), info.GetIsolate
()); | 83 v8SetReturnValueString(info, imp->readonlyStringAttribute(), info.GetIsolate
()); |
| 84 } | 84 } |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 if (info.Length() >= 2) { | 277 if (info.Length() >= 2) { |
| 278 V8TRYCATCH_VOID(Dictionary, options, Dictionary(info[1], info.GetIsolate
())); | 278 V8TRYCATCH_VOID(Dictionary, options, Dictionary(info[1], info.GetIsolate
())); |
| 279 if (!initializeTestInterfaceEventConstructor(eventInit, options, excepti
onState, info)) { | 279 if (!initializeTestInterfaceEventConstructor(eventInit, options, excepti
onState, info)) { |
| 280 exceptionState.throwIfNeeded(); | 280 exceptionState.throwIfNeeded(); |
| 281 return; | 281 return; |
| 282 } | 282 } |
| 283 options.get("initializedByEventConstructorReadonlyAnyAttribute", initial
izedByEventConstructorReadonlyAnyAttribute); | 283 options.get("initializedByEventConstructorReadonlyAnyAttribute", initial
izedByEventConstructorReadonlyAnyAttribute); |
| 284 if (!initializedByEventConstructorReadonlyAnyAttribute.IsEmpty()) | 284 if (!initializedByEventConstructorReadonlyAnyAttribute.IsEmpty()) |
| 285 setHiddenValue(info.GetIsolate(), info.Holder(), "initializedByEvent
ConstructorReadonlyAnyAttribute", initializedByEventConstructorReadonlyAnyAttrib
ute); | 285 setHiddenValue(info.GetIsolate(), info.Holder(), "initializedByEvent
ConstructorReadonlyAnyAttribute", initializedByEventConstructorReadonlyAnyAttrib
ute); |
| 286 } | 286 } |
| 287 RefPtr<TestInterfaceEventConstructor> event = TestInterfaceEventConstructor:
:create(type, eventInit, exceptionState); | 287 RefPtrWillBeRawPtr<TestInterfaceEventConstructor> event = TestInterfaceEvent
Constructor::create(type, eventInit, exceptionState); |
| 288 if (exceptionState.throwIfNeeded()) | 288 if (exceptionState.throwIfNeeded()) |
| 289 return; | 289 return; |
| 290 if (DOMWrapperWorld::current(info.GetIsolate())->isIsolatedWorld()) { | 290 if (DOMWrapperWorld::current(info.GetIsolate())->isIsolatedWorld()) { |
| 291 if (!initializedByEventConstructorReadonlyAnyAttribute.IsEmpty()) | 291 if (!initializedByEventConstructorReadonlyAnyAttribute.IsEmpty()) |
| 292 event->setSerializedInitializedByEventConstructorReadonlyAnyAttribut
e(SerializedScriptValue::createAndSwallowExceptions(initializedByEventConstructo
rReadonlyAnyAttribute, info.GetIsolate())); | 292 event->setSerializedInitializedByEventConstructorReadonlyAnyAttribut
e(SerializedScriptValue::createAndSwallowExceptions(initializedByEventConstructo
rReadonlyAnyAttribute, info.GetIsolate())); |
| 293 } | 293 } |
| 294 | 294 |
| 295 v8::Handle<v8::Object> wrapper = info.Holder(); | 295 v8::Handle<v8::Object> wrapper = info.Holder(); |
| 296 V8DOMWrapper::associateObjectWithWrapper<V8TestInterfaceEventConstructor>(ev
ent.release(), &V8TestInterfaceEventConstructor::wrapperTypeInfo, wrapper, info.
GetIsolate(), WrapperConfiguration::Dependent); | 296 V8DOMWrapper::associateObjectWithWrapper<V8TestInterfaceEventConstructor>(ev
ent.release(), &V8TestInterfaceEventConstructor::wrapperTypeInfo, wrapper, info.
GetIsolate(), WrapperConfiguration::Dependent); |
| 297 v8SetReturnValue(info, wrapper); | 297 v8SetReturnValue(info, wrapper); |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 408 v8::Handle<v8::Object> V8TestInterfaceEventConstructor::findInstanceInPrototypeC
hain(v8::Handle<v8::Value> jsValue, v8::Isolate* isolate) | 408 v8::Handle<v8::Object> V8TestInterfaceEventConstructor::findInstanceInPrototypeC
hain(v8::Handle<v8::Value> jsValue, v8::Isolate* isolate) |
| 409 { | 409 { |
| 410 return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrappe
rTypeInfo, jsValue); | 410 return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrappe
rTypeInfo, jsValue); |
| 411 } | 411 } |
| 412 | 412 |
| 413 TestInterfaceEventConstructor* V8TestInterfaceEventConstructor::toNativeWithType
Check(v8::Isolate* isolate, v8::Handle<v8::Value> value) | 413 TestInterfaceEventConstructor* V8TestInterfaceEventConstructor::toNativeWithType
Check(v8::Isolate* isolate, v8::Handle<v8::Value> value) |
| 414 { | 414 { |
| 415 return hasInstance(value, isolate) ? fromInternalPointer(v8::Handle<v8::Obje
ct>::Cast(value)->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex)) :
0; | 415 return hasInstance(value, isolate) ? fromInternalPointer(v8::Handle<v8::Obje
ct>::Cast(value)->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex)) :
0; |
| 416 } | 416 } |
| 417 | 417 |
| 418 v8::Handle<v8::Object> V8TestInterfaceEventConstructor::createWrapper(PassRefPtr
<TestInterfaceEventConstructor> impl, v8::Handle<v8::Object> creationContext, v8
::Isolate* isolate) | 418 v8::Handle<v8::Object> V8TestInterfaceEventConstructor::createWrapper(PassRefPtr
WillBeRawPtr<TestInterfaceEventConstructor> impl, v8::Handle<v8::Object> creatio
nContext, v8::Isolate* isolate) |
| 419 { | 419 { |
| 420 ASSERT(impl); | 420 ASSERT(impl); |
| 421 ASSERT(!DOMDataStore::containsWrapper<V8TestInterfaceEventConstructor>(impl.
get(), isolate)); | 421 ASSERT(!DOMDataStore::containsWrapper<V8TestInterfaceEventConstructor>(impl.
get(), isolate)); |
| 422 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { | 422 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { |
| 423 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje
ct(impl.get()); | 423 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje
ct(impl.get()); |
| 424 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper
TypeInfo. These will both have | 424 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper
TypeInfo. These will both have |
| 425 // the same object de-ref functions, though, so use that as the basis of
the check. | 425 // the same object de-ref functions, though, so use that as the basis of
the check. |
| 426 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction
== wrapperTypeInfo.derefObjectFunction); | 426 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction
== wrapperTypeInfo.derefObjectFunction); |
| 427 } | 427 } |
| 428 | 428 |
| 429 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext
, &wrapperTypeInfo, toInternalPointer(impl.get()), isolate); | 429 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext
, &wrapperTypeInfo, toInternalPointer(impl.get()), isolate); |
| 430 if (UNLIKELY(wrapper.IsEmpty())) | 430 if (UNLIKELY(wrapper.IsEmpty())) |
| 431 return wrapper; | 431 return wrapper; |
| 432 | 432 |
| 433 installPerContextEnabledProperties(wrapper, impl.get(), isolate); | 433 installPerContextEnabledProperties(wrapper, impl.get(), isolate); |
| 434 V8DOMWrapper::associateObjectWithWrapper<V8TestInterfaceEventConstructor>(im
pl, &wrapperTypeInfo, wrapper, isolate, WrapperConfiguration::Independent); | 434 V8DOMWrapper::associateObjectWithWrapper<V8TestInterfaceEventConstructor>(im
pl, &wrapperTypeInfo, wrapper, isolate, WrapperConfiguration::Independent); |
| 435 return wrapper; | 435 return wrapper; |
| 436 } | 436 } |
| 437 | 437 |
| 438 void V8TestInterfaceEventConstructor::derefObject(void* object) | 438 void V8TestInterfaceEventConstructor::derefObject(void* object) |
| 439 { | 439 { |
| 440 #if !ENABLE(OILPAN) |
| 440 fromInternalPointer(object)->deref(); | 441 fromInternalPointer(object)->deref(); |
| 442 #endif // !ENABLE(OILPAN) |
| 441 } | 443 } |
| 442 | 444 |
| 443 template<> | 445 template<> |
| 444 v8::Handle<v8::Value> toV8NoInline(TestInterfaceEventConstructor* impl, v8::Hand
le<v8::Object> creationContext, v8::Isolate* isolate) | 446 v8::Handle<v8::Value> toV8NoInline(TestInterfaceEventConstructor* impl, v8::Hand
le<v8::Object> creationContext, v8::Isolate* isolate) |
| 445 { | 447 { |
| 446 return toV8(impl, creationContext, isolate); | 448 return toV8(impl, creationContext, isolate); |
| 447 } | 449 } |
| 448 | 450 |
| 449 } // namespace WebCore | 451 } // namespace WebCore |
| OLD | NEW |