| 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 "V8TestInterfaceGarbageCollected.h" | 34 #include "V8TestInterfaceWillBeGarbageCollected.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 #include "wtf/GetPtr.h" | 43 #include "wtf/GetPtr.h" |
| 44 #include "wtf/RefPtr.h" | 44 #include "wtf/RefPtr.h" |
| 45 | 45 |
| 46 namespace WebCore { | 46 namespace WebCore { |
| 47 | 47 |
| 48 static void initializeScriptWrappableForInterface(TestInterfaceGarbageCollected*
object) | 48 static void initializeScriptWrappableForInterface(TestInterfaceWillBeGarbageColl
ected* object) |
| 49 { | 49 { |
| 50 if (ScriptWrappable::wrapperCanBeStoredInObject(object)) | 50 if (ScriptWrappable::wrapperCanBeStoredInObject(object)) |
| 51 ScriptWrappable::setTypeInfoInObject(object, &V8TestInterfaceGarbageColl
ected::wrapperTypeInfo); | 51 ScriptWrappable::setTypeInfoInObject(object, &V8TestInterfaceWillBeGarba
geCollected::wrapperTypeInfo); |
| 52 else | 52 else |
| 53 ASSERT_NOT_REACHED(); | 53 ASSERT_NOT_REACHED(); |
| 54 } | 54 } |
| 55 | 55 |
| 56 } // namespace WebCore | 56 } // namespace WebCore |
| 57 | 57 |
| 58 // In ScriptWrappable::init, the use of a local function declaration has an issu
e on Windows: | 58 // In ScriptWrappable::init, the use of a local function declaration has an issu
e on Windows: |
| 59 // the local declaration does not pick up the surrounding namespace. Therefore,
we provide this function | 59 // the local declaration does not pick up the surrounding namespace. Therefore,
we provide this function |
| 60 // in the global namespace. | 60 // in the global namespace. |
| 61 // (More info on the MSVC bug here: http://connect.microsoft.com/VisualStudio/fe
edback/details/664619/the-namespace-of-local-function-declarations-in-c) | 61 // (More info on the MSVC bug here: http://connect.microsoft.com/VisualStudio/fe
edback/details/664619/the-namespace-of-local-function-declarations-in-c) |
| 62 void webCoreInitializeScriptWrappableForInterface(WebCore::TestInterfaceGarbageC
ollected* object) | 62 void webCoreInitializeScriptWrappableForInterface(WebCore::TestInterfaceWillBeGa
rbageCollected* object) |
| 63 { | 63 { |
| 64 WebCore::initializeScriptWrappableForInterface(object); | 64 WebCore::initializeScriptWrappableForInterface(object); |
| 65 } | 65 } |
| 66 | 66 |
| 67 namespace WebCore { | 67 namespace WebCore { |
| 68 const WrapperTypeInfo V8TestInterfaceGarbageCollected::wrapperTypeInfo = { gin::
kEmbedderBlink, V8TestInterfaceGarbageCollected::domTemplate, V8TestInterfaceGar
bageCollected::derefObject, 0, 0, 0, V8TestInterfaceGarbageCollected::installPer
ContextEnabledMethods, 0, WrapperTypeObjectPrototype, true }; | 68 const WrapperTypeInfo V8TestInterfaceWillBeGarbageCollected::wrapperTypeInfo = {
gin::kEmbedderBlink, V8TestInterfaceWillBeGarbageCollected::domTemplate, V8Test
InterfaceWillBeGarbageCollected::derefObject, 0, 0, 0, V8TestInterfaceWillBeGarb
ageCollected::installPerContextEnabledMethods, 0, WrapperTypeObjectPrototype, tr
ue }; |
| 69 | 69 |
| 70 namespace TestInterfaceGarbageCollectedV8Internal { | 70 namespace TestInterfaceWillBeGarbageCollectedV8Internal { |
| 71 | 71 |
| 72 template <typename T> void V8_USE(T) { } | 72 template <typename T> void V8_USE(T) { } |
| 73 | 73 |
| 74 static void attr1AttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info
) | 74 static void attr1AttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info
) |
| 75 { | 75 { |
| 76 TestInterfaceGarbageCollected* imp = V8TestInterfaceGarbageCollected::toNati
ve(info.Holder()); | 76 TestInterfaceWillBeGarbageCollected* imp = V8TestInterfaceWillBeGarbageColle
cted::toNative(info.Holder()); |
| 77 v8SetReturnValueFast(info, imp->attr1(), imp); | 77 v8SetReturnValueFast(info, imp->attr1(), imp); |
| 78 } | 78 } |
| 79 | 79 |
| 80 static void attr1AttributeGetterCallback(v8::Local<v8::String>, const v8::Proper
tyCallbackInfo<v8::Value>& info) | 80 static void attr1AttributeGetterCallback(v8::Local<v8::String>, const v8::Proper
tyCallbackInfo<v8::Value>& info) |
| 81 { | 81 { |
| 82 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); | 82 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |
| 83 TestInterfaceGarbageCollectedV8Internal::attr1AttributeGetter(info); | 83 TestInterfaceWillBeGarbageCollectedV8Internal::attr1AttributeGetter(info); |
| 84 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 84 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
| 85 } | 85 } |
| 86 | 86 |
| 87 static void attr1AttributeSetter(v8::Local<v8::Value> jsValue, const v8::Propert
yCallbackInfo<void>& info) | 87 static void attr1AttributeSetter(v8::Local<v8::Value> jsValue, const v8::Propert
yCallbackInfo<void>& info) |
| 88 { | 88 { |
| 89 TestInterfaceGarbageCollected* imp = V8TestInterfaceGarbageCollected::toNati
ve(info.Holder()); | 89 TestInterfaceWillBeGarbageCollected* imp = V8TestInterfaceWillBeGarbageColle
cted::toNative(info.Holder()); |
| 90 V8TRYCATCH_VOID(TestInterfaceGarbageCollected*, cppValue, V8TestInterfaceGar
bageCollected::hasInstance(jsValue, info.GetIsolate()) ? V8TestInterfaceGarbageC
ollected::toNative(v8::Handle<v8::Object>::Cast(jsValue)) : 0); | 90 V8TRYCATCH_VOID(TestInterfaceWillBeGarbageCollected*, cppValue, V8TestInterf
aceWillBeGarbageCollected::hasInstance(jsValue, info.GetIsolate()) ? V8TestInter
faceWillBeGarbageCollected::toNative(v8::Handle<v8::Object>::Cast(jsValue)) : 0)
; |
| 91 imp->setAttr1(WTF::getPtr(cppValue)); | 91 imp->setAttr1(WTF::getPtr(cppValue)); |
| 92 } | 92 } |
| 93 | 93 |
| 94 static void attr1AttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Va
lue> jsValue, const v8::PropertyCallbackInfo<void>& info) | 94 static void attr1AttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Va
lue> jsValue, const v8::PropertyCallbackInfo<void>& info) |
| 95 { | 95 { |
| 96 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); | 96 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); |
| 97 TestInterfaceGarbageCollectedV8Internal::attr1AttributeSetter(jsValue, info)
; | 97 TestInterfaceWillBeGarbageCollectedV8Internal::attr1AttributeSetter(jsValue,
info); |
| 98 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 98 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
| 99 } | 99 } |
| 100 | 100 |
| 101 static void funcMethod(const v8::FunctionCallbackInfo<v8::Value>& info) | 101 static void funcMethod(const v8::FunctionCallbackInfo<v8::Value>& info) |
| 102 { | 102 { |
| 103 if (UNLIKELY(info.Length() < 1)) { | 103 if (UNLIKELY(info.Length() < 1)) { |
| 104 throwTypeError(ExceptionMessages::failedToExecute("func", "TestInterface
GarbageCollected", ExceptionMessages::notEnoughArguments(1, info.Length())), inf
o.GetIsolate()); | 104 throwTypeError(ExceptionMessages::failedToExecute("func", "TestInterface
WillBeGarbageCollected", ExceptionMessages::notEnoughArguments(1, info.Length())
), info.GetIsolate()); |
| 105 return; | 105 return; |
| 106 } | 106 } |
| 107 TestInterfaceGarbageCollected* imp = V8TestInterfaceGarbageCollected::toNati
ve(info.Holder()); | 107 TestInterfaceWillBeGarbageCollected* imp = V8TestInterfaceWillBeGarbageColle
cted::toNative(info.Holder()); |
| 108 V8TRYCATCH_VOID(TestInterfaceGarbageCollected*, arg, V8TestInterfaceGarbageC
ollected::hasInstance(info[0], info.GetIsolate()) ? V8TestInterfaceGarbageCollec
ted::toNative(v8::Handle<v8::Object>::Cast(info[0])) : 0); | 108 V8TRYCATCH_VOID(TestInterfaceWillBeGarbageCollected*, arg, V8TestInterfaceWi
llBeGarbageCollected::hasInstance(info[0], info.GetIsolate()) ? V8TestInterfaceW
illBeGarbageCollected::toNative(v8::Handle<v8::Object>::Cast(info[0])) : 0); |
| 109 imp->func(arg); | 109 imp->func(arg); |
| 110 } | 110 } |
| 111 | 111 |
| 112 static void funcMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) | 112 static void funcMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
| 113 { | 113 { |
| 114 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); | 114 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |
| 115 TestInterfaceGarbageCollectedV8Internal::funcMethod(info); | 115 TestInterfaceWillBeGarbageCollectedV8Internal::funcMethod(info); |
| 116 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 116 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
| 117 } | 117 } |
| 118 | 118 |
| 119 static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info) | 119 static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info) |
| 120 { | 120 { |
| 121 if (UNLIKELY(info.Length() < 1)) { | 121 if (UNLIKELY(info.Length() < 1)) { |
| 122 throwTypeError(ExceptionMessages::failedToConstruct("TestInterfaceGarbag
eCollected", ExceptionMessages::notEnoughArguments(1, info.Length())), info.GetI
solate()); | 122 throwTypeError(ExceptionMessages::failedToConstruct("TestInterfaceWillBe
GarbageCollected", ExceptionMessages::notEnoughArguments(1, info.Length())), inf
o.GetIsolate()); |
| 123 return; | 123 return; |
| 124 } | 124 } |
| 125 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, str, info[0]); | 125 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, str, info[0]); |
| 126 RefPtrWillBeRawPtr<TestInterfaceGarbageCollected> impl = TestInterfaceGarbag
eCollected::create(str); | 126 RefPtrWillBeRawPtr<TestInterfaceWillBeGarbageCollected> impl = TestInterface
WillBeGarbageCollected::create(str); |
| 127 v8::Handle<v8::Object> wrapper = info.Holder(); | 127 v8::Handle<v8::Object> wrapper = info.Holder(); |
| 128 | 128 |
| 129 V8DOMWrapper::associateObjectWithWrapper<V8TestInterfaceGarbageCollected>(im
pl.release(), &V8TestInterfaceGarbageCollected::wrapperTypeInfo, wrapper, info.G
etIsolate(), WrapperConfiguration::Dependent); | 129 V8DOMWrapper::associateObjectWithWrapper<V8TestInterfaceWillBeGarbageCollect
ed>(impl.release(), &V8TestInterfaceWillBeGarbageCollected::wrapperTypeInfo, wra
pper, info.GetIsolate(), WrapperConfiguration::Dependent); |
| 130 v8SetReturnValue(info, wrapper); | 130 v8SetReturnValue(info, wrapper); |
| 131 } | 131 } |
| 132 | 132 |
| 133 } // namespace TestInterfaceGarbageCollectedV8Internal | 133 } // namespace TestInterfaceWillBeGarbageCollectedV8Internal |
| 134 | 134 |
| 135 static const V8DOMConfiguration::AttributeConfiguration V8TestInterfaceGarbageCo
llectedAttributes[] = { | 135 static const V8DOMConfiguration::AttributeConfiguration V8TestInterfaceWillBeGar
bageCollectedAttributes[] = { |
| 136 {"attr1", TestInterfaceGarbageCollectedV8Internal::attr1AttributeGetterCallb
ack, TestInterfaceGarbageCollectedV8Internal::attr1AttributeSetterCallback, 0, 0
, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttrib
ute>(v8::None), 0 /* on instance */}, | 136 {"attr1", TestInterfaceWillBeGarbageCollectedV8Internal::attr1AttributeGette
rCallback, TestInterfaceWillBeGarbageCollectedV8Internal::attr1AttributeSetterCa
llback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::Pr
opertyAttribute>(v8::None), 0 /* on instance */}, |
| 137 }; | 137 }; |
| 138 | 138 |
| 139 static const V8DOMConfiguration::MethodConfiguration V8TestInterfaceGarbageColle
ctedMethods[] = { | 139 static const V8DOMConfiguration::MethodConfiguration V8TestInterfaceWillBeGarbag
eCollectedMethods[] = { |
| 140 {"func", TestInterfaceGarbageCollectedV8Internal::funcMethodCallback, 0, 1}, | 140 {"func", TestInterfaceWillBeGarbageCollectedV8Internal::funcMethodCallback,
0, 1}, |
| 141 }; | 141 }; |
| 142 | 142 |
| 143 void V8TestInterfaceGarbageCollected::constructorCallback(const v8::FunctionCall
backInfo<v8::Value>& info) | 143 void V8TestInterfaceWillBeGarbageCollected::constructorCallback(const v8::Functi
onCallbackInfo<v8::Value>& info) |
| 144 { | 144 { |
| 145 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "DOMConstructor"); | 145 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "DOMConstructor"); |
| 146 if (!info.IsConstructCall()) { | 146 if (!info.IsConstructCall()) { |
| 147 throwTypeError(ExceptionMessages::failedToConstruct("TestInterfaceGarbag
eCollected", "Please use the 'new' operator, this DOM object constructor cannot
be called as a function."), info.GetIsolate()); | 147 throwTypeError(ExceptionMessages::failedToConstruct("TestInterfaceWillBe
GarbageCollected", "Please use the 'new' operator, this DOM object constructor c
annot be called as a function."), info.GetIsolate()); |
| 148 return; | 148 return; |
| 149 } | 149 } |
| 150 | 150 |
| 151 if (ConstructorMode::current() == ConstructorMode::WrapExistingObject) { | 151 if (ConstructorMode::current() == ConstructorMode::WrapExistingObject) { |
| 152 v8SetReturnValue(info, info.Holder()); | 152 v8SetReturnValue(info, info.Holder()); |
| 153 return; | 153 return; |
| 154 } | 154 } |
| 155 | 155 |
| 156 TestInterfaceGarbageCollectedV8Internal::constructor(info); | 156 TestInterfaceWillBeGarbageCollectedV8Internal::constructor(info); |
| 157 } | 157 } |
| 158 | 158 |
| 159 static void configureV8TestInterfaceGarbageCollectedTemplate(v8::Handle<v8::Func
tionTemplate> functionTemplate, v8::Isolate* isolate, WrapperWorldType currentWo
rldType) | 159 static void configureV8TestInterfaceWillBeGarbageCollectedTemplate(v8::Handle<v8
::FunctionTemplate> functionTemplate, v8::Isolate* isolate, WrapperWorldType cur
rentWorldType) |
| 160 { | 160 { |
| 161 functionTemplate->ReadOnlyPrototype(); | 161 functionTemplate->ReadOnlyPrototype(); |
| 162 | 162 |
| 163 v8::Local<v8::Signature> defaultSignature; | 163 v8::Local<v8::Signature> defaultSignature; |
| 164 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestInterfaceGarbageCollected", v8::Local<v8::FunctionTemplate>(), V8TestI
nterfaceGarbageCollected::internalFieldCount, | 164 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestInterfaceWillBeGarbageCollected", v8::Local<v8::FunctionTemplate>(), V
8TestInterfaceWillBeGarbageCollected::internalFieldCount, |
| 165 V8TestInterfaceGarbageCollectedAttributes, WTF_ARRAY_LENGTH(V8TestInterf
aceGarbageCollectedAttributes), | 165 V8TestInterfaceWillBeGarbageCollectedAttributes, WTF_ARRAY_LENGTH(V8Test
InterfaceWillBeGarbageCollectedAttributes), |
| 166 0, 0, | 166 0, 0, |
| 167 V8TestInterfaceGarbageCollectedMethods, WTF_ARRAY_LENGTH(V8TestInterface
GarbageCollectedMethods), | 167 V8TestInterfaceWillBeGarbageCollectedMethods, WTF_ARRAY_LENGTH(V8TestInt
erfaceWillBeGarbageCollectedMethods), |
| 168 isolate, currentWorldType); | 168 isolate, currentWorldType); |
| 169 functionTemplate->SetCallHandler(V8TestInterfaceGarbageCollected::constructo
rCallback); | 169 functionTemplate->SetCallHandler(V8TestInterfaceWillBeGarbageCollected::cons
tructorCallback); |
| 170 functionTemplate->SetLength(1); | 170 functionTemplate->SetLength(1); |
| 171 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla
te->InstanceTemplate(); | 171 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla
te->InstanceTemplate(); |
| 172 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTempl
ate->PrototypeTemplate(); | 172 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTempl
ate->PrototypeTemplate(); |
| 173 | 173 |
| 174 // Custom toString template | 174 // Custom toString template |
| 175 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData:
:current()->toStringTemplate()); | 175 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData:
:current()->toStringTemplate()); |
| 176 } | 176 } |
| 177 | 177 |
| 178 v8::Handle<v8::FunctionTemplate> V8TestInterfaceGarbageCollected::domTemplate(v8
::Isolate* isolate, WrapperWorldType currentWorldType) | 178 v8::Handle<v8::FunctionTemplate> V8TestInterfaceWillBeGarbageCollected::domTempl
ate(v8::Isolate* isolate, WrapperWorldType currentWorldType) |
| 179 { | 179 { |
| 180 V8PerIsolateData* data = V8PerIsolateData::from(isolate); | 180 V8PerIsolateData* data = V8PerIsolateData::from(isolate); |
| 181 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&wrapperTypeInfo); | 181 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&wrapperTypeInfo); |
| 182 if (result != data->templateMap(currentWorldType).end()) | 182 if (result != data->templateMap(currentWorldType).end()) |
| 183 return result->value.newLocal(isolate); | 183 return result->value.newLocal(isolate); |
| 184 | 184 |
| 185 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); | 185 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); |
| 186 v8::EscapableHandleScope handleScope(isolate); | 186 v8::EscapableHandleScope handleScope(isolate); |
| 187 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate, V
8ObjectConstructor::isValidConstructorMode); | 187 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate, V
8ObjectConstructor::isValidConstructorMode); |
| 188 configureV8TestInterfaceGarbageCollectedTemplate(templ, isolate, currentWorl
dType); | 188 configureV8TestInterfaceWillBeGarbageCollectedTemplate(templ, isolate, curre
ntWorldType); |
| 189 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); | 189 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); |
| 190 return handleScope.Escape(templ); | 190 return handleScope.Escape(templ); |
| 191 } | 191 } |
| 192 | 192 |
| 193 bool V8TestInterfaceGarbageCollected::hasInstance(v8::Handle<v8::Value> jsValue,
v8::Isolate* isolate) | 193 bool V8TestInterfaceWillBeGarbageCollected::hasInstance(v8::Handle<v8::Value> js
Value, v8::Isolate* isolate) |
| 194 { | 194 { |
| 195 return V8PerIsolateData::from(isolate)->hasInstanceInMainWorld(&wrapperTypeI
nfo, jsValue) | 195 return V8PerIsolateData::from(isolate)->hasInstanceInMainWorld(&wrapperTypeI
nfo, jsValue) |
| 196 || V8PerIsolateData::from(isolate)->hasInstanceInNonMainWorld(&wrapperTy
peInfo, jsValue); | 196 || V8PerIsolateData::from(isolate)->hasInstanceInNonMainWorld(&wrapperTy
peInfo, jsValue); |
| 197 } | 197 } |
| 198 | 198 |
| 199 v8::Handle<v8::Object> V8TestInterfaceGarbageCollected::createWrapper(PassRefPtr
WillBeRawPtr<TestInterfaceGarbageCollected> impl, v8::Handle<v8::Object> creatio
nContext, v8::Isolate* isolate) | 199 v8::Handle<v8::Object> V8TestInterfaceWillBeGarbageCollected::createWrapper(Pass
RefPtrWillBeRawPtr<TestInterfaceWillBeGarbageCollected> impl, v8::Handle<v8::Obj
ect> creationContext, v8::Isolate* isolate) |
| 200 { | 200 { |
| 201 ASSERT(impl); | 201 ASSERT(impl); |
| 202 ASSERT(!DOMDataStore::containsWrapper<V8TestInterfaceGarbageCollected>(impl.
get(), isolate)); | 202 ASSERT(!DOMDataStore::containsWrapper<V8TestInterfaceWillBeGarbageCollected>
(impl.get(), isolate)); |
| 203 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { | 203 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { |
| 204 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje
ct(impl.get()); | 204 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje
ct(impl.get()); |
| 205 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper
TypeInfo. These will both have | 205 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper
TypeInfo. These will both have |
| 206 // the same object de-ref functions, though, so use that as the basis of
the check. | 206 // the same object de-ref functions, though, so use that as the basis of
the check. |
| 207 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction
== wrapperTypeInfo.derefObjectFunction); | 207 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction
== wrapperTypeInfo.derefObjectFunction); |
| 208 } | 208 } |
| 209 | 209 |
| 210 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext
, &wrapperTypeInfo, toInternalPointer(impl.get()), isolate); | 210 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext
, &wrapperTypeInfo, toInternalPointer(impl.get()), isolate); |
| 211 if (UNLIKELY(wrapper.IsEmpty())) | 211 if (UNLIKELY(wrapper.IsEmpty())) |
| 212 return wrapper; | 212 return wrapper; |
| 213 | 213 |
| 214 installPerContextEnabledProperties(wrapper, impl.get(), isolate); | 214 installPerContextEnabledProperties(wrapper, impl.get(), isolate); |
| 215 V8DOMWrapper::associateObjectWithWrapper<V8TestInterfaceGarbageCollected>(im
pl, &wrapperTypeInfo, wrapper, isolate, WrapperConfiguration::Independent); | 215 V8DOMWrapper::associateObjectWithWrapper<V8TestInterfaceWillBeGarbageCollect
ed>(impl, &wrapperTypeInfo, wrapper, isolate, WrapperConfiguration::Independent)
; |
| 216 return wrapper; | 216 return wrapper; |
| 217 } | 217 } |
| 218 | 218 |
| 219 void V8TestInterfaceGarbageCollected::derefObject(void* object) | 219 void V8TestInterfaceWillBeGarbageCollected::derefObject(void* object) |
| 220 { | 220 { |
| 221 fromInternalPointer(object)->deref(); | 221 fromInternalPointer(object)->deref(); |
| 222 } | 222 } |
| 223 | 223 |
| 224 template<> | 224 template<> |
| 225 v8::Handle<v8::Value> toV8NoInline(TestInterfaceGarbageCollected* impl, v8::Hand
le<v8::Object> creationContext, v8::Isolate* isolate) | 225 v8::Handle<v8::Value> toV8NoInline(TestInterfaceWillBeGarbageCollected* impl, v8
::Handle<v8::Object> creationContext, v8::Isolate* isolate) |
| 226 { | 226 { |
| 227 return toV8(impl, creationContext, isolate); | 227 return toV8(impl, creationContext, isolate); |
| 228 } | 228 } |
| 229 | 229 |
| 230 } // namespace WebCore | 230 } // namespace WebCore |
| OLD | NEW |