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

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

Issue 182243002: Allow the implementation to return references instead of pointers to the bindings (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase 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 /* 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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 { 157 {
158 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 158 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
159 TestInterfaceV8Internal::implementsStringAttributeAttributeSetter(jsValue, i nfo); 159 TestInterfaceV8Internal::implementsStringAttributeAttributeSetter(jsValue, i nfo);
160 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 160 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
161 } 161 }
162 162
163 static void implementsNodeAttributeAttributeGetter(const v8::PropertyCallbackInf o<v8::Value>& info) 163 static void implementsNodeAttributeAttributeGetter(const v8::PropertyCallbackInf o<v8::Value>& info)
164 { 164 {
165 TestInterface* imp = V8TestInterface::toNative(info.Holder()); 165 TestInterface* imp = V8TestInterface::toNative(info.Holder());
166 ASSERT(imp); 166 ASSERT(imp);
167 v8SetReturnValueFast(info, TestImplements::implementsNodeAttribute(*imp), im p); 167 v8SetReturnValueFast(info, WTF::getPtr(TestImplements::implementsNodeAttribu te(*imp)), imp);
168 } 168 }
169 169
170 static void implementsNodeAttributeAttributeGetterCallback(v8::Local<v8::String> , const v8::PropertyCallbackInfo<v8::Value>& info) 170 static void implementsNodeAttributeAttributeGetterCallback(v8::Local<v8::String> , const v8::PropertyCallbackInfo<v8::Value>& info)
171 { 171 {
172 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 172 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
173 TestInterfaceV8Internal::implementsNodeAttributeAttributeGetter(info); 173 TestInterfaceV8Internal::implementsNodeAttributeAttributeGetter(info);
174 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 174 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
175 } 175 }
176 176
177 static void implementsNodeAttributeAttributeSetter(v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) 177 static void implementsNodeAttributeAttributeSetter(v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 { 218 {
219 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 219 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
220 TestInterfaceV8Internal::implementsEventHandlerAttributeAttributeSetter(jsVa lue, info); 220 TestInterfaceV8Internal::implementsEventHandlerAttributeAttributeSetter(jsVa lue, info);
221 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 221 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
222 } 222 }
223 223
224 static void implementsRuntimeEnabledNodeAttributeAttributeGetter(const v8::Prope rtyCallbackInfo<v8::Value>& info) 224 static void implementsRuntimeEnabledNodeAttributeAttributeGetter(const v8::Prope rtyCallbackInfo<v8::Value>& info)
225 { 225 {
226 TestInterface* imp = V8TestInterface::toNative(info.Holder()); 226 TestInterface* imp = V8TestInterface::toNative(info.Holder());
227 ASSERT(imp); 227 ASSERT(imp);
228 v8SetReturnValueFast(info, TestImplements::implementsRuntimeEnabledNodeAttri bute(*imp), imp); 228 v8SetReturnValueFast(info, WTF::getPtr(TestImplements::implementsRuntimeEnab ledNodeAttribute(*imp)), imp);
229 } 229 }
230 230
231 static void implementsRuntimeEnabledNodeAttributeAttributeGetterCallback(v8::Loc al<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) 231 static void implementsRuntimeEnabledNodeAttributeAttributeGetterCallback(v8::Loc al<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
232 { 232 {
233 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 233 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
234 TestInterfaceV8Internal::implementsRuntimeEnabledNodeAttributeAttributeGette r(info); 234 TestInterfaceV8Internal::implementsRuntimeEnabledNodeAttributeAttributeGette r(info);
235 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 235 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
236 } 236 }
237 237
238 static void implementsRuntimeEnabledNodeAttributeAttributeSetter(v8::Local<v8::V alue> jsValue, const v8::PropertyCallbackInfo<void>& info) 238 static void implementsRuntimeEnabledNodeAttributeAttributeSetter(v8::Local<v8::V alue> jsValue, const v8::PropertyCallbackInfo<void>& info)
239 { 239 {
240 TestInterface* imp = V8TestInterface::toNative(info.Holder()); 240 TestInterface* imp = V8TestInterface::toNative(info.Holder());
241 V8TRYCATCH_VOID(Node*, cppValue, V8Node::toNativeWithTypeCheck(info.GetIsola te(), jsValue)); 241 V8TRYCATCH_VOID(Node*, cppValue, V8Node::toNativeWithTypeCheck(info.GetIsola te(), jsValue));
242 ASSERT(imp); 242 ASSERT(imp);
243 TestImplements::setImplementsRuntimeEnabledNodeAttribute(*imp, WTF::getPtr(c ppValue)); 243 TestImplements::setImplementsRuntimeEnabledNodeAttribute(*imp, WTF::getPtr(c ppValue));
244 } 244 }
245 245
246 static void implementsRuntimeEnabledNodeAttributeAttributeSetterCallback(v8::Loc al<v8::String>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<voi d>& info) 246 static void implementsRuntimeEnabledNodeAttributeAttributeSetterCallback(v8::Loc al<v8::String>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<voi d>& info)
247 { 247 {
248 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 248 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
249 TestInterfaceV8Internal::implementsRuntimeEnabledNodeAttributeAttributeSette r(jsValue, info); 249 TestInterfaceV8Internal::implementsRuntimeEnabledNodeAttributeAttributeSette r(jsValue, info);
250 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 250 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
251 } 251 }
252 252
253 static void implementsPerContextEnabledNodeAttributeAttributeGetter(const v8::Pr opertyCallbackInfo<v8::Value>& info) 253 static void implementsPerContextEnabledNodeAttributeAttributeGetter(const v8::Pr opertyCallbackInfo<v8::Value>& info)
254 { 254 {
255 TestInterface* imp = V8TestInterface::toNative(info.Holder()); 255 TestInterface* imp = V8TestInterface::toNative(info.Holder());
256 ASSERT(imp); 256 ASSERT(imp);
257 v8SetReturnValueFast(info, TestImplements::implementsPerContextEnabledNodeAt tribute(*imp), imp); 257 v8SetReturnValueFast(info, WTF::getPtr(TestImplements::implementsPerContextE nabledNodeAttribute(*imp)), imp);
258 } 258 }
259 259
260 static void implementsPerContextEnabledNodeAttributeAttributeGetterCallback(v8:: Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) 260 static void implementsPerContextEnabledNodeAttributeAttributeGetterCallback(v8:: Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
261 { 261 {
262 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 262 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
263 TestInterfaceV8Internal::implementsPerContextEnabledNodeAttributeAttributeGe tter(info); 263 TestInterfaceV8Internal::implementsPerContextEnabledNodeAttributeAttributeGe tter(info);
264 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 264 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
265 } 265 }
266 266
267 static void implementsPerContextEnabledNodeAttributeAttributeSetter(v8::Local<v8 ::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) 267 static void implementsPerContextEnabledNodeAttributeAttributeSetter(v8::Local<v8 ::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 TestInterfaceV8Internal::supplementalStr2AttributeSetter(jsValue, info); 381 TestInterfaceV8Internal::supplementalStr2AttributeSetter(jsValue, info);
382 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 382 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
383 } 383 }
384 #endif // ENABLE(CONDITION_PARTIAL) 384 #endif // ENABLE(CONDITION_PARTIAL)
385 385
386 #if ENABLE(CONDITION_PARTIAL) 386 #if ENABLE(CONDITION_PARTIAL)
387 static void supplementalNodeAttributeGetter(const v8::PropertyCallbackInfo<v8::V alue>& info) 387 static void supplementalNodeAttributeGetter(const v8::PropertyCallbackInfo<v8::V alue>& info)
388 { 388 {
389 TestInterface* imp = V8TestInterface::toNative(info.Holder()); 389 TestInterface* imp = V8TestInterface::toNative(info.Holder());
390 ASSERT(imp); 390 ASSERT(imp);
391 v8SetReturnValueFast(info, TestPartialInterface::supplementalNode(*imp), imp ); 391 v8SetReturnValueFast(info, WTF::getPtr(TestPartialInterface::supplementalNod e(*imp)), imp);
392 } 392 }
393 #endif // ENABLE(CONDITION_PARTIAL) 393 #endif // ENABLE(CONDITION_PARTIAL)
394 394
395 #if ENABLE(CONDITION_PARTIAL) 395 #if ENABLE(CONDITION_PARTIAL)
396 static void supplementalNodeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) 396 static void supplementalNodeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
397 { 397 {
398 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 398 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
399 TestInterfaceV8Internal::supplementalNodeAttributeGetter(info); 399 TestInterfaceV8Internal::supplementalNodeAttributeGetter(info);
400 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 400 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
401 } 401 }
(...skipping 16 matching lines...) Expand all
418 TestInterfaceV8Internal::supplementalNodeAttributeSetter(jsValue, info); 418 TestInterfaceV8Internal::supplementalNodeAttributeSetter(jsValue, info);
419 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 419 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
420 } 420 }
421 #endif // ENABLE(CONDITION_PARTIAL) 421 #endif // ENABLE(CONDITION_PARTIAL)
422 422
423 #if ENABLE(CONDITION_PARTIAL) 423 #if ENABLE(CONDITION_PARTIAL)
424 static void Node13AttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& inf o) 424 static void Node13AttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& inf o)
425 { 425 {
426 TestInterface* imp = V8TestInterface::toNative(info.Holder()); 426 TestInterface* imp = V8TestInterface::toNative(info.Holder());
427 ASSERT(imp); 427 ASSERT(imp);
428 v8SetReturnValueFast(info, TestPartialInterface::node13(*imp), imp); 428 v8SetReturnValueFast(info, WTF::getPtr(TestPartialInterface::node13(*imp)), imp);
429 } 429 }
430 #endif // ENABLE(CONDITION_PARTIAL) 430 #endif // ENABLE(CONDITION_PARTIAL)
431 431
432 #if ENABLE(CONDITION_PARTIAL) 432 #if ENABLE(CONDITION_PARTIAL)
433 static void Node13AttributeGetterCallback(v8::Local<v8::String>, const v8::Prope rtyCallbackInfo<v8::Value>& info) 433 static void Node13AttributeGetterCallback(v8::Local<v8::String>, const v8::Prope rtyCallbackInfo<v8::Value>& info)
434 { 434 {
435 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 435 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
436 TestInterfaceV8Internal::Node13AttributeGetter(info); 436 TestInterfaceV8Internal::Node13AttributeGetter(info);
437 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 437 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
438 } 438 }
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
650 TestInterface* imp = V8TestInterface::toNative(info.Holder()); 650 TestInterface* imp = V8TestInterface::toNative(info.Holder());
651 AtomicString propertyName = toCoreAtomicString(name); 651 AtomicString propertyName = toCoreAtomicString(name);
652 bool result0Enabled = false; 652 bool result0Enabled = false;
653 RefPtr<Node> result0; 653 RefPtr<Node> result0;
654 bool result1Enabled = false; 654 bool result1Enabled = false;
655 RefPtr<NodeList> result1; 655 RefPtr<NodeList> result1;
656 imp->getItem(propertyName, result0Enabled, result0, result1Enabled, result1) ; 656 imp->getItem(propertyName, result0Enabled, result0, result1Enabled, result1) ;
657 if (!result0Enabled && !result1Enabled) 657 if (!result0Enabled && !result1Enabled)
658 return; 658 return;
659 if (result0Enabled) { 659 if (result0Enabled) {
660 v8SetReturnValueFast(info, result0.release(), imp); 660 v8SetReturnValueFast(info, WTF::getPtr(result0.release()), imp);
661 return; 661 return;
662 } 662 }
663 if (result1Enabled) { 663 if (result1Enabled) {
664 v8SetReturnValueFast(info, result1.release(), imp); 664 v8SetReturnValueFast(info, WTF::getPtr(result1.release()), imp);
665 return; 665 return;
666 } 666 }
667 v8SetReturnValueNull(info); 667 v8SetReturnValueNull(info);
668 } 668 }
669 669
670 static void namedPropertyGetterCallback(v8::Local<v8::String> name, const v8::Pr opertyCallbackInfo<v8::Value>& info) 670 static void namedPropertyGetterCallback(v8::Local<v8::String> name, const v8::Pr opertyCallbackInfo<v8::Value>& info)
671 { 671 {
672 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); 672 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty");
673 TestInterfaceV8Internal::namedPropertyGetter(name, info); 673 TestInterfaceV8Internal::namedPropertyGetter(name, info);
674 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 674 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
912 } 912 }
913 913
914 template<> 914 template<>
915 v8::Handle<v8::Value> toV8NoInline(TestInterface* impl, v8::Handle<v8::Object> c reationContext, v8::Isolate* isolate) 915 v8::Handle<v8::Value> toV8NoInline(TestInterface* impl, v8::Handle<v8::Object> c reationContext, v8::Isolate* isolate)
916 { 916 {
917 return toV8(impl, creationContext, isolate); 917 return toV8(impl, creationContext, isolate);
918 } 918 }
919 919
920 } // namespace WebCore 920 } // namespace WebCore
921 #endif // ENABLE(Condition1) || ENABLE(Condition2) 921 #endif // ENABLE(Condition1) || ENABLE(Condition2)
OLDNEW
« no previous file with comments | « Source/bindings/tests/results/V8TestEventTarget.cpp ('k') | Source/bindings/tests/results/V8TestInterfaceNode.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698