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 "V8TestDoNotCheckConstantsInterface.h" | 34 #include "V8TestInterfaceDoNotCheckConstants.h" |
35 | 35 |
36 #include "RuntimeEnabledFeatures.h" | 36 #include "RuntimeEnabledFeatures.h" |
37 #include "bindings/v8/ScriptController.h" | 37 #include "bindings/v8/ScriptController.h" |
38 #include "bindings/v8/V8Binding.h" | 38 #include "bindings/v8/V8Binding.h" |
39 #include "bindings/v8/V8DOMConfiguration.h" | 39 #include "bindings/v8/V8DOMConfiguration.h" |
40 #include "bindings/v8/V8DOMWrapper.h" | 40 #include "bindings/v8/V8DOMWrapper.h" |
41 #include "core/dom/ContextFeatures.h" | 41 #include "core/dom/ContextFeatures.h" |
42 #include "core/dom/Document.h" | 42 #include "core/dom/Document.h" |
43 #include "platform/TraceEvent.h" | 43 #include "platform/TraceEvent.h" |
44 #include "wtf/UnusedParam.h" | 44 #include "wtf/UnusedParam.h" |
45 | 45 |
46 namespace WebCore { | 46 namespace WebCore { |
47 | 47 |
48 static void initializeScriptWrappableForInterface(TestDoNotCheckConstantsInterfa
ce* object) | 48 static void initializeScriptWrappableForInterface(TestInterfaceDoNotCheckConstan
ts* object) |
49 { | 49 { |
50 if (ScriptWrappable::wrapperCanBeStoredInObject(object)) | 50 if (ScriptWrappable::wrapperCanBeStoredInObject(object)) |
51 ScriptWrappable::setTypeInfoInObject(object, &V8TestDoNotCheckConstantsI
nterface::wrapperTypeInfo); | 51 ScriptWrappable::setTypeInfoInObject(object, &V8TestInterfaceDoNotCheckC
onstants::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::TestDoNotCheckConstan
tsInterface* object) | 62 void webCoreInitializeScriptWrappableForInterface(WebCore::TestInterfaceDoNotChe
ckConstants* object) |
63 { | 63 { |
64 WebCore::initializeScriptWrappableForInterface(object); | 64 WebCore::initializeScriptWrappableForInterface(object); |
65 } | 65 } |
66 | 66 |
67 namespace WebCore { | 67 namespace WebCore { |
68 const WrapperTypeInfo V8TestDoNotCheckConstantsInterface::wrapperTypeInfo = { gi
n::kEmbedderBlink, V8TestDoNotCheckConstantsInterface::GetTemplate, V8TestDoNotC
heckConstantsInterface::derefObject, 0, 0, 0, V8TestDoNotCheckConstantsInterface
::installPerContextEnabledMethods, 0, WrapperTypeObjectPrototype }; | 68 const WrapperTypeInfo V8TestInterfaceDoNotCheckConstants::wrapperTypeInfo = { gi
n::kEmbedderBlink, V8TestInterfaceDoNotCheckConstants::GetTemplate, V8TestInterf
aceDoNotCheckConstants::derefObject, 0, 0, 0, V8TestInterfaceDoNotCheckConstants
::installPerContextEnabledMethods, 0, WrapperTypeObjectPrototype }; |
69 | 69 |
70 namespace TestDoNotCheckConstantsInterfaceV8Internal { | 70 namespace TestInterfaceDoNotCheckConstantsV8Internal { |
71 | 71 |
72 template <typename T> void V8_USE(T) { } | 72 template <typename T> void V8_USE(T) { } |
73 | 73 |
74 } // namespace TestDoNotCheckConstantsInterfaceV8Internal | 74 } // namespace TestInterfaceDoNotCheckConstantsV8Internal |
75 | 75 |
76 static v8::Handle<v8::FunctionTemplate> ConfigureV8TestDoNotCheckConstantsInterf
aceTemplate(v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isol
ate, WrapperWorldType currentWorldType) | 76 static v8::Handle<v8::FunctionTemplate> ConfigureV8TestInterfaceDoNotCheckConsta
ntsTemplate(v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isol
ate, WrapperWorldType currentWorldType) |
77 { | 77 { |
78 functionTemplate->ReadOnlyPrototype(); | 78 functionTemplate->ReadOnlyPrototype(); |
79 | 79 |
80 v8::Local<v8::Signature> defaultSignature; | 80 v8::Local<v8::Signature> defaultSignature; |
81 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestDoNotCheckConstantsInterface", v8::Local<v8::FunctionTemplate>(), V8Te
stDoNotCheckConstantsInterface::internalFieldCount, | 81 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestInterfaceDoNotCheckConstants", v8::Local<v8::FunctionTemplate>(), V8Te
stInterfaceDoNotCheckConstants::internalFieldCount, |
82 0, 0, | 82 0, 0, |
83 0, 0, | 83 0, 0, |
84 0, 0, | 84 0, 0, |
85 isolate, currentWorldType); | 85 isolate, currentWorldType); |
86 UNUSED_PARAM(defaultSignature); | 86 UNUSED_PARAM(defaultSignature); |
87 v8::Local<v8::ObjectTemplate> instanceTemplate = functionTemplate->InstanceT
emplate(); | 87 v8::Local<v8::ObjectTemplate> instanceTemplate = functionTemplate->InstanceT
emplate(); |
88 v8::Local<v8::ObjectTemplate> prototypeTemplate = functionTemplate->Prototyp
eTemplate(); | 88 v8::Local<v8::ObjectTemplate> prototypeTemplate = functionTemplate->Prototyp
eTemplate(); |
89 UNUSED_PARAM(instanceTemplate); | 89 UNUSED_PARAM(instanceTemplate); |
90 UNUSED_PARAM(prototypeTemplate); | 90 UNUSED_PARAM(prototypeTemplate); |
91 static const V8DOMConfiguration::ConstantConfiguration V8TestDoNotCheckConst
antsInterfaceConstants[] = { | 91 static const V8DOMConfiguration::ConstantConfiguration V8TestInterfaceDoNotC
heckConstantsConstants[] = { |
92 {"CONST_VALUE_0", 0}, | 92 {"CONST_VALUE_0", 0}, |
93 {"CONST_JAVASCRIPT", 1}, | 93 {"CONST_JAVASCRIPT", 1}, |
94 }; | 94 }; |
95 V8DOMConfiguration::installConstants(functionTemplate, prototypeTemplate, V8
TestDoNotCheckConstantsInterfaceConstants, WTF_ARRAY_LENGTH(V8TestDoNotCheckCons
tantsInterfaceConstants), isolate); | 95 V8DOMConfiguration::installConstants(functionTemplate, prototypeTemplate, V8
TestInterfaceDoNotCheckConstantsConstants, WTF_ARRAY_LENGTH(V8TestInterfaceDoNot
CheckConstantsConstants), isolate); |
96 | 96 |
97 // Custom toString template | 97 // Custom toString template |
98 functionTemplate->Set(v8::String::NewFromUtf8(isolate, "toString", v8::Strin
g::kInternalizedString), V8PerIsolateData::current()->toStringTemplate()); | 98 functionTemplate->Set(v8::String::NewFromUtf8(isolate, "toString", v8::Strin
g::kInternalizedString), V8PerIsolateData::current()->toStringTemplate()); |
99 return functionTemplate; | 99 return functionTemplate; |
100 } | 100 } |
101 | 101 |
102 v8::Handle<v8::FunctionTemplate> V8TestDoNotCheckConstantsInterface::GetTemplate
(v8::Isolate* isolate, WrapperWorldType currentWorldType) | 102 v8::Handle<v8::FunctionTemplate> V8TestInterfaceDoNotCheckConstants::GetTemplate
(v8::Isolate* isolate, WrapperWorldType currentWorldType) |
103 { | 103 { |
104 V8PerIsolateData* data = V8PerIsolateData::from(isolate); | 104 V8PerIsolateData* data = V8PerIsolateData::from(isolate); |
105 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&wrapperTypeInfo); | 105 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&wrapperTypeInfo); |
106 if (result != data->templateMap(currentWorldType).end()) | 106 if (result != data->templateMap(currentWorldType).end()) |
107 return result->value.newLocal(isolate); | 107 return result->value.newLocal(isolate); |
108 | 108 |
109 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); | 109 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); |
110 v8::EscapableHandleScope handleScope(isolate); | 110 v8::EscapableHandleScope handleScope(isolate); |
111 v8::Local<v8::FunctionTemplate> templ = | 111 v8::Local<v8::FunctionTemplate> templ = |
112 ConfigureV8TestDoNotCheckConstantsInterfaceTemplate(data->rawTemplate(&w
rapperTypeInfo, currentWorldType), isolate, currentWorldType); | 112 ConfigureV8TestInterfaceDoNotCheckConstantsTemplate(data->rawTemplate(&w
rapperTypeInfo, currentWorldType), isolate, currentWorldType); |
113 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); | 113 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); |
114 return handleScope.Escape(templ); | 114 return handleScope.Escape(templ); |
115 } | 115 } |
116 | 116 |
117 bool V8TestDoNotCheckConstantsInterface::hasInstance(v8::Handle<v8::Value> jsVal
ue, v8::Isolate* isolate, WrapperWorldType currentWorldType) | 117 bool V8TestInterfaceDoNotCheckConstants::hasInstance(v8::Handle<v8::Value> jsVal
ue, v8::Isolate* isolate, WrapperWorldType currentWorldType) |
118 { | 118 { |
119 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, currentWorldType); | 119 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, currentWorldType); |
120 } | 120 } |
121 | 121 |
122 bool V8TestDoNotCheckConstantsInterface::hasInstanceInAnyWorld(v8::Handle<v8::Va
lue> jsValue, v8::Isolate* isolate) | 122 bool V8TestInterfaceDoNotCheckConstants::hasInstanceInAnyWorld(v8::Handle<v8::Va
lue> jsValue, v8::Isolate* isolate) |
123 { | 123 { |
124 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, MainWorld) | 124 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, MainWorld) |
125 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, IsolatedWorld) | 125 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, IsolatedWorld) |
126 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, WorkerWorld); | 126 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, WorkerWorld); |
127 } | 127 } |
128 | 128 |
129 v8::Handle<v8::Object> V8TestDoNotCheckConstantsInterface::createWrapper(PassRef
Ptr<TestDoNotCheckConstantsInterface> impl, v8::Handle<v8::Object> creationConte
xt, v8::Isolate* isolate) | 129 v8::Handle<v8::Object> V8TestInterfaceDoNotCheckConstants::createWrapper(PassRef
Ptr<TestInterfaceDoNotCheckConstants> impl, v8::Handle<v8::Object> creationConte
xt, v8::Isolate* isolate) |
130 { | 130 { |
131 ASSERT(impl); | 131 ASSERT(impl); |
132 ASSERT(!DOMDataStore::containsWrapper<V8TestDoNotCheckConstantsInterface>(im
pl.get(), isolate)); | 132 ASSERT(!DOMDataStore::containsWrapper<V8TestInterfaceDoNotCheckConstants>(im
pl.get(), isolate)); |
133 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { | 133 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { |
134 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje
ct(impl.get()); | 134 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje
ct(impl.get()); |
135 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper
TypeInfo. These will both have | 135 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper
TypeInfo. These will both have |
136 // the same object de-ref functions, though, so use that as the basis of
the check. | 136 // the same object de-ref functions, though, so use that as the basis of
the check. |
137 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction
== wrapperTypeInfo.derefObjectFunction); | 137 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction
== wrapperTypeInfo.derefObjectFunction); |
138 } | 138 } |
139 | 139 |
140 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext
, &wrapperTypeInfo, toInternalPointer(impl.get()), isolate); | 140 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext
, &wrapperTypeInfo, toInternalPointer(impl.get()), isolate); |
141 if (UNLIKELY(wrapper.IsEmpty())) | 141 if (UNLIKELY(wrapper.IsEmpty())) |
142 return wrapper; | 142 return wrapper; |
143 | 143 |
144 installPerContextEnabledProperties(wrapper, impl.get(), isolate); | 144 installPerContextEnabledProperties(wrapper, impl.get(), isolate); |
145 V8DOMWrapper::associateObjectWithWrapper<V8TestDoNotCheckConstantsInterface>
(impl, &wrapperTypeInfo, wrapper, isolate, WrapperConfiguration::Independent); | 145 V8DOMWrapper::associateObjectWithWrapper<V8TestInterfaceDoNotCheckConstants>
(impl, &wrapperTypeInfo, wrapper, isolate, WrapperConfiguration::Independent); |
146 return wrapper; | 146 return wrapper; |
147 } | 147 } |
148 | 148 |
149 void V8TestDoNotCheckConstantsInterface::derefObject(void* object) | 149 void V8TestInterfaceDoNotCheckConstants::derefObject(void* object) |
150 { | 150 { |
151 fromInternalPointer(object)->deref(); | 151 fromInternalPointer(object)->deref(); |
152 } | 152 } |
153 | 153 |
154 template<> | 154 template<> |
155 v8::Handle<v8::Value> toV8NoInline(TestDoNotCheckConstantsInterface* impl, v8::H
andle<v8::Object> creationContext, v8::Isolate* isolate) | 155 v8::Handle<v8::Value> toV8NoInline(TestInterfaceDoNotCheckConstants* impl, v8::H
andle<v8::Object> creationContext, v8::Isolate* isolate) |
156 { | 156 { |
157 return toV8(impl, creationContext, isolate); | 157 return toV8(impl, creationContext, isolate); |
158 } | 158 } |
159 | 159 |
160 } // namespace WebCore | 160 } // namespace WebCore |
OLD | NEW |