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

Side by Side Diff: Source/bindings/tests/results/core/V8TestInterface3.cpp

Issue 807263007: IDL: Add forEach() method to iterable<>/maplike<>/setlike<> interfaces (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: adjust test expectations Created 5 years, 10 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 "config.h" 7 #include "config.h"
8 #include "V8TestInterface3.h" 8 #include "V8TestInterface3.h"
9 9
10 #include "bindings/core/v8/ExceptionState.h" 10 #include "bindings/core/v8/ExceptionState.h"
11 #include "bindings/core/v8/ScriptState.h" 11 #include "bindings/core/v8/ScriptState.h"
12 #include "bindings/core/v8/ScriptValue.h"
12 #include "bindings/core/v8/V8DOMConfiguration.h" 13 #include "bindings/core/v8/V8DOMConfiguration.h"
13 #include "bindings/core/v8/V8HiddenValue.h" 14 #include "bindings/core/v8/V8HiddenValue.h"
14 #include "bindings/core/v8/V8Iterator.h" 15 #include "bindings/core/v8/V8Iterator.h"
15 #include "bindings/core/v8/V8Node.h" 16 #include "bindings/core/v8/V8Node.h"
16 #include "bindings/core/v8/V8ObjectConstructor.h" 17 #include "bindings/core/v8/V8ObjectConstructor.h"
17 #include "core/dom/ContextFeatures.h" 18 #include "core/dom/ContextFeatures.h"
18 #include "core/dom/Document.h" 19 #include "core/dom/Document.h"
19 #include "platform/RuntimeEnabledFeatures.h" 20 #include "platform/RuntimeEnabledFeatures.h"
20 #include "platform/TraceEvent.h" 21 #include "platform/TraceEvent.h"
21 #include "wtf/GetPtr.h" 22 #include "wtf/GetPtr.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 v8SetReturnValue(info, result.release()); 86 v8SetReturnValue(info, result.release());
86 } 87 }
87 88
88 static void entriesMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& inf o) 89 static void entriesMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& inf o)
89 { 90 {
90 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); 91 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
91 TestInterface3V8Internal::entriesMethod(info); 92 TestInterface3V8Internal::entriesMethod(info);
92 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); 93 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
93 } 94 }
94 95
96 static void forEachMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
97 {
98 ExceptionState exceptionState(ExceptionState::ExecutionContext, "forEach", " TestInterface3", info.Holder(), info.GetIsolate());
99 if (UNLIKELY(info.Length() < 1)) {
100 setMinimumArityTypeError(exceptionState, 1, info.Length());
101 exceptionState.throwIfNeeded();
102 return;
103 }
104 TestInterface3* impl = V8TestInterface3::toImpl(info.Holder());
105 ScriptValue callback;
106 ScriptValue thisArg;
107 {
108 if (!info[0]->IsFunction()) {
109 exceptionState.throwTypeError("The callback provided as parameter 1 is not a function.");
110 exceptionState.throwIfNeeded();
111 return;
112 }
113 callback = ScriptValue(ScriptState::current(info.GetIsolate()), info[0]) ;
114 thisArg = ScriptValue(ScriptState::current(info.GetIsolate()), info[1]);
115 }
116 ScriptState* scriptState = ScriptState::current(info.GetIsolate());
117 impl->forEach(scriptState, ScriptValue(scriptState, info.This()), callback, thisArg, exceptionState);
118 if (exceptionState.hadException()) {
119 exceptionState.throwIfNeeded();
120 return;
121 }
122 }
123
124 static void forEachMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& inf o)
125 {
126 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
127 TestInterface3V8Internal::forEachMethod(info);
128 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
129 }
130
95 static void iteratorMethod(const v8::FunctionCallbackInfo<v8::Value>& info) 131 static void iteratorMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
96 { 132 {
97 ExceptionState exceptionState(ExceptionState::ExecutionContext, "iterator", "TestInterface3", info.Holder(), info.GetIsolate()); 133 ExceptionState exceptionState(ExceptionState::ExecutionContext, "iterator", "TestInterface3", info.Holder(), info.GetIsolate());
98 TestInterface3* impl = V8TestInterface3::toImpl(info.Holder()); 134 TestInterface3* impl = V8TestInterface3::toImpl(info.Holder());
99 ScriptState* scriptState = ScriptState::current(info.GetIsolate()); 135 ScriptState* scriptState = ScriptState::current(info.GetIsolate());
100 RawPtr<Iterator> result = impl->iterator(scriptState, exceptionState); 136 RawPtr<Iterator> result = impl->iterator(scriptState, exceptionState);
101 if (exceptionState.hadException()) { 137 if (exceptionState.hadException()) {
102 exceptionState.throwIfNeeded(); 138 exceptionState.throwIfNeeded();
103 return; 139 return;
104 } 140 }
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 "values", TestInterface3V8Internal::valuesMethodCallback, 0, 0, V8DO MConfiguration::ExposedToAllScripts, 236 "values", TestInterface3V8Internal::valuesMethodCallback, 0, 0, V8DO MConfiguration::ExposedToAllScripts,
201 }; 237 };
202 V8DOMConfiguration::installMethod(prototypeTemplate, defaultSignature, v 8::None, valuesMethodConfiguration, isolate); 238 V8DOMConfiguration::installMethod(prototypeTemplate, defaultSignature, v 8::None, valuesMethodConfiguration, isolate);
203 } 239 }
204 if (RuntimeEnabledFeatures::featureNameEnabled()) { 240 if (RuntimeEnabledFeatures::featureNameEnabled()) {
205 const V8DOMConfiguration::MethodConfiguration entriesMethodConfiguration = { 241 const V8DOMConfiguration::MethodConfiguration entriesMethodConfiguration = {
206 "entries", TestInterface3V8Internal::entriesMethodCallback, 0, 0, V8 DOMConfiguration::ExposedToAllScripts, 242 "entries", TestInterface3V8Internal::entriesMethodCallback, 0, 0, V8 DOMConfiguration::ExposedToAllScripts,
207 }; 243 };
208 V8DOMConfiguration::installMethod(prototypeTemplate, defaultSignature, v 8::None, entriesMethodConfiguration, isolate); 244 V8DOMConfiguration::installMethod(prototypeTemplate, defaultSignature, v 8::None, entriesMethodConfiguration, isolate);
209 } 245 }
246 if (RuntimeEnabledFeatures::featureNameEnabled()) {
247 const V8DOMConfiguration::MethodConfiguration forEachMethodConfiguration = {
248 "forEach", TestInterface3V8Internal::forEachMethodCallback, 0, 1, V8 DOMConfiguration::ExposedToAllScripts,
249 };
250 V8DOMConfiguration::installMethod(prototypeTemplate, defaultSignature, v 8::None, forEachMethodConfiguration, isolate);
251 }
210 252
211 // Custom toString template 253 // Custom toString template
212 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData: :from(isolate)->toStringTemplate()); 254 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData: :from(isolate)->toStringTemplate());
213 } 255 }
214 256
215 v8::Local<v8::FunctionTemplate> V8TestInterface3::domTemplate(v8::Isolate* isola te) 257 v8::Local<v8::FunctionTemplate> V8TestInterface3::domTemplate(v8::Isolate* isola te)
216 { 258 {
217 return V8DOMConfiguration::domClassTemplate(isolate, const_cast<WrapperTypeI nfo*>(&wrapperTypeInfo), installV8TestInterface3Template); 259 return V8DOMConfiguration::domClassTemplate(isolate, const_cast<WrapperTypeI nfo*>(&wrapperTypeInfo), installV8TestInterface3Template);
218 } 260 }
219 261
(...skipping 16 matching lines...) Expand all
236 { 278 {
237 scriptWrappable->toImpl<TestInterface3>()->ref(); 279 scriptWrappable->toImpl<TestInterface3>()->ref();
238 } 280 }
239 281
240 void V8TestInterface3::derefObject(ScriptWrappable* scriptWrappable) 282 void V8TestInterface3::derefObject(ScriptWrappable* scriptWrappable)
241 { 283 {
242 scriptWrappable->toImpl<TestInterface3>()->deref(); 284 scriptWrappable->toImpl<TestInterface3>()->deref();
243 } 285 }
244 286
245 } // namespace blink 287 } // namespace blink
OLDNEW
« no previous file with comments | « Source/bindings/tests/results/core/V8TestInterface2.cpp ('k') | Source/bindings/tests/results/core/V8TestObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698