Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(404)

Side by Side Diff: Source/bindings/tests/results/V8TestInterface2.cpp

Issue 213543004: Consolidate IDL test cases (15%: 34 => 29) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Reupload Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY! 5 // This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY!
6 6
7 #include "config.h" 7 #include "config.h"
8 #include "V8TestSpecialOperationsIdentifierRaisesException.h" 8 #include "V8TestInterface2.h"
9 9
10 #include "RuntimeEnabledFeatures.h" 10 #include "RuntimeEnabledFeatures.h"
11 #include "V8Interface1.h"
12 #include "V8Interface2.h"
11 #include "V8TestInterfaceEmpty.h" 13 #include "V8TestInterfaceEmpty.h"
12 #include "bindings/v8/ExceptionState.h" 14 #include "bindings/v8/ExceptionState.h"
13 #include "bindings/v8/V8DOMConfiguration.h" 15 #include "bindings/v8/V8DOMConfiguration.h"
16 #include "bindings/v8/V8GCController.h"
14 #include "bindings/v8/V8HiddenValue.h" 17 #include "bindings/v8/V8HiddenValue.h"
15 #include "bindings/v8/V8ObjectConstructor.h" 18 #include "bindings/v8/V8ObjectConstructor.h"
16 #include "core/dom/ContextFeatures.h" 19 #include "core/dom/ContextFeatures.h"
17 #include "core/dom/Document.h" 20 #include "core/dom/Document.h"
21 #include "core/dom/Element.h"
22 #include "core/frame/DOMWindow.h"
18 #include "platform/TraceEvent.h" 23 #include "platform/TraceEvent.h"
19 #include "wtf/GetPtr.h" 24 #include "wtf/GetPtr.h"
20 #include "wtf/RefPtr.h" 25 #include "wtf/RefPtr.h"
21 26
22 namespace WebCore { 27 namespace WebCore {
23 28
24 static void initializeScriptWrappableForInterface(TestSpecialOperationsIdentifie rRaisesException* object) 29 static void initializeScriptWrappableForInterface(TestInterface2* object)
25 { 30 {
26 if (ScriptWrappable::wrapperCanBeStoredInObject(object)) 31 if (ScriptWrappable::wrapperCanBeStoredInObject(object))
27 ScriptWrappable::setTypeInfoInObject(object, &V8TestSpecialOperationsIde ntifierRaisesException::wrapperTypeInfo); 32 ScriptWrappable::setTypeInfoInObject(object, &V8TestInterface2::wrapperT ypeInfo);
28 else 33 else
29 ASSERT_NOT_REACHED(); 34 ASSERT_NOT_REACHED();
30 } 35 }
31 36
32 } // namespace WebCore 37 } // namespace WebCore
33 38
34 void webCoreInitializeScriptWrappableForInterface(WebCore::TestSpecialOperations IdentifierRaisesException* object) 39 void webCoreInitializeScriptWrappableForInterface(WebCore::TestInterface2* objec t)
35 { 40 {
36 WebCore::initializeScriptWrappableForInterface(object); 41 WebCore::initializeScriptWrappableForInterface(object);
37 } 42 }
38 43
39 namespace WebCore { 44 namespace WebCore {
40 const WrapperTypeInfo V8TestSpecialOperationsIdentifierRaisesException::wrapperT ypeInfo = { gin::kEmbedderBlink, V8TestSpecialOperationsIdentifierRaisesExceptio n::domTemplate, V8TestSpecialOperationsIdentifierRaisesException::derefObject, 0 , 0, 0, V8TestSpecialOperationsIdentifierRaisesException::installPerContextEnabl edMethods, 0, WrapperTypeObjectPrototype, false }; 45 const WrapperTypeInfo V8TestInterface2::wrapperTypeInfo = { gin::kEmbedderBlink, V8TestInterface2::domTemplate, V8TestInterface2::derefObject, 0, 0, V8TestInter face2::visitDOMWrapper, V8TestInterface2::installPerContextEnabledMethods, 0, Wr apperTypeObjectPrototype, false };
41 46
42 namespace TestSpecialOperationsIdentifierRaisesExceptionV8Internal { 47 namespace TestInterface2V8Internal {
43 48
44 template <typename T> void V8_USE(T) { } 49 template <typename T> void V8_USE(T) { }
45 50
46 static void itemMethod(const v8::FunctionCallbackInfo<v8::Value>& info) 51 static void itemMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
47 { 52 {
48 ExceptionState exceptionState(ExceptionState::ExecutionContext, "item", "Tes tSpecialOperationsIdentifierRaisesException", info.Holder(), info.GetIsolate()); 53 ExceptionState exceptionState(ExceptionState::ExecutionContext, "item", "Tes tInterface2", info.Holder(), info.GetIsolate());
49 if (UNLIKELY(info.Length() < 1)) { 54 if (UNLIKELY(info.Length() < 1)) {
50 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, i nfo.Length())); 55 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, i nfo.Length()));
51 exceptionState.throwIfNeeded(); 56 exceptionState.throwIfNeeded();
52 return; 57 return;
53 } 58 }
54 TestSpecialOperationsIdentifierRaisesException* impl = V8TestSpecialOperatio nsIdentifierRaisesException::toNative(info.Holder()); 59 TestInterface2* impl = V8TestInterface2::toNative(info.Holder());
55 V8TRYCATCH_EXCEPTION_VOID(unsigned, index, toUInt32(info[0], exceptionState) , exceptionState); 60 V8TRYCATCH_EXCEPTION_VOID(unsigned, index, toUInt32(info[0], exceptionState) , exceptionState);
56 RefPtr<TestInterfaceEmpty> result = impl->item(index, exceptionState); 61 RefPtr<TestInterfaceEmpty> result = impl->item(index, exceptionState);
57 if (exceptionState.throwIfNeeded()) 62 if (exceptionState.throwIfNeeded())
58 return; 63 return;
59 v8SetReturnValue(info, result.release()); 64 v8SetReturnValue(info, result.release());
60 } 65 }
61 66
62 static void itemMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) 67 static void itemMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
63 { 68 {
64 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 69 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
65 TestSpecialOperationsIdentifierRaisesExceptionV8Internal::itemMethod(info); 70 TestInterface2V8Internal::itemMethod(info);
66 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 71 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
67 } 72 }
68 73
69 static void setItemMethod(const v8::FunctionCallbackInfo<v8::Value>& info) 74 static void setItemMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
70 { 75 {
71 ExceptionState exceptionState(ExceptionState::ExecutionContext, "setItem", " TestSpecialOperationsIdentifierRaisesException", info.Holder(), info.GetIsolate( )); 76 ExceptionState exceptionState(ExceptionState::ExecutionContext, "setItem", " TestInterface2", info.Holder(), info.GetIsolate());
72 if (UNLIKELY(info.Length() < 2)) { 77 if (UNLIKELY(info.Length() < 2)) {
73 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(2, i nfo.Length())); 78 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(2, i nfo.Length()));
74 exceptionState.throwIfNeeded(); 79 exceptionState.throwIfNeeded();
75 return; 80 return;
76 } 81 }
77 TestSpecialOperationsIdentifierRaisesException* impl = V8TestSpecialOperatio nsIdentifierRaisesException::toNative(info.Holder()); 82 TestInterface2* impl = V8TestInterface2::toNative(info.Holder());
78 V8TRYCATCH_EXCEPTION_VOID(unsigned, index, toUInt32(info[0], exceptionState) , exceptionState); 83 V8TRYCATCH_EXCEPTION_VOID(unsigned, index, toUInt32(info[0], exceptionState) , exceptionState);
79 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, value, info[1]); 84 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, value, info[1]);
80 String result = impl->setItem(index, value, exceptionState); 85 String result = impl->setItem(index, value, exceptionState);
81 if (exceptionState.throwIfNeeded()) 86 if (exceptionState.throwIfNeeded())
82 return; 87 return;
83 v8SetReturnValueString(info, result, info.GetIsolate()); 88 v8SetReturnValueString(info, result, info.GetIsolate());
84 } 89 }
85 90
86 static void setItemMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& inf o) 91 static void setItemMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& inf o)
87 { 92 {
88 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 93 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
89 TestSpecialOperationsIdentifierRaisesExceptionV8Internal::setItemMethod(info ); 94 TestInterface2V8Internal::setItemMethod(info);
90 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 95 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
91 } 96 }
92 97
93 static void deleteItemMethod(const v8::FunctionCallbackInfo<v8::Value>& info) 98 static void deleteItemMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
94 { 99 {
95 ExceptionState exceptionState(ExceptionState::ExecutionContext, "deleteItem" , "TestSpecialOperationsIdentifierRaisesException", info.Holder(), info.GetIsola te()); 100 ExceptionState exceptionState(ExceptionState::ExecutionContext, "deleteItem" , "TestInterface2", info.Holder(), info.GetIsolate());
96 if (UNLIKELY(info.Length() < 1)) { 101 if (UNLIKELY(info.Length() < 1)) {
97 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, i nfo.Length())); 102 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, i nfo.Length()));
98 exceptionState.throwIfNeeded(); 103 exceptionState.throwIfNeeded();
99 return; 104 return;
100 } 105 }
101 TestSpecialOperationsIdentifierRaisesException* impl = V8TestSpecialOperatio nsIdentifierRaisesException::toNative(info.Holder()); 106 TestInterface2* impl = V8TestInterface2::toNative(info.Holder());
102 V8TRYCATCH_EXCEPTION_VOID(unsigned, index, toUInt32(info[0], exceptionState) , exceptionState); 107 V8TRYCATCH_EXCEPTION_VOID(unsigned, index, toUInt32(info[0], exceptionState) , exceptionState);
103 bool result = impl->deleteItem(index, exceptionState); 108 bool result = impl->deleteItem(index, exceptionState);
104 if (exceptionState.throwIfNeeded()) 109 if (exceptionState.throwIfNeeded())
105 return; 110 return;
106 v8SetReturnValueBool(info, result); 111 v8SetReturnValueBool(info, result);
107 } 112 }
108 113
109 static void deleteItemMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) 114 static void deleteItemMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
110 { 115 {
111 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 116 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
112 TestSpecialOperationsIdentifierRaisesExceptionV8Internal::deleteItemMethod(i nfo); 117 TestInterface2V8Internal::deleteItemMethod(info);
113 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 118 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
114 } 119 }
115 120
116 static void namedItemMethod(const v8::FunctionCallbackInfo<v8::Value>& info) 121 static void namedItemMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
117 { 122 {
118 ExceptionState exceptionState(ExceptionState::ExecutionContext, "namedItem", "TestSpecialOperationsIdentifierRaisesException", info.Holder(), info.GetIsolat e()); 123 ExceptionState exceptionState(ExceptionState::ExecutionContext, "namedItem", "TestInterface2", info.Holder(), info.GetIsolate());
119 if (UNLIKELY(info.Length() < 1)) { 124 if (UNLIKELY(info.Length() < 1)) {
120 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, i nfo.Length())); 125 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, i nfo.Length()));
121 exceptionState.throwIfNeeded(); 126 exceptionState.throwIfNeeded();
122 return; 127 return;
123 } 128 }
124 TestSpecialOperationsIdentifierRaisesException* impl = V8TestSpecialOperatio nsIdentifierRaisesException::toNative(info.Holder()); 129 TestInterface2* impl = V8TestInterface2::toNative(info.Holder());
125 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, name, info[0]); 130 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, name, info[0]);
126 RefPtr<TestInterfaceEmpty> result = impl->namedItem(name, exceptionState); 131 RefPtr<TestInterfaceEmpty> result = impl->namedItem(name, exceptionState);
127 if (exceptionState.throwIfNeeded()) 132 if (exceptionState.throwIfNeeded())
128 return; 133 return;
129 v8SetReturnValue(info, result.release()); 134 v8SetReturnValue(info, result.release());
130 } 135 }
131 136
132 static void namedItemMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& i nfo) 137 static void namedItemMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& i nfo)
133 { 138 {
134 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 139 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
135 TestSpecialOperationsIdentifierRaisesExceptionV8Internal::namedItemMethod(in fo); 140 TestInterface2V8Internal::namedItemMethod(info);
136 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 141 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
137 } 142 }
138 143
139 static void setNamedItemMethod(const v8::FunctionCallbackInfo<v8::Value>& info) 144 static void setNamedItemMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
140 { 145 {
141 ExceptionState exceptionState(ExceptionState::ExecutionContext, "setNamedIte m", "TestSpecialOperationsIdentifierRaisesException", info.Holder(), info.GetIso late()); 146 ExceptionState exceptionState(ExceptionState::ExecutionContext, "setNamedIte m", "TestInterface2", info.Holder(), info.GetIsolate());
142 if (UNLIKELY(info.Length() < 2)) { 147 if (UNLIKELY(info.Length() < 2)) {
143 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(2, i nfo.Length())); 148 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(2, i nfo.Length()));
144 exceptionState.throwIfNeeded(); 149 exceptionState.throwIfNeeded();
145 return; 150 return;
146 } 151 }
147 TestSpecialOperationsIdentifierRaisesException* impl = V8TestSpecialOperatio nsIdentifierRaisesException::toNative(info.Holder()); 152 TestInterface2* impl = V8TestInterface2::toNative(info.Holder());
148 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, name, info[0]); 153 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, name, info[0]);
149 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, value, info[1]); 154 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, value, info[1]);
150 String result = impl->setNamedItem(name, value, exceptionState); 155 String result = impl->setNamedItem(name, value, exceptionState);
151 if (exceptionState.throwIfNeeded()) 156 if (exceptionState.throwIfNeeded())
152 return; 157 return;
153 v8SetReturnValueString(info, result, info.GetIsolate()); 158 v8SetReturnValueString(info, result, info.GetIsolate());
154 } 159 }
155 160
156 static void setNamedItemMethodCallback(const v8::FunctionCallbackInfo<v8::Value> & info) 161 static void setNamedItemMethodCallback(const v8::FunctionCallbackInfo<v8::Value> & info)
157 { 162 {
158 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 163 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
159 TestSpecialOperationsIdentifierRaisesExceptionV8Internal::setNamedItemMethod (info); 164 TestInterface2V8Internal::setNamedItemMethod(info);
160 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 165 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
161 } 166 }
162 167
163 static void deleteNamedItemMethod(const v8::FunctionCallbackInfo<v8::Value>& inf o) 168 static void deleteNamedItemMethod(const v8::FunctionCallbackInfo<v8::Value>& inf o)
164 { 169 {
165 ExceptionState exceptionState(ExceptionState::ExecutionContext, "deleteNamed Item", "TestSpecialOperationsIdentifierRaisesException", info.Holder(), info.Get Isolate()); 170 ExceptionState exceptionState(ExceptionState::ExecutionContext, "deleteNamed Item", "TestInterface2", info.Holder(), info.GetIsolate());
166 if (UNLIKELY(info.Length() < 1)) { 171 if (UNLIKELY(info.Length() < 1)) {
167 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, i nfo.Length())); 172 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, i nfo.Length()));
168 exceptionState.throwIfNeeded(); 173 exceptionState.throwIfNeeded();
169 return; 174 return;
170 } 175 }
171 TestSpecialOperationsIdentifierRaisesException* impl = V8TestSpecialOperatio nsIdentifierRaisesException::toNative(info.Holder()); 176 TestInterface2* impl = V8TestInterface2::toNative(info.Holder());
172 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, name, info[0]); 177 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, name, info[0]);
173 bool result = impl->deleteNamedItem(name, exceptionState); 178 bool result = impl->deleteNamedItem(name, exceptionState);
174 if (exceptionState.throwIfNeeded()) 179 if (exceptionState.throwIfNeeded())
175 return; 180 return;
176 v8SetReturnValueBool(info, result); 181 v8SetReturnValueBool(info, result);
177 } 182 }
178 183
179 static void deleteNamedItemMethodCallback(const v8::FunctionCallbackInfo<v8::Val ue>& info) 184 static void deleteNamedItemMethodCallback(const v8::FunctionCallbackInfo<v8::Val ue>& info)
180 { 185 {
181 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 186 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
182 TestSpecialOperationsIdentifierRaisesExceptionV8Internal::deleteNamedItemMet hod(info); 187 TestInterface2V8Internal::deleteNamedItemMethod(info);
183 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 188 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
184 } 189 }
185 190
191 static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info)
192 {
193 v8::Isolate* isolate = info.GetIsolate();
194 RefPtr<TestInterface2> impl = TestInterface2::create();
195
196 v8::Handle<v8::Object> wrapper = wrap(impl.get(), info.Holder(), isolate);
197 v8SetReturnValue(info, wrapper);
198 }
199
186 static void indexedPropertyGetter(uint32_t index, const v8::PropertyCallbackInfo <v8::Value>& info) 200 static void indexedPropertyGetter(uint32_t index, const v8::PropertyCallbackInfo <v8::Value>& info)
187 { 201 {
188 TestSpecialOperationsIdentifierRaisesException* impl = V8TestSpecialOperatio nsIdentifierRaisesException::toNative(info.Holder()); 202 TestInterface2* impl = V8TestInterface2::toNative(info.Holder());
189 ExceptionState exceptionState(ExceptionState::IndexedGetterContext, "TestSpe cialOperationsIdentifierRaisesException", info.Holder(), info.GetIsolate()); 203 ExceptionState exceptionState(ExceptionState::IndexedGetterContext, "TestInt erface2", info.Holder(), info.GetIsolate());
190 RefPtr<TestInterfaceEmpty> result = impl->item(index, exceptionState); 204 RefPtr<TestInterfaceEmpty> result = impl->item(index, exceptionState);
191 if (exceptionState.throwIfNeeded()) 205 if (exceptionState.throwIfNeeded())
192 return; 206 return;
193 if (!result) 207 if (!result)
194 return; 208 return;
195 v8SetReturnValueFast(info, WTF::getPtr(result.release()), impl); 209 v8SetReturnValueFast(info, WTF::getPtr(result.release()), impl);
196 } 210 }
197 211
198 static void indexedPropertyGetterCallback(uint32_t index, const v8::PropertyCall backInfo<v8::Value>& info) 212 static void indexedPropertyGetterCallback(uint32_t index, const v8::PropertyCall backInfo<v8::Value>& info)
199 { 213 {
200 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMIndexedProperty"); 214 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMIndexedProperty");
201 TestSpecialOperationsIdentifierRaisesExceptionV8Internal::indexedPropertyGet ter(index, info); 215 TestInterface2V8Internal::indexedPropertyGetter(index, info);
202 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 216 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
203 } 217 }
204 218
205 static void indexedPropertySetter(uint32_t index, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info) 219 static void indexedPropertySetter(uint32_t index, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info)
206 { 220 {
207 TestSpecialOperationsIdentifierRaisesException* impl = V8TestSpecialOperatio nsIdentifierRaisesException::toNative(info.Holder()); 221 TestInterface2* impl = V8TestInterface2::toNative(info.Holder());
208 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, propertyValue, v8Va lue); 222 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, propertyValue, v8Va lue);
209 ExceptionState exceptionState(ExceptionState::IndexedSetterContext, "TestSpe cialOperationsIdentifierRaisesException", info.Holder(), info.GetIsolate()); 223 ExceptionState exceptionState(ExceptionState::IndexedSetterContext, "TestInt erface2", info.Holder(), info.GetIsolate());
210 bool result = impl->setItem(index, propertyValue, exceptionState); 224 bool result = impl->setItem(index, propertyValue, exceptionState);
211 if (exceptionState.throwIfNeeded()) 225 if (exceptionState.throwIfNeeded())
212 return; 226 return;
213 if (!result) 227 if (!result)
214 return; 228 return;
215 v8SetReturnValue(info, v8Value); 229 v8SetReturnValue(info, v8Value);
216 } 230 }
217 231
218 static void indexedPropertySetterCallback(uint32_t index, v8::Local<v8::Value> v 8Value, const v8::PropertyCallbackInfo<v8::Value>& info) 232 static void indexedPropertySetterCallback(uint32_t index, v8::Local<v8::Value> v 8Value, const v8::PropertyCallbackInfo<v8::Value>& info)
219 { 233 {
220 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMIndexedProperty"); 234 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMIndexedProperty");
221 TestSpecialOperationsIdentifierRaisesExceptionV8Internal::indexedPropertySet ter(index, v8Value, info); 235 TestInterface2V8Internal::indexedPropertySetter(index, v8Value, info);
222 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 236 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
223 } 237 }
224 238
225 static void indexedPropertyDeleter(uint32_t index, const v8::PropertyCallbackInf o<v8::Boolean>& info) 239 static void indexedPropertyDeleter(uint32_t index, const v8::PropertyCallbackInf o<v8::Boolean>& info)
226 { 240 {
227 TestSpecialOperationsIdentifierRaisesException* impl = V8TestSpecialOperatio nsIdentifierRaisesException::toNative(info.Holder()); 241 TestInterface2* impl = V8TestInterface2::toNative(info.Holder());
228 ExceptionState exceptionState(ExceptionState::IndexedDeletionContext, "TestS pecialOperationsIdentifierRaisesException", info.Holder(), info.GetIsolate()); 242 ExceptionState exceptionState(ExceptionState::IndexedDeletionContext, "TestI nterface2", info.Holder(), info.GetIsolate());
229 DeleteResult result = impl->deleteItem(index, exceptionState); 243 DeleteResult result = impl->deleteItem(index, exceptionState);
230 if (exceptionState.throwIfNeeded()) 244 if (exceptionState.throwIfNeeded())
231 return; 245 return;
232 if (result != DeleteUnknownProperty) 246 if (result != DeleteUnknownProperty)
233 return v8SetReturnValueBool(info, result == DeleteSuccess); 247 return v8SetReturnValueBool(info, result == DeleteSuccess);
234 } 248 }
235 249
236 static void indexedPropertyDeleterCallback(uint32_t index, const v8::PropertyCal lbackInfo<v8::Boolean>& info) 250 static void indexedPropertyDeleterCallback(uint32_t index, const v8::PropertyCal lbackInfo<v8::Boolean>& info)
237 { 251 {
238 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMIndexedProperty"); 252 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMIndexedProperty");
239 TestSpecialOperationsIdentifierRaisesExceptionV8Internal::indexedPropertyDel eter(index, info); 253 TestInterface2V8Internal::indexedPropertyDeleter(index, info);
240 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 254 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
241 } 255 }
242 256
243 static void namedPropertyGetter(v8::Local<v8::String> name, const v8::PropertyCa llbackInfo<v8::Value>& info) 257 static void namedPropertyGetter(v8::Local<v8::String> name, const v8::PropertyCa llbackInfo<v8::Value>& info)
244 { 258 {
245 if (info.Holder()->HasRealNamedProperty(name)) 259 if (info.Holder()->HasRealNamedProperty(name))
246 return; 260 return;
247 if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty()) 261 if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty())
248 return; 262 return;
249 263
250 TestSpecialOperationsIdentifierRaisesException* impl = V8TestSpecialOperatio nsIdentifierRaisesException::toNative(info.Holder()); 264 TestInterface2* impl = V8TestInterface2::toNative(info.Holder());
251 AtomicString propertyName = toCoreAtomicString(name); 265 AtomicString propertyName = toCoreAtomicString(name);
252 v8::String::Utf8Value namedProperty(name); 266 v8::String::Utf8Value namedProperty(name);
253 ExceptionState exceptionState(ExceptionState::GetterContext, *namedProperty, "TestSpecialOperationsIdentifierRaisesException", info.Holder(), info.GetIsolat e()); 267 ExceptionState exceptionState(ExceptionState::GetterContext, *namedProperty, "TestInterface2", info.Holder(), info.GetIsolate());
254 RefPtr<TestInterfaceEmpty> result = impl->namedItem(propertyName, exceptionS tate); 268 RefPtr<TestInterfaceEmpty> result = impl->namedItem(propertyName, exceptionS tate);
255 if (exceptionState.throwIfNeeded()) 269 if (exceptionState.throwIfNeeded())
256 return; 270 return;
257 if (!result) 271 if (!result)
258 return; 272 return;
259 v8SetReturnValueFast(info, WTF::getPtr(result.release()), impl); 273 v8SetReturnValueFast(info, WTF::getPtr(result.release()), impl);
260 } 274 }
261 275
262 static void namedPropertyGetterCallback(v8::Local<v8::String> name, const v8::Pr opertyCallbackInfo<v8::Value>& info) 276 static void namedPropertyGetterCallback(v8::Local<v8::String> name, const v8::Pr opertyCallbackInfo<v8::Value>& info)
263 { 277 {
264 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); 278 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty");
265 TestSpecialOperationsIdentifierRaisesExceptionV8Internal::namedPropertyGette r(name, info); 279 TestInterface2V8Internal::namedPropertyGetter(name, info);
266 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 280 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
267 } 281 }
268 282
269 static void namedPropertySetter(v8::Local<v8::String> name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info) 283 static void namedPropertySetter(v8::Local<v8::String> name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info)
270 { 284 {
271 if (info.Holder()->HasRealNamedProperty(name)) 285 if (info.Holder()->HasRealNamedProperty(name))
272 return; 286 return;
273 if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty()) 287 if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty())
274 return; 288 return;
275 289
276 TestSpecialOperationsIdentifierRaisesException* impl = V8TestSpecialOperatio nsIdentifierRaisesException::toNative(info.Holder()); 290 TestInterface2* impl = V8TestInterface2::toNative(info.Holder());
277 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, propertyName, name) ; 291 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, propertyName, name) ;
278 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, propertyValue, v8Va lue); 292 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, propertyValue, v8Va lue);
279 v8::String::Utf8Value namedProperty(name); 293 v8::String::Utf8Value namedProperty(name);
280 ExceptionState exceptionState(ExceptionState::SetterContext, *namedProperty, "TestSpecialOperationsIdentifierRaisesException", info.Holder(), info.GetIsolat e()); 294 ExceptionState exceptionState(ExceptionState::SetterContext, *namedProperty, "TestInterface2", info.Holder(), info.GetIsolate());
281 bool result = impl->setNamedItem(propertyName, propertyValue, exceptionState ); 295 bool result = impl->setNamedItem(propertyName, propertyValue, exceptionState );
282 if (exceptionState.throwIfNeeded()) 296 if (exceptionState.throwIfNeeded())
283 return; 297 return;
284 if (!result) 298 if (!result)
285 return; 299 return;
286 v8SetReturnValue(info, v8Value); 300 v8SetReturnValue(info, v8Value);
287 } 301 }
288 302
289 static void namedPropertySetterCallback(v8::Local<v8::String> name, v8::Local<v8 ::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info) 303 static void namedPropertySetterCallback(v8::Local<v8::String> name, v8::Local<v8 ::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info)
290 { 304 {
291 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); 305 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty");
292 TestSpecialOperationsIdentifierRaisesExceptionV8Internal::namedPropertySette r(name, v8Value, info); 306 TestInterface2V8Internal::namedPropertySetter(name, v8Value, info);
293 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 307 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
294 } 308 }
295 309
296 static void namedPropertyQuery(v8::Local<v8::String> name, const v8::PropertyCal lbackInfo<v8::Integer>& info) 310 static void namedPropertyQuery(v8::Local<v8::String> name, const v8::PropertyCal lbackInfo<v8::Integer>& info)
297 { 311 {
298 TestSpecialOperationsIdentifierRaisesException* impl = V8TestSpecialOperatio nsIdentifierRaisesException::toNative(info.Holder()); 312 TestInterface2* impl = V8TestInterface2::toNative(info.Holder());
299 AtomicString propertyName = toCoreAtomicString(name); 313 AtomicString propertyName = toCoreAtomicString(name);
300 v8::String::Utf8Value namedProperty(name); 314 v8::String::Utf8Value namedProperty(name);
301 ExceptionState exceptionState(ExceptionState::GetterContext, *namedProperty, "TestSpecialOperationsIdentifierRaisesException", info.Holder(), info.GetIsolat e()); 315 ExceptionState exceptionState(ExceptionState::GetterContext, *namedProperty, "TestInterface2", info.Holder(), info.GetIsolate());
302 bool result = impl->namedPropertyQuery(propertyName, exceptionState); 316 bool result = impl->namedPropertyQuery(propertyName, exceptionState);
303 if (exceptionState.throwIfNeeded()) 317 if (exceptionState.throwIfNeeded())
304 return; 318 return;
305 if (!result) 319 if (!result)
306 return; 320 return;
307 v8SetReturnValueInt(info, v8::None); 321 v8SetReturnValueInt(info, v8::None);
308 } 322 }
309 323
310 static void namedPropertyQueryCallback(v8::Local<v8::String> name, const v8::Pro pertyCallbackInfo<v8::Integer>& info) 324 static void namedPropertyQueryCallback(v8::Local<v8::String> name, const v8::Pro pertyCallbackInfo<v8::Integer>& info)
311 { 325 {
312 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); 326 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty");
313 TestSpecialOperationsIdentifierRaisesExceptionV8Internal::namedPropertyQuery (name, info); 327 TestInterface2V8Internal::namedPropertyQuery(name, info);
314 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 328 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
315 } 329 }
316 330
317 static void namedPropertyDeleter(v8::Local<v8::String> name, const v8::PropertyC allbackInfo<v8::Boolean>& info) 331 static void namedPropertyDeleter(v8::Local<v8::String> name, const v8::PropertyC allbackInfo<v8::Boolean>& info)
318 { 332 {
319 TestSpecialOperationsIdentifierRaisesException* impl = V8TestSpecialOperatio nsIdentifierRaisesException::toNative(info.Holder()); 333 TestInterface2* impl = V8TestInterface2::toNative(info.Holder());
320 AtomicString propertyName = toCoreAtomicString(name); 334 AtomicString propertyName = toCoreAtomicString(name);
321 v8::String::Utf8Value namedProperty(name); 335 v8::String::Utf8Value namedProperty(name);
322 ExceptionState exceptionState(ExceptionState::DeletionContext, *namedPropert y, "TestSpecialOperationsIdentifierRaisesException", info.Holder(), info.GetIsol ate()); 336 ExceptionState exceptionState(ExceptionState::DeletionContext, *namedPropert y, "TestInterface2", info.Holder(), info.GetIsolate());
323 DeleteResult result = impl->deleteNamedItem(propertyName, exceptionState); 337 DeleteResult result = impl->deleteNamedItem(propertyName, exceptionState);
324 if (exceptionState.throwIfNeeded()) 338 if (exceptionState.throwIfNeeded())
325 return; 339 return;
326 if (result != DeleteUnknownProperty) 340 if (result != DeleteUnknownProperty)
327 return v8SetReturnValueBool(info, result == DeleteSuccess); 341 return v8SetReturnValueBool(info, result == DeleteSuccess);
328 } 342 }
329 343
330 static void namedPropertyDeleterCallback(v8::Local<v8::String> name, const v8::P ropertyCallbackInfo<v8::Boolean>& info) 344 static void namedPropertyDeleterCallback(v8::Local<v8::String> name, const v8::P ropertyCallbackInfo<v8::Boolean>& info)
331 { 345 {
332 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); 346 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty");
333 TestSpecialOperationsIdentifierRaisesExceptionV8Internal::namedPropertyDelet er(name, info); 347 TestInterface2V8Internal::namedPropertyDeleter(name, info);
334 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 348 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
335 } 349 }
336 350
337 static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& i nfo) 351 static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& i nfo)
338 { 352 {
339 TestSpecialOperationsIdentifierRaisesException* impl = V8TestSpecialOperatio nsIdentifierRaisesException::toNative(info.Holder()); 353 TestInterface2* impl = V8TestInterface2::toNative(info.Holder());
340 v8::Isolate* isolate = info.GetIsolate(); 354 v8::Isolate* isolate = info.GetIsolate();
341 Vector<String> names; 355 Vector<String> names;
342 ExceptionState exceptionState(ExceptionState::EnumerationContext, "TestSpeci alOperationsIdentifierRaisesException", info.Holder(), isolate); 356 ExceptionState exceptionState(ExceptionState::EnumerationContext, "TestInter face2", info.Holder(), isolate);
343 impl->namedPropertyEnumerator(names, exceptionState); 357 impl->namedPropertyEnumerator(names, exceptionState);
344 if (exceptionState.throwIfNeeded()) 358 if (exceptionState.throwIfNeeded())
345 return; 359 return;
346 v8::Handle<v8::Array> v8names = v8::Array::New(isolate, names.size()); 360 v8::Handle<v8::Array> v8names = v8::Array::New(isolate, names.size());
347 for (size_t i = 0; i < names.size(); ++i) 361 for (size_t i = 0; i < names.size(); ++i)
348 v8names->Set(v8::Integer::New(isolate, i), v8String(isolate, names[i])); 362 v8names->Set(v8::Integer::New(isolate, i), v8String(isolate, names[i]));
349 v8SetReturnValue(info, v8names); 363 v8SetReturnValue(info, v8names);
350 } 364 }
351 365
352 static void namedPropertyEnumeratorCallback(const v8::PropertyCallbackInfo<v8::A rray>& info) 366 static void namedPropertyEnumeratorCallback(const v8::PropertyCallbackInfo<v8::A rray>& info)
353 { 367 {
354 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); 368 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty");
355 TestSpecialOperationsIdentifierRaisesExceptionV8Internal::namedPropertyEnume rator(info); 369 TestInterface2V8Internal::namedPropertyEnumerator(info);
356 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 370 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
357 } 371 }
358 372
359 } // namespace TestSpecialOperationsIdentifierRaisesExceptionV8Internal 373 } // namespace TestInterface2V8Internal
360 374
361 static const V8DOMConfiguration::MethodConfiguration V8TestSpecialOperationsIden tifierRaisesExceptionMethods[] = { 375 void V8TestInterface2::visitDOMWrapper(void* object, const v8::Persistent<v8::Ob ject>& wrapper, v8::Isolate* isolate)
362 {"item", TestSpecialOperationsIdentifierRaisesExceptionV8Internal::itemMetho dCallback, 0, 1}, 376 {
363 {"setItem", TestSpecialOperationsIdentifierRaisesExceptionV8Internal::setIte mMethodCallback, 0, 2}, 377 TestInterface2* impl = fromInternalPointer(object);
364 {"deleteItem", TestSpecialOperationsIdentifierRaisesExceptionV8Internal::del eteItemMethodCallback, 0, 1}, 378 // The ownerNode() method may return a reference or a pointer.
365 {"namedItem", TestSpecialOperationsIdentifierRaisesExceptionV8Internal::name dItemMethodCallback, 0, 1}, 379 if (Node* owner = WTF::getPtr(impl->ownerNode())) {
366 {"setNamedItem", TestSpecialOperationsIdentifierRaisesExceptionV8Internal::s etNamedItemMethodCallback, 0, 2}, 380 Node* root = V8GCController::opaqueRootForGC(owner, isolate);
367 {"deleteNamedItem", TestSpecialOperationsIdentifierRaisesExceptionV8Internal ::deleteNamedItemMethodCallback, 0, 1}, 381 isolate->SetReferenceFromGroup(v8::UniqueId(reinterpret_cast<intptr_t>(r oot)), wrapper);
382 return;
383 }
384 setObjectGroup(object, wrapper, isolate);
385 }
386
387 static const V8DOMConfiguration::MethodConfiguration V8TestInterface2Methods[] = {
388 {"item", TestInterface2V8Internal::itemMethodCallback, 0, 1},
389 {"setItem", TestInterface2V8Internal::setItemMethodCallback, 0, 2},
390 {"deleteItem", TestInterface2V8Internal::deleteItemMethodCallback, 0, 1},
391 {"namedItem", TestInterface2V8Internal::namedItemMethodCallback, 0, 1},
392 {"setNamedItem", TestInterface2V8Internal::setNamedItemMethodCallback, 0, 2} ,
393 {"deleteNamedItem", TestInterface2V8Internal::deleteNamedItemMethodCallback, 0, 1},
368 }; 394 };
369 395
370 static void configureV8TestSpecialOperationsIdentifierRaisesExceptionTemplate(v8 ::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate) 396 void V8TestInterface2::constructorCallback(const v8::FunctionCallbackInfo<v8::Va lue>& info)
397 {
398 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "DOMConstructor");
399 if (!info.IsConstructCall()) {
400 throwTypeError(ExceptionMessages::constructorNotCallableAsFunction("Test Interface2"), info.GetIsolate());
401 return;
402 }
403
404 if (ConstructorMode::current() == ConstructorMode::WrapExistingObject) {
405 v8SetReturnValue(info, info.Holder());
406 return;
407 }
408
409 TestInterface2V8Internal::constructor(info);
410 }
411
412 static void configureV8TestInterface2Template(v8::Handle<v8::FunctionTemplate> f unctionTemplate, v8::Isolate* isolate)
371 { 413 {
372 functionTemplate->ReadOnlyPrototype(); 414 functionTemplate->ReadOnlyPrototype();
373 415
374 v8::Local<v8::Signature> defaultSignature; 416 v8::Local<v8::Signature> defaultSignature;
375 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl ate, "TestSpecialOperationsIdentifierRaisesException", v8::Local<v8::FunctionTem plate>(), V8TestSpecialOperationsIdentifierRaisesException::internalFieldCount, 417 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl ate, "TestInterface2", v8::Local<v8::FunctionTemplate>(), V8TestInterface2::inte rnalFieldCount,
376 0, 0, 418 0, 0,
377 0, 0, 419 0, 0,
378 V8TestSpecialOperationsIdentifierRaisesExceptionMethods, WTF_ARRAY_LENGT H(V8TestSpecialOperationsIdentifierRaisesExceptionMethods), 420 V8TestInterface2Methods, WTF_ARRAY_LENGTH(V8TestInterface2Methods),
379 isolate); 421 isolate);
422 functionTemplate->SetCallHandler(V8TestInterface2::constructorCallback);
423 functionTemplate->SetLength(0);
380 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla te->InstanceTemplate(); 424 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla te->InstanceTemplate();
381 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTempl ate->PrototypeTemplate(); 425 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTempl ate->PrototypeTemplate();
382 functionTemplate->InstanceTemplate()->SetIndexedPropertyHandler(TestSpecialO perationsIdentifierRaisesExceptionV8Internal::indexedPropertyGetterCallback, Tes tSpecialOperationsIdentifierRaisesExceptionV8Internal::indexedPropertySetterCall back, 0, TestSpecialOperationsIdentifierRaisesExceptionV8Internal::indexedProper tyDeleterCallback, indexedPropertyEnumerator<TestSpecialOperationsIdentifierRais esException>); 426 functionTemplate->InstanceTemplate()->SetIndexedPropertyHandler(TestInterfac e2V8Internal::indexedPropertyGetterCallback, TestInterface2V8Internal::indexedPr opertySetterCallback, 0, TestInterface2V8Internal::indexedPropertyDeleterCallbac k, indexedPropertyEnumerator<TestInterface2>);
383 functionTemplate->InstanceTemplate()->SetNamedPropertyHandler(TestSpecialOpe rationsIdentifierRaisesExceptionV8Internal::namedPropertyGetterCallback, TestSpe cialOperationsIdentifierRaisesExceptionV8Internal::namedPropertySetterCallback, TestSpecialOperationsIdentifierRaisesExceptionV8Internal::namedPropertyQueryCall back, TestSpecialOperationsIdentifierRaisesExceptionV8Internal::namedPropertyDel eterCallback, TestSpecialOperationsIdentifierRaisesExceptionV8Internal::namedPro pertyEnumeratorCallback); 427 functionTemplate->InstanceTemplate()->SetNamedPropertyHandler(TestInterface2 V8Internal::namedPropertyGetterCallback, TestInterface2V8Internal::namedProperty SetterCallback, TestInterface2V8Internal::namedPropertyQueryCallback, TestInterf ace2V8Internal::namedPropertyDeleterCallback, TestInterface2V8Internal::namedPro pertyEnumeratorCallback);
384 428
385 // Custom toString template 429 // Custom toString template
386 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData: :current()->toStringTemplate()); 430 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData: :current()->toStringTemplate());
387 } 431 }
388 432
389 v8::Handle<v8::FunctionTemplate> V8TestSpecialOperationsIdentifierRaisesExceptio n::domTemplate(v8::Isolate* isolate) 433 v8::Handle<v8::FunctionTemplate> V8TestInterface2::domTemplate(v8::Isolate* isol ate)
390 { 434 {
391 V8PerIsolateData* data = V8PerIsolateData::from(isolate); 435 V8PerIsolateData* data = V8PerIsolateData::from(isolate);
392 v8::Local<v8::FunctionTemplate> result = data->existingDOMTemplate(const_cas t<WrapperTypeInfo*>(&wrapperTypeInfo)); 436 v8::Local<v8::FunctionTemplate> result = data->existingDOMTemplate(const_cas t<WrapperTypeInfo*>(&wrapperTypeInfo));
393 if (!result.IsEmpty()) 437 if (!result.IsEmpty())
394 return result; 438 return result;
395 439
396 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); 440 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate");
397 result = v8::FunctionTemplate::New(isolate, V8ObjectConstructor::isValidCons tructorMode); 441 result = v8::FunctionTemplate::New(isolate, V8ObjectConstructor::isValidCons tructorMode);
398 configureV8TestSpecialOperationsIdentifierRaisesExceptionTemplate(result, is olate); 442 configureV8TestInterface2Template(result, isolate);
399 data->setDOMTemplate(const_cast<WrapperTypeInfo*>(&wrapperTypeInfo), result) ; 443 data->setDOMTemplate(const_cast<WrapperTypeInfo*>(&wrapperTypeInfo), result) ;
400 return result; 444 return result;
401 } 445 }
402 446
403 bool V8TestSpecialOperationsIdentifierRaisesException::hasInstance(v8::Handle<v8 ::Value> v8Value, v8::Isolate* isolate) 447 bool V8TestInterface2::hasInstance(v8::Handle<v8::Value> v8Value, v8::Isolate* i solate)
404 { 448 {
405 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Valu e); 449 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Valu e);
406 } 450 }
407 451
408 v8::Handle<v8::Object> V8TestSpecialOperationsIdentifierRaisesException::findIns tanceInPrototypeChain(v8::Handle<v8::Value> v8Value, v8::Isolate* isolate) 452 v8::Handle<v8::Object> V8TestInterface2::findInstanceInPrototypeChain(v8::Handle <v8::Value> v8Value, v8::Isolate* isolate)
409 { 453 {
410 return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrappe rTypeInfo, v8Value); 454 return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrappe rTypeInfo, v8Value);
411 } 455 }
412 456
413 TestSpecialOperationsIdentifierRaisesException* V8TestSpecialOperationsIdentifie rRaisesException::toNativeWithTypeCheck(v8::Isolate* isolate, v8::Handle<v8::Val ue> value) 457 TestInterface2* V8TestInterface2::toNativeWithTypeCheck(v8::Isolate* isolate, v8 ::Handle<v8::Value> value)
414 { 458 {
415 return hasInstance(value, isolate) ? fromInternalPointer(v8::Handle<v8::Obje ct>::Cast(value)->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex)) : 0; 459 return hasInstance(value, isolate) ? fromInternalPointer(v8::Handle<v8::Obje ct>::Cast(value)->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex)) : 0;
416 } 460 }
417 461
418 v8::Handle<v8::Object> V8TestSpecialOperationsIdentifierRaisesException::createW rapper(PassRefPtr<TestSpecialOperationsIdentifierRaisesException> impl, v8::Hand le<v8::Object> creationContext, v8::Isolate* isolate) 462 v8::Handle<v8::Object> wrap(TestInterface2* impl, v8::Handle<v8::Object> creatio nContext, v8::Isolate* isolate)
419 { 463 {
420 ASSERT(impl); 464 ASSERT(impl);
421 ASSERT(!DOMDataStore::containsWrapper<V8TestSpecialOperationsIdentifierRaise sException>(impl.get(), isolate)); 465 if (impl->isInterface1())
466 return wrap(toInterface1(impl), creationContext, isolate);
467 if (impl->isInterface2())
468 return wrap(toInterface2(impl), creationContext, isolate);
469 v8::Handle<v8::Object> wrapper = V8TestInterface2::createWrapper(impl, creat ionContext, isolate);
470 return wrapper;
471 }
472
473 v8::Handle<v8::Object> V8TestInterface2::createWrapper(PassRefPtr<TestInterface2 > impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
474 {
475 ASSERT(impl);
476 ASSERT(!DOMDataStore::containsWrapper<V8TestInterface2>(impl.get(), isolate) );
422 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { 477 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) {
423 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje ct(impl.get()); 478 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje ct(impl.get());
424 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper TypeInfo. These will both have 479 // 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. 480 // 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); 481 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction == wrapperTypeInfo.derefObjectFunction);
427 } 482 }
428 483
429 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext , &wrapperTypeInfo, toInternalPointer(impl.get()), isolate); 484 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext , &wrapperTypeInfo, toInternalPointer(impl.get()), isolate);
430 if (UNLIKELY(wrapper.IsEmpty())) 485 if (UNLIKELY(wrapper.IsEmpty()))
431 return wrapper; 486 return wrapper;
432 487
433 installPerContextEnabledProperties(wrapper, impl.get(), isolate); 488 installPerContextEnabledProperties(wrapper, impl.get(), isolate);
434 V8DOMWrapper::associateObjectWithWrapper<V8TestSpecialOperationsIdentifierRa isesException>(impl, &wrapperTypeInfo, wrapper, isolate, WrapperConfiguration::I ndependent); 489 V8DOMWrapper::associateObjectWithWrapper<V8TestInterface2>(impl, &wrapperTyp eInfo, wrapper, isolate, WrapperConfiguration::Dependent);
435 return wrapper; 490 return wrapper;
436 } 491 }
437 492
438 void V8TestSpecialOperationsIdentifierRaisesException::derefObject(void* object) 493 void V8TestInterface2::derefObject(void* object)
439 { 494 {
440 fromInternalPointer(object)->deref(); 495 fromInternalPointer(object)->deref();
441 } 496 }
442 497
443 template<> 498 template<>
444 v8::Handle<v8::Value> toV8NoInline(TestSpecialOperationsIdentifierRaisesExceptio n* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) 499 v8::Handle<v8::Value> toV8NoInline(TestInterface2* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
445 { 500 {
446 return toV8(impl, creationContext, isolate); 501 return toV8(impl, creationContext, isolate);
447 } 502 }
448 503
449 } // namespace WebCore 504 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/tests/results/V8TestInterface2.h ('k') | Source/bindings/tests/results/V8TestInterface3.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698