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

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

Issue 104873018: Remove raw DOM templates from V8 bindings (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 11 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 21 matching lines...) Expand all
32 32
33 #include "config.h" 33 #include "config.h"
34 #include "V8SupportTestInterface.h" 34 #include "V8SupportTestInterface.h"
35 35
36 #include "RuntimeEnabledFeatures.h" 36 #include "RuntimeEnabledFeatures.h"
37 #include "V8Node.h" 37 #include "V8Node.h"
38 #include "V8TestObject.h" 38 #include "V8TestObject.h"
39 #include "bindings/tests/idls/testing/SupportTestPartialInterface.h" 39 #include "bindings/tests/idls/testing/SupportTestPartialInterface.h"
40 #include "bindings/v8/ExceptionState.h" 40 #include "bindings/v8/ExceptionState.h"
41 #include "bindings/v8/V8DOMConfiguration.h" 41 #include "bindings/v8/V8DOMConfiguration.h"
42 #include "bindings/v8/V8ObjectConstructor.h"
42 #include "core/dom/ContextFeatures.h" 43 #include "core/dom/ContextFeatures.h"
43 #include "core/dom/Document.h" 44 #include "core/dom/Document.h"
44 #include "platform/TraceEvent.h" 45 #include "platform/TraceEvent.h"
45 #include "wtf/GetPtr.h" 46 #include "wtf/GetPtr.h"
46 #include "wtf/RefPtr.h" 47 #include "wtf/RefPtr.h"
47 48
48 namespace WebCore { 49 namespace WebCore {
49 50
50 static void initializeScriptWrappableForInterface(SupportTestInterface* object) 51 static void initializeScriptWrappableForInterface(SupportTestInterface* object)
51 { 52 {
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 {"supplementalMethod1", SupportTestInterfaceV8Internal::supplementalMethod1M ethodCallback, 0, 0}, 396 {"supplementalMethod1", SupportTestInterfaceV8Internal::supplementalMethod1M ethodCallback, 0, 0},
396 #endif // ENABLE(Condition11) || ENABLE(Condition12) 397 #endif // ENABLE(Condition11) || ENABLE(Condition12)
397 #if ENABLE(Condition11) || ENABLE(Condition12) 398 #if ENABLE(Condition11) || ENABLE(Condition12)
398 {"supplementalMethod2", SupportTestInterfaceV8Internal::supplementalMethod2M ethodCallback, 0, 2}, 399 {"supplementalMethod2", SupportTestInterfaceV8Internal::supplementalMethod2M ethodCallback, 0, 2},
399 #endif // ENABLE(Condition11) || ENABLE(Condition12) 400 #endif // ENABLE(Condition11) || ENABLE(Condition12)
400 #if ENABLE(Condition11) || ENABLE(Condition12) 401 #if ENABLE(Condition11) || ENABLE(Condition12)
401 {"supplementalMethod3", SupportTestInterfaceV8Internal::supplementalMethod3M ethodCallback, 0, 0}, 402 {"supplementalMethod3", SupportTestInterfaceV8Internal::supplementalMethod3M ethodCallback, 0, 0},
402 #endif // ENABLE(Condition11) || ENABLE(Condition12) 403 #endif // ENABLE(Condition11) || ENABLE(Condition12)
403 }; 404 };
404 405
405 static v8::Handle<v8::FunctionTemplate> ConfigureV8SupportTestInterfaceTemplate( v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate, Wrapper WorldType currentWorldType) 406 static void configureV8SupportTestInterfaceTemplate(v8::Handle<v8::FunctionTempl ate> functionTemplate, v8::Isolate* isolate, WrapperWorldType currentWorldType)
406 { 407 {
407 functionTemplate->ReadOnlyPrototype(); 408 functionTemplate->ReadOnlyPrototype();
408 409
409 v8::Local<v8::Signature> defaultSignature; 410 v8::Local<v8::Signature> defaultSignature;
410 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl ate, "SupportTestInterface", v8::Local<v8::FunctionTemplate>(), V8SupportTestInt erface::internalFieldCount, 411 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl ate, "SupportTestInterface", v8::Local<v8::FunctionTemplate>(), V8SupportTestInt erface::internalFieldCount,
411 V8SupportTestInterfaceAttributes, WTF_ARRAY_LENGTH(V8SupportTestInterfac eAttributes), 412 V8SupportTestInterfaceAttributes, WTF_ARRAY_LENGTH(V8SupportTestInterfac eAttributes),
412 0, 0, 413 0, 0,
413 V8SupportTestInterfaceMethods, WTF_ARRAY_LENGTH(V8SupportTestInterfaceMe thods), 414 V8SupportTestInterfaceMethods, WTF_ARRAY_LENGTH(V8SupportTestInterfaceMe thods),
414 isolate, currentWorldType); 415 isolate, currentWorldType);
415 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla te->InstanceTemplate(); 416 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla te->InstanceTemplate();
(...skipping 17 matching lines...) Expand all
433 #endif // ENABLE(Condition11) || ENABLE(Condition12) 434 #endif // ENABLE(Condition11) || ENABLE(Condition12)
434 #if ENABLE(Condition11) || ENABLE(Condition12) 435 #if ENABLE(Condition11) || ENABLE(Condition12)
435 functionTemplate->SetNativeDataProperty(v8::String::NewFromUtf8(isolate, "su pplementalStaticReadOnlyAttr", v8::String::kInternalizedString), SupportTestInte rfaceV8Internal::supplementalStaticReadOnlyAttrAttributeGetterCallback, 0, v8::E xternal::New(isolate, 0), static_cast<v8::PropertyAttribute>(v8::None), v8::Hand le<v8::AccessorSignature>(), static_cast<v8::AccessControl>(v8::DEFAULT)); 436 functionTemplate->SetNativeDataProperty(v8::String::NewFromUtf8(isolate, "su pplementalStaticReadOnlyAttr", v8::String::kInternalizedString), SupportTestInte rfaceV8Internal::supplementalStaticReadOnlyAttrAttributeGetterCallback, 0, v8::E xternal::New(isolate, 0), static_cast<v8::PropertyAttribute>(v8::None), v8::Hand le<v8::AccessorSignature>(), static_cast<v8::AccessControl>(v8::DEFAULT));
436 #endif // ENABLE(Condition11) || ENABLE(Condition12) 437 #endif // ENABLE(Condition11) || ENABLE(Condition12)
437 #if ENABLE(Condition11) || ENABLE(Condition12) 438 #if ENABLE(Condition11) || ENABLE(Condition12)
438 functionTemplate->SetNativeDataProperty(v8::String::NewFromUtf8(isolate, "su pplementalStaticAttr", v8::String::kInternalizedString), SupportTestInterfaceV8I nternal::supplementalStaticAttrAttributeGetterCallback, SupportTestInterfaceV8In ternal::supplementalStaticAttrAttributeSetterCallback, v8::External::New(isolate , 0), static_cast<v8::PropertyAttribute>(v8::None), v8::Handle<v8::AccessorSigna ture>(), static_cast<v8::AccessControl>(v8::DEFAULT)); 439 functionTemplate->SetNativeDataProperty(v8::String::NewFromUtf8(isolate, "su pplementalStaticAttr", v8::String::kInternalizedString), SupportTestInterfaceV8I nternal::supplementalStaticAttrAttributeGetterCallback, SupportTestInterfaceV8In ternal::supplementalStaticAttrAttributeSetterCallback, v8::External::New(isolate , 0), static_cast<v8::PropertyAttribute>(v8::None), v8::Handle<v8::AccessorSigna ture>(), static_cast<v8::AccessControl>(v8::DEFAULT));
439 #endif // ENABLE(Condition11) || ENABLE(Condition12) 440 #endif // ENABLE(Condition11) || ENABLE(Condition12)
440 441
441 // Custom toString template 442 // Custom toString template
442 functionTemplate->Set(v8::String::NewFromUtf8(isolate, "toString", v8::Strin g::kInternalizedString), V8PerIsolateData::current()->toStringTemplate()); 443 functionTemplate->Set(v8::String::NewFromUtf8(isolate, "toString", v8::Strin g::kInternalizedString), V8PerIsolateData::current()->toStringTemplate());
443 return functionTemplate;
444 } 444 }
445 445
446 v8::Handle<v8::FunctionTemplate> V8SupportTestInterface::domTemplate(v8::Isolate * isolate, WrapperWorldType currentWorldType) 446 v8::Handle<v8::FunctionTemplate> V8SupportTestInterface::domTemplate(v8::Isolate * isolate, WrapperWorldType currentWorldType)
447 { 447 {
448 V8PerIsolateData* data = V8PerIsolateData::from(isolate); 448 V8PerIsolateData* data = V8PerIsolateData::from(isolate);
449 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo rldType).find(&wrapperTypeInfo); 449 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo rldType).find(&wrapperTypeInfo);
450 if (result != data->templateMap(currentWorldType).end()) 450 if (result != data->templateMap(currentWorldType).end())
451 return result->value.newLocal(isolate); 451 return result->value.newLocal(isolate);
452 452
453 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); 453 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate");
454 v8::EscapableHandleScope handleScope(isolate); 454 v8::EscapableHandleScope handleScope(isolate);
455 v8::Local<v8::FunctionTemplate> templ = 455 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate, V 8ObjectConstructor::isValidConstructorMode);
456 ConfigureV8SupportTestInterfaceTemplate(data->rawDOMTemplate(&wrapperTyp eInfo, currentWorldType), isolate, currentWorldType); 456 configureV8SupportTestInterfaceTemplate(templ, isolate, currentWorldType);
457 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v 8::FunctionTemplate>(isolate, templ)); 457 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v 8::FunctionTemplate>(isolate, templ));
458 return handleScope.Escape(templ); 458 return handleScope.Escape(templ);
459 } 459 }
460 460
461 bool V8SupportTestInterface::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isol ate* isolate, WrapperWorldType currentWorldType) 461 bool V8SupportTestInterface::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isol ate* isolate, WrapperWorldType currentWorldType)
462 { 462 {
463 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu e, currentWorldType); 463 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu e, currentWorldType);
464 } 464 }
465 465
466 bool V8SupportTestInterface::hasInstanceInAnyWorld(v8::Handle<v8::Value> jsValue , v8::Isolate* isolate) 466 bool V8SupportTestInterface::hasInstanceInAnyWorld(v8::Handle<v8::Value> jsValue , v8::Isolate* isolate)
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 fromInternalPointer(object)->deref(); 505 fromInternalPointer(object)->deref();
506 } 506 }
507 507
508 template<> 508 template<>
509 v8::Handle<v8::Value> toV8NoInline(SupportTestInterface* impl, v8::Handle<v8::Ob ject> creationContext, v8::Isolate* isolate) 509 v8::Handle<v8::Value> toV8NoInline(SupportTestInterface* impl, v8::Handle<v8::Ob ject> creationContext, v8::Isolate* isolate)
510 { 510 {
511 return toV8(impl, creationContext, isolate); 511 return toV8(impl, creationContext, isolate);
512 } 512 }
513 513
514 } // namespace WebCore 514 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/scripts/code_generator_v8.pm ('k') | Source/bindings/tests/results/V8TestCustomAccessors.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698