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

Side by Side Diff: third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceGarbageCollected.cpp

Issue 1873323002: Have bindings layer assume and insist that all interface types are GCed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 4 years, 8 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
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 "V8TestInterfaceGarbageCollected.h" 7 #include "V8TestInterfaceGarbageCollected.h"
8 8
9 #include "bindings/core/v8/ExceptionState.h" 9 #include "bindings/core/v8/ExceptionState.h"
10 #include "bindings/core/v8/ScriptState.h" 10 #include "bindings/core/v8/ScriptState.h"
11 #include "bindings/core/v8/ScriptValue.h" 11 #include "bindings/core/v8/ScriptValue.h"
12 #include "bindings/core/v8/V8DOMConfiguration.h" 12 #include "bindings/core/v8/V8DOMConfiguration.h"
13 #include "bindings/core/v8/V8Iterator.h" 13 #include "bindings/core/v8/V8Iterator.h"
14 #include "bindings/core/v8/V8ObjectConstructor.h" 14 #include "bindings/core/v8/V8ObjectConstructor.h"
15 #include "bindings/core/v8/V8TestInterfaceGarbageCollected.h" 15 #include "bindings/core/v8/V8TestInterfaceGarbageCollected.h"
16 #include "core/dom/Document.h" 16 #include "core/dom/Document.h"
17 #include "core/frame/LocalDOMWindow.h" 17 #include "core/frame/LocalDOMWindow.h"
18 #include "wtf/GetPtr.h" 18 #include "wtf/GetPtr.h"
19 #include "wtf/RefPtr.h" 19 #include "wtf/RefPtr.h"
20 20
21 namespace blink { 21 namespace blink {
22 22
23 // Suppress warning: global constructors, because struct WrapperTypeInfo is triv ial 23 // Suppress warning: global constructors, because struct WrapperTypeInfo is triv ial
24 // and does not depend on another global objects. 24 // and does not depend on another global objects.
25 #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG) 25 #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG)
26 #pragma clang diagnostic push 26 #pragma clang diagnostic push
27 #pragma clang diagnostic ignored "-Wglobal-constructors" 27 #pragma clang diagnostic ignored "-Wglobal-constructors"
28 #endif 28 #endif
29 const WrapperTypeInfo V8TestInterfaceGarbageCollected::wrapperTypeInfo = { gin:: kEmbedderBlink, V8TestInterfaceGarbageCollected::domTemplate, V8TestInterfaceGar bageCollected::refObject, V8TestInterfaceGarbageCollected::derefObject, V8TestIn terfaceGarbageCollected::trace, 0, 0, V8TestInterfaceGarbageCollected::preparePr ototypeAndInterfaceObject, V8TestInterfaceGarbageCollected::installConditionally EnabledProperties, "TestInterfaceGarbageCollected", &V8EventTarget::wrapperTypeI nfo, WrapperTypeInfo::WrapperTypeObjectPrototype, WrapperTypeInfo::ObjectClassId , WrapperTypeInfo::InheritFromEventTarget, WrapperTypeInfo::Independent, Wrapper TypeInfo::GarbageCollectedObject }; 29 const WrapperTypeInfo V8TestInterfaceGarbageCollected::wrapperTypeInfo = { gin:: kEmbedderBlink, V8TestInterfaceGarbageCollected::domTemplate, V8TestInterfaceGar bageCollected::trace, 0, 0, V8TestInterfaceGarbageCollected::preparePrototypeAnd InterfaceObject, V8TestInterfaceGarbageCollected::installConditionallyEnabledPro perties, "TestInterfaceGarbageCollected", &V8EventTarget::wrapperTypeInfo, Wrapp erTypeInfo::WrapperTypeObjectPrototype, WrapperTypeInfo::ObjectClassId, WrapperT ypeInfo::InheritFromEventTarget, WrapperTypeInfo::Independent };
30 #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG) 30 #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG)
31 #pragma clang diagnostic pop 31 #pragma clang diagnostic pop
32 #endif 32 #endif
33 33
34 // This static member must be declared by DEFINE_WRAPPERTYPEINFO in TestInterfac eGarbageCollected.h. 34 // This static member must be declared by DEFINE_WRAPPERTYPEINFO in TestInterfac eGarbageCollected.h.
35 // For details, see the comment of DEFINE_WRAPPERTYPEINFO in 35 // For details, see the comment of DEFINE_WRAPPERTYPEINFO in
36 // bindings/core/v8/ScriptWrappable.h. 36 // bindings/core/v8/ScriptWrappable.h.
37 const WrapperTypeInfo& TestInterfaceGarbageCollected::s_wrapperTypeInfo = V8Test InterfaceGarbageCollected::wrapperTypeInfo; 37 const WrapperTypeInfo& TestInterfaceGarbageCollected::s_wrapperTypeInfo = V8Test InterfaceGarbageCollected::wrapperTypeInfo;
38 38
39 namespace TestInterfaceGarbageCollectedV8Internal { 39 namespace TestInterfaceGarbageCollectedV8Internal {
(...skipping 14 matching lines...) Expand all
54 { 54 {
55 v8::Local<v8::Object> holder = info.Holder(); 55 v8::Local<v8::Object> holder = info.Holder();
56 ExceptionState exceptionState(ExceptionState::SetterContext, "attr1", "TestI nterfaceGarbageCollected", holder, info.GetIsolate()); 56 ExceptionState exceptionState(ExceptionState::SetterContext, "attr1", "TestI nterfaceGarbageCollected", holder, info.GetIsolate());
57 TestInterfaceGarbageCollected* impl = V8TestInterfaceGarbageCollected::toImp l(holder); 57 TestInterfaceGarbageCollected* impl = V8TestInterfaceGarbageCollected::toImp l(holder);
58 TestInterfaceGarbageCollected* cppValue = V8TestInterfaceGarbageCollected::t oImplWithTypeCheck(info.GetIsolate(), v8Value); 58 TestInterfaceGarbageCollected* cppValue = V8TestInterfaceGarbageCollected::t oImplWithTypeCheck(info.GetIsolate(), v8Value);
59 if (!cppValue) { 59 if (!cppValue) {
60 exceptionState.throwTypeError("The provided value is not of type 'TestIn terfaceGarbageCollected'."); 60 exceptionState.throwTypeError("The provided value is not of type 'TestIn terfaceGarbageCollected'.");
61 exceptionState.throwIfNeeded(); 61 exceptionState.throwIfNeeded();
62 return; 62 return;
63 } 63 }
64 impl->setAttr1(WTF::getPtr(cppValue)); 64 impl->setAttr1(cppValue);
65 } 65 }
66 66
67 static void attr1AttributeSetterCallback(const v8::FunctionCallbackInfo<v8::Valu e>& info) 67 static void attr1AttributeSetterCallback(const v8::FunctionCallbackInfo<v8::Valu e>& info)
68 { 68 {
69 v8::Local<v8::Value> v8Value = info[0]; 69 v8::Local<v8::Value> v8Value = info[0];
70 TestInterfaceGarbageCollectedV8Internal::attr1AttributeSetter(v8Value, info) ; 70 TestInterfaceGarbageCollectedV8Internal::attr1AttributeSetter(v8Value, info) ;
71 } 71 }
72 72
73 static void funcMethod(const v8::FunctionCallbackInfo<v8::Value>& info) 73 static void funcMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
74 { 74 {
(...skipping 16 matching lines...) Expand all
91 static void funcMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) 91 static void funcMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
92 { 92 {
93 TestInterfaceGarbageCollectedV8Internal::funcMethod(info); 93 TestInterfaceGarbageCollectedV8Internal::funcMethod(info);
94 } 94 }
95 95
96 static void keysMethod(const v8::FunctionCallbackInfo<v8::Value>& info) 96 static void keysMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
97 { 97 {
98 ExceptionState exceptionState(ExceptionState::ExecutionContext, "keys", "Tes tInterfaceGarbageCollected", info.Holder(), info.GetIsolate()); 98 ExceptionState exceptionState(ExceptionState::ExecutionContext, "keys", "Tes tInterfaceGarbageCollected", info.Holder(), info.GetIsolate());
99 TestInterfaceGarbageCollected* impl = V8TestInterfaceGarbageCollected::toImp l(info.Holder()); 99 TestInterfaceGarbageCollected* impl = V8TestInterfaceGarbageCollected::toImp l(info.Holder());
100 ScriptState* scriptState = ScriptState::current(info.GetIsolate()); 100 ScriptState* scriptState = ScriptState::current(info.GetIsolate());
101 RawPtr<Iterator> result = impl->keysForBinding(scriptState, exceptionState); 101 Iterator* result = impl->keysForBinding(scriptState, exceptionState);
102 if (exceptionState.hadException()) { 102 if (exceptionState.hadException()) {
103 exceptionState.throwIfNeeded(); 103 exceptionState.throwIfNeeded();
104 return; 104 return;
105 } 105 }
106 v8SetReturnValue(info, result.release()); 106 v8SetReturnValue(info, result);
107 } 107 }
108 108
109 static void keysMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) 109 static void keysMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
110 { 110 {
111 TestInterfaceGarbageCollectedV8Internal::keysMethod(info); 111 TestInterfaceGarbageCollectedV8Internal::keysMethod(info);
112 } 112 }
113 113
114 static void valuesMethod(const v8::FunctionCallbackInfo<v8::Value>& info) 114 static void valuesMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
115 { 115 {
116 ExceptionState exceptionState(ExceptionState::ExecutionContext, "values", "T estInterfaceGarbageCollected", info.Holder(), info.GetIsolate()); 116 ExceptionState exceptionState(ExceptionState::ExecutionContext, "values", "T estInterfaceGarbageCollected", info.Holder(), info.GetIsolate());
117 TestInterfaceGarbageCollected* impl = V8TestInterfaceGarbageCollected::toImp l(info.Holder()); 117 TestInterfaceGarbageCollected* impl = V8TestInterfaceGarbageCollected::toImp l(info.Holder());
118 ScriptState* scriptState = ScriptState::current(info.GetIsolate()); 118 ScriptState* scriptState = ScriptState::current(info.GetIsolate());
119 RawPtr<Iterator> result = impl->valuesForBinding(scriptState, exceptionState ); 119 Iterator* result = impl->valuesForBinding(scriptState, exceptionState);
120 if (exceptionState.hadException()) { 120 if (exceptionState.hadException()) {
121 exceptionState.throwIfNeeded(); 121 exceptionState.throwIfNeeded();
122 return; 122 return;
123 } 123 }
124 v8SetReturnValue(info, result.release()); 124 v8SetReturnValue(info, result);
125 } 125 }
126 126
127 static void valuesMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info ) 127 static void valuesMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info )
128 { 128 {
129 TestInterfaceGarbageCollectedV8Internal::valuesMethod(info); 129 TestInterfaceGarbageCollectedV8Internal::valuesMethod(info);
130 } 130 }
131 131
132 static void entriesMethod(const v8::FunctionCallbackInfo<v8::Value>& info) 132 static void entriesMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
133 { 133 {
134 ExceptionState exceptionState(ExceptionState::ExecutionContext, "entries", " TestInterfaceGarbageCollected", info.Holder(), info.GetIsolate()); 134 ExceptionState exceptionState(ExceptionState::ExecutionContext, "entries", " TestInterfaceGarbageCollected", info.Holder(), info.GetIsolate());
135 TestInterfaceGarbageCollected* impl = V8TestInterfaceGarbageCollected::toImp l(info.Holder()); 135 TestInterfaceGarbageCollected* impl = V8TestInterfaceGarbageCollected::toImp l(info.Holder());
136 ScriptState* scriptState = ScriptState::current(info.GetIsolate()); 136 ScriptState* scriptState = ScriptState::current(info.GetIsolate());
137 RawPtr<Iterator> result = impl->entriesForBinding(scriptState, exceptionStat e); 137 Iterator* result = impl->entriesForBinding(scriptState, exceptionState);
138 if (exceptionState.hadException()) { 138 if (exceptionState.hadException()) {
139 exceptionState.throwIfNeeded(); 139 exceptionState.throwIfNeeded();
140 return; 140 return;
141 } 141 }
142 v8SetReturnValue(info, result.release()); 142 v8SetReturnValue(info, result);
143 } 143 }
144 144
145 static void entriesMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& inf o) 145 static void entriesMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& inf o)
146 { 146 {
147 TestInterfaceGarbageCollectedV8Internal::entriesMethod(info); 147 TestInterfaceGarbageCollectedV8Internal::entriesMethod(info);
148 } 148 }
149 149
150 static void forEachMethod(const v8::FunctionCallbackInfo<v8::Value>& info) 150 static void forEachMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
151 { 151 {
152 ExceptionState exceptionState(ExceptionState::ExecutionContext, "forEach", " TestInterfaceGarbageCollected", info.Holder(), info.GetIsolate()); 152 ExceptionState exceptionState(ExceptionState::ExecutionContext, "forEach", " TestInterfaceGarbageCollected", info.Holder(), info.GetIsolate());
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 return; 218 return;
219 } 219 }
220 TestInterfaceGarbageCollected* impl = V8TestInterfaceGarbageCollected::toImp l(info.Holder()); 220 TestInterfaceGarbageCollected* impl = V8TestInterfaceGarbageCollected::toImp l(info.Holder());
221 V8StringResource<> value; 221 V8StringResource<> value;
222 { 222 {
223 value = info[0]; 223 value = info[0];
224 if (!value.prepare()) 224 if (!value.prepare())
225 return; 225 return;
226 } 226 }
227 ScriptState* scriptState = ScriptState::current(info.GetIsolate()); 227 ScriptState* scriptState = ScriptState::current(info.GetIsolate());
228 RawPtr<TestInterfaceGarbageCollected> result = impl->addForBinding(scriptSta te, value, exceptionState); 228 TestInterfaceGarbageCollected* result = impl->addForBinding(scriptState, val ue, exceptionState);
229 if (exceptionState.hadException()) { 229 if (exceptionState.hadException()) {
230 exceptionState.throwIfNeeded(); 230 exceptionState.throwIfNeeded();
231 return; 231 return;
232 } 232 }
233 v8SetReturnValue(info, result.release()); 233 v8SetReturnValue(info, result);
234 } 234 }
235 235
236 static void addMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) 236 static void addMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
237 { 237 {
238 TestInterfaceGarbageCollectedV8Internal::addMethod(info); 238 TestInterfaceGarbageCollectedV8Internal::addMethod(info);
239 } 239 }
240 240
241 static void clearMethod(const v8::FunctionCallbackInfo<v8::Value>& info) 241 static void clearMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
242 { 242 {
243 ExceptionState exceptionState(ExceptionState::ExecutionContext, "clear", "Te stInterfaceGarbageCollected", info.Holder(), info.GetIsolate()); 243 ExceptionState exceptionState(ExceptionState::ExecutionContext, "clear", "Te stInterfaceGarbageCollected", info.Holder(), info.GetIsolate());
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 static void deleteMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info ) 282 static void deleteMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info )
283 { 283 {
284 TestInterfaceGarbageCollectedV8Internal::deleteMethod(info); 284 TestInterfaceGarbageCollectedV8Internal::deleteMethod(info);
285 } 285 }
286 286
287 static void iteratorMethod(const v8::FunctionCallbackInfo<v8::Value>& info) 287 static void iteratorMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
288 { 288 {
289 ExceptionState exceptionState(ExceptionState::ExecutionContext, "iterator", "TestInterfaceGarbageCollected", info.Holder(), info.GetIsolate()); 289 ExceptionState exceptionState(ExceptionState::ExecutionContext, "iterator", "TestInterfaceGarbageCollected", info.Holder(), info.GetIsolate());
290 TestInterfaceGarbageCollected* impl = V8TestInterfaceGarbageCollected::toImp l(info.Holder()); 290 TestInterfaceGarbageCollected* impl = V8TestInterfaceGarbageCollected::toImp l(info.Holder());
291 ScriptState* scriptState = ScriptState::current(info.GetIsolate()); 291 ScriptState* scriptState = ScriptState::current(info.GetIsolate());
292 RawPtr<Iterator> result = impl->iterator(scriptState, exceptionState); 292 Iterator* result = impl->iterator(scriptState, exceptionState);
293 if (exceptionState.hadException()) { 293 if (exceptionState.hadException()) {
294 exceptionState.throwIfNeeded(); 294 exceptionState.throwIfNeeded();
295 return; 295 return;
296 } 296 }
297 v8SetReturnValue(info, result.release()); 297 v8SetReturnValue(info, result);
298 } 298 }
299 299
300 static void iteratorMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& in fo) 300 static void iteratorMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& in fo)
301 { 301 {
302 TestInterfaceGarbageCollectedV8Internal::iteratorMethod(info); 302 TestInterfaceGarbageCollectedV8Internal::iteratorMethod(info);
303 } 303 }
304 304
305 static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info) 305 static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info)
306 { 306 {
307 if (UNLIKELY(info.Length() < 1)) { 307 if (UNLIKELY(info.Length() < 1)) {
308 V8ThrowException::throwException(createMinimumArityTypeErrorForConstruct or(info.GetIsolate(), "TestInterfaceGarbageCollected", 1, info.Length()), info.G etIsolate()); 308 V8ThrowException::throwException(createMinimumArityTypeErrorForConstruct or(info.GetIsolate(), "TestInterfaceGarbageCollected", 1, info.Length()), info.G etIsolate());
309 return; 309 return;
310 } 310 }
311 V8StringResource<> str; 311 V8StringResource<> str;
312 { 312 {
313 str = info[0]; 313 str = info[0];
314 if (!str.prepare()) 314 if (!str.prepare())
315 return; 315 return;
316 } 316 }
317 RawPtr<TestInterfaceGarbageCollected> impl = TestInterfaceGarbageCollected:: create(str); 317 TestInterfaceGarbageCollected* impl = TestInterfaceGarbageCollected::create( str);
318 v8::Local<v8::Object> wrapper = info.Holder(); 318 v8::Local<v8::Object> wrapper = info.Holder();
319 wrapper = impl->associateWithWrapper(info.GetIsolate(), &V8TestInterfaceGarb ageCollected::wrapperTypeInfo, wrapper); 319 wrapper = impl->associateWithWrapper(info.GetIsolate(), &V8TestInterfaceGarb ageCollected::wrapperTypeInfo, wrapper);
320 v8SetReturnValue(info, wrapper); 320 v8SetReturnValue(info, wrapper);
321 } 321 }
322 322
323 } // namespace TestInterfaceGarbageCollectedV8Internal 323 } // namespace TestInterfaceGarbageCollectedV8Internal
324 324
325 const V8DOMConfiguration::AccessorConfiguration V8TestInterfaceGarbageCollectedA ccessors[] = { 325 const V8DOMConfiguration::AccessorConfiguration V8TestInterfaceGarbageCollectedA ccessors[] = {
326 {"attr1", TestInterfaceGarbageCollectedV8Internal::attr1AttributeGetterCallb ack, TestInterfaceGarbageCollectedV8Internal::attr1AttributeSetterCallback, 0, 0 , 0, v8::DEFAULT, static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfigurati on::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::Ch eckHolder}, 326 {"attr1", TestInterfaceGarbageCollectedV8Internal::attr1AttributeGetterCallb ack, TestInterfaceGarbageCollectedV8Internal::attr1AttributeSetterCallback, 0, 0 , 0, v8::DEFAULT, static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfigurati on::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::Ch eckHolder},
327 }; 327 };
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 v8::Local<v8::Object> V8TestInterfaceGarbageCollected::findInstanceInPrototypeCh ain(v8::Local<v8::Value> v8Value, v8::Isolate* isolate) 387 v8::Local<v8::Object> V8TestInterfaceGarbageCollected::findInstanceInPrototypeCh ain(v8::Local<v8::Value> v8Value, v8::Isolate* isolate)
388 { 388 {
389 return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrappe rTypeInfo, v8Value); 389 return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrappe rTypeInfo, v8Value);
390 } 390 }
391 391
392 TestInterfaceGarbageCollected* V8TestInterfaceGarbageCollected::toImplWithTypeCh eck(v8::Isolate* isolate, v8::Local<v8::Value> value) 392 TestInterfaceGarbageCollected* V8TestInterfaceGarbageCollected::toImplWithTypeCh eck(v8::Isolate* isolate, v8::Local<v8::Value> value)
393 { 393 {
394 return hasInstance(value, isolate) ? toImpl(v8::Local<v8::Object>::Cast(valu e)) : 0; 394 return hasInstance(value, isolate) ? toImpl(v8::Local<v8::Object>::Cast(valu e)) : 0;
395 } 395 }
396 396
397 void V8TestInterfaceGarbageCollected::refObject(ScriptWrappable* scriptWrappable )
398 {
399 }
400
401 void V8TestInterfaceGarbageCollected::derefObject(ScriptWrappable* scriptWrappab le)
402 {
403 }
404
405 } // namespace blink 397 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698