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

Side by Side Diff: Source/bindings/tests/results/V8TestObjectPython.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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 #include "bindings/v8/ScriptCallStackFactory.h" 58 #include "bindings/v8/ScriptCallStackFactory.h"
59 #include "bindings/v8/ScriptPromise.h" 59 #include "bindings/v8/ScriptPromise.h"
60 #include "bindings/v8/ScriptState.h" 60 #include "bindings/v8/ScriptState.h"
61 #include "bindings/v8/ScriptValue.h" 61 #include "bindings/v8/ScriptValue.h"
62 #include "bindings/v8/SerializedScriptValue.h" 62 #include "bindings/v8/SerializedScriptValue.h"
63 #include "bindings/v8/V8AbstractEventListener.h" 63 #include "bindings/v8/V8AbstractEventListener.h"
64 #include "bindings/v8/V8DOMActivityLogger.h" 64 #include "bindings/v8/V8DOMActivityLogger.h"
65 #include "bindings/v8/V8DOMConfiguration.h" 65 #include "bindings/v8/V8DOMConfiguration.h"
66 #include "bindings/v8/V8EventListenerList.h" 66 #include "bindings/v8/V8EventListenerList.h"
67 #include "bindings/v8/V8HiddenPropertyName.h" 67 #include "bindings/v8/V8HiddenPropertyName.h"
68 #include "bindings/v8/V8ObjectConstructor.h"
68 #include "bindings/v8/custom/V8ArrayBufferCustom.h" 69 #include "bindings/v8/custom/V8ArrayBufferCustom.h"
69 #include "bindings/v8/custom/V8ArrayBufferViewCustom.h" 70 #include "bindings/v8/custom/V8ArrayBufferViewCustom.h"
70 #include "bindings/v8/custom/V8Float32ArrayCustom.h" 71 #include "bindings/v8/custom/V8Float32ArrayCustom.h"
71 #include "bindings/v8/custom/V8Int32ArrayCustom.h" 72 #include "bindings/v8/custom/V8Int32ArrayCustom.h"
72 #include "bindings/v8/custom/V8Uint8ArrayCustom.h" 73 #include "bindings/v8/custom/V8Uint8ArrayCustom.h"
73 #include "core/css/MediaQueryListListener.h" 74 #include "core/css/MediaQueryListListener.h"
74 #include "core/dom/ContextFeatures.h" 75 #include "core/dom/ContextFeatures.h"
75 #include "core/dom/Document.h" 76 #include "core/dom/Document.h"
76 #include "core/dom/custom/CustomElementCallbackDispatcher.h" 77 #include "core/dom/custom/CustomElementCallbackDispatcher.h"
77 #include "core/frame/DOMWindow.h" 78 #include "core/frame/DOMWindow.h"
(...skipping 6332 matching lines...) Expand 10 before | Expand all | Expand 10 after
6410 {"activityLoggingForAllWorldsPerWorldBindingsVoidMethod", TestObjectPythonV8 Internal::activityLoggingForAllWorldsPerWorldBindingsVoidMethodMethodCallback, T estObjectPythonV8Internal::activityLoggingForAllWorldsPerWorldBindingsVoidMethod MethodCallbackForMainWorld, 0}, 6411 {"activityLoggingForAllWorldsPerWorldBindingsVoidMethod", TestObjectPythonV8 Internal::activityLoggingForAllWorldsPerWorldBindingsVoidMethodMethodCallback, T estObjectPythonV8Internal::activityLoggingForAllWorldsPerWorldBindingsVoidMethod MethodCallbackForMainWorld, 0},
6411 {"activityLoggingForIsolatedWorldsPerWorldBindingsVoidMethod", TestObjectPyt honV8Internal::activityLoggingForIsolatedWorldsPerWorldBindingsVoidMethodMethodC allback, TestObjectPythonV8Internal::activityLoggingForIsolatedWorldsPerWorldBin dingsVoidMethodMethodCallbackForMainWorld, 0}, 6412 {"activityLoggingForIsolatedWorldsPerWorldBindingsVoidMethod", TestObjectPyt honV8Internal::activityLoggingForIsolatedWorldsPerWorldBindingsVoidMethodMethodC allback, TestObjectPythonV8Internal::activityLoggingForIsolatedWorldsPerWorldBin dingsVoidMethodMethodCallbackForMainWorld, 0},
6412 {"perWorldBindingsVoidMethodTestInterfaceEmptyArg", TestObjectPythonV8Intern al::perWorldBindingsVoidMethodTestInterfaceEmptyArgMethodCallback, TestObjectPyt honV8Internal::perWorldBindingsVoidMethodTestInterfaceEmptyArgMethodCallbackForM ainWorld, 1}, 6413 {"perWorldBindingsVoidMethodTestInterfaceEmptyArg", TestObjectPythonV8Intern al::perWorldBindingsVoidMethodTestInterfaceEmptyArgMethodCallback, TestObjectPyt honV8Internal::perWorldBindingsVoidMethodTestInterfaceEmptyArgMethodCallbackForM ainWorld, 1},
6413 {"raisesExceptionVoidMethod", TestObjectPythonV8Internal::raisesExceptionVoi dMethodMethodCallback, 0, 0}, 6414 {"raisesExceptionVoidMethod", TestObjectPythonV8Internal::raisesExceptionVoi dMethodMethodCallback, 0, 0},
6414 {"raisesExceptionVoidMethodOptionalLongArg", TestObjectPythonV8Internal::rai sesExceptionVoidMethodOptionalLongArgMethodCallback, 0, 0}, 6415 {"raisesExceptionVoidMethodOptionalLongArg", TestObjectPythonV8Internal::rai sesExceptionVoidMethodOptionalLongArgMethodCallback, 0, 0},
6415 {"strictTypeCheckingVoidMethodTestInterfaceEmptyArg", TestObjectPythonV8Inte rnal::strictTypeCheckingVoidMethodTestInterfaceEmptyArgMethodCallback, 0, 1}, 6416 {"strictTypeCheckingVoidMethodTestInterfaceEmptyArg", TestObjectPythonV8Inte rnal::strictTypeCheckingVoidMethodTestInterfaceEmptyArgMethodCallback, 0, 1},
6416 {"treatReturnedNullStringAsNullStringMethod", TestObjectPythonV8Internal::tr eatReturnedNullStringAsNullStringMethodMethodCallback, 0, 0}, 6417 {"treatReturnedNullStringAsNullStringMethod", TestObjectPythonV8Internal::tr eatReturnedNullStringAsNullStringMethodMethodCallback, 0, 0},
6417 {"treatReturnedNullStringAsUndefinedStringMethod", TestObjectPythonV8Interna l::treatReturnedNullStringAsUndefinedStringMethodMethodCallback, 0, 0}, 6418 {"treatReturnedNullStringAsUndefinedStringMethod", TestObjectPythonV8Interna l::treatReturnedNullStringAsUndefinedStringMethodMethodCallback, 0, 0},
6418 }; 6419 };
6419 6420
6420 static v8::Handle<v8::FunctionTemplate> ConfigureV8TestObjectPythonTemplate(v8:: Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate, WrapperWorl dType currentWorldType) 6421 static void configureV8TestObjectPythonTemplate(v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate, WrapperWorldType currentWorldType)
6421 { 6422 {
6422 functionTemplate->ReadOnlyPrototype(); 6423 functionTemplate->ReadOnlyPrototype();
6423 6424
6424 v8::Local<v8::Signature> defaultSignature; 6425 v8::Local<v8::Signature> defaultSignature;
6425 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl ate, "TestObjectPython", v8::Local<v8::FunctionTemplate>(), V8TestObjectPython:: internalFieldCount, 6426 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl ate, "TestObjectPython", v8::Local<v8::FunctionTemplate>(), V8TestObjectPython:: internalFieldCount,
6426 V8TestObjectPythonAttributes, WTF_ARRAY_LENGTH(V8TestObjectPythonAttribu tes), 6427 V8TestObjectPythonAttributes, WTF_ARRAY_LENGTH(V8TestObjectPythonAttribu tes),
6427 V8TestObjectPythonAccessors, WTF_ARRAY_LENGTH(V8TestObjectPythonAccessor s), 6428 V8TestObjectPythonAccessors, WTF_ARRAY_LENGTH(V8TestObjectPythonAccessor s),
6428 V8TestObjectPythonMethods, WTF_ARRAY_LENGTH(V8TestObjectPythonMethods), 6429 V8TestObjectPythonMethods, WTF_ARRAY_LENGTH(V8TestObjectPythonMethods),
6429 isolate, currentWorldType); 6430 isolate, currentWorldType);
6430 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla te->InstanceTemplate(); 6431 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla te->InstanceTemplate();
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
6500 } else { 6501 } else {
6501 if (RuntimeEnabledFeatures::featureNameEnabled()) 6502 if (RuntimeEnabledFeatures::featureNameEnabled())
6502 prototypeTemplate->Set(v8::String::NewFromUtf8(isolate, "perWorldBin dingsRuntimeEnabledVoidMethod", v8::String::kInternalizedString), v8::FunctionTe mplate::New(isolate, TestObjectPythonV8Internal::perWorldBindingsRuntimeEnabledV oidMethodMethodCallback, v8Undefined(), defaultSignature, 0)); 6503 prototypeTemplate->Set(v8::String::NewFromUtf8(isolate, "perWorldBin dingsRuntimeEnabledVoidMethod", v8::String::kInternalizedString), v8::FunctionTe mplate::New(isolate, TestObjectPythonV8Internal::perWorldBindingsRuntimeEnabledV oidMethodMethodCallback, v8Undefined(), defaultSignature, 0));
6503 } 6504 }
6504 instanceTemplate->Set(v8::String::NewFromUtf8(isolate, "unforgeableVoidMetho d", v8::String::kInternalizedString), v8::FunctionTemplate::New(isolate, TestObj ectPythonV8Internal::unforgeableVoidMethodMethodCallback, v8Undefined(), default Signature, 0)); 6505 instanceTemplate->Set(v8::String::NewFromUtf8(isolate, "unforgeableVoidMetho d", v8::String::kInternalizedString), v8::FunctionTemplate::New(isolate, TestObj ectPythonV8Internal::unforgeableVoidMethodMethodCallback, v8Undefined(), default Signature, 0));
6505 functionTemplate->SetNativeDataProperty(v8::String::NewFromUtf8(isolate, "st aticStringAttribute", v8::String::kInternalizedString), TestObjectPythonV8Intern al::staticStringAttributeAttributeGetterCallback, TestObjectPythonV8Internal::st aticStringAttributeAttributeSetterCallback, v8::External::New(isolate, 0), stati c_cast<v8::PropertyAttribute>(v8::None), v8::Handle<v8::AccessorSignature>(), st atic_cast<v8::AccessControl>(v8::DEFAULT)); 6506 functionTemplate->SetNativeDataProperty(v8::String::NewFromUtf8(isolate, "st aticStringAttribute", v8::String::kInternalizedString), TestObjectPythonV8Intern al::staticStringAttributeAttributeGetterCallback, TestObjectPythonV8Internal::st aticStringAttributeAttributeSetterCallback, v8::External::New(isolate, 0), stati c_cast<v8::PropertyAttribute>(v8::None), v8::Handle<v8::AccessorSignature>(), st atic_cast<v8::AccessControl>(v8::DEFAULT));
6506 functionTemplate->SetNativeDataProperty(v8::String::NewFromUtf8(isolate, "st aticLongAttribute", v8::String::kInternalizedString), TestObjectPythonV8Internal ::staticLongAttributeAttributeGetterCallback, TestObjectPythonV8Internal::static LongAttributeAttributeSetterCallback, v8::External::New(isolate, 0), static_cast <v8::PropertyAttribute>(v8::None), v8::Handle<v8::AccessorSignature>(), static_c ast<v8::AccessControl>(v8::DEFAULT)); 6507 functionTemplate->SetNativeDataProperty(v8::String::NewFromUtf8(isolate, "st aticLongAttribute", v8::String::kInternalizedString), TestObjectPythonV8Internal ::staticLongAttributeAttributeGetterCallback, TestObjectPythonV8Internal::static LongAttributeAttributeSetterCallback, v8::External::New(isolate, 0), static_cast <v8::PropertyAttribute>(v8::None), v8::Handle<v8::AccessorSignature>(), static_c ast<v8::AccessControl>(v8::DEFAULT));
6507 6508
6508 // Custom toString template 6509 // Custom toString template
6509 functionTemplate->Set(v8::String::NewFromUtf8(isolate, "toString", v8::Strin g::kInternalizedString), V8PerIsolateData::current()->toStringTemplate()); 6510 functionTemplate->Set(v8::String::NewFromUtf8(isolate, "toString", v8::Strin g::kInternalizedString), V8PerIsolateData::current()->toStringTemplate());
6510 return functionTemplate;
6511 } 6511 }
6512 6512
6513 v8::Handle<v8::FunctionTemplate> V8TestObjectPython::domTemplate(v8::Isolate* is olate, WrapperWorldType currentWorldType) 6513 v8::Handle<v8::FunctionTemplate> V8TestObjectPython::domTemplate(v8::Isolate* is olate, WrapperWorldType currentWorldType)
6514 { 6514 {
6515 V8PerIsolateData* data = V8PerIsolateData::from(isolate); 6515 V8PerIsolateData* data = V8PerIsolateData::from(isolate);
6516 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo rldType).find(&wrapperTypeInfo); 6516 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo rldType).find(&wrapperTypeInfo);
6517 if (result != data->templateMap(currentWorldType).end()) 6517 if (result != data->templateMap(currentWorldType).end())
6518 return result->value.newLocal(isolate); 6518 return result->value.newLocal(isolate);
6519 6519
6520 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); 6520 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate");
6521 v8::EscapableHandleScope handleScope(isolate); 6521 v8::EscapableHandleScope handleScope(isolate);
6522 v8::Local<v8::FunctionTemplate> templ = 6522 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate, V 8ObjectConstructor::isValidConstructorMode);
6523 ConfigureV8TestObjectPythonTemplate(data->rawDOMTemplate(&wrapperTypeInf o, currentWorldType), isolate, currentWorldType); 6523 configureV8TestObjectPythonTemplate(templ, isolate, currentWorldType);
6524 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v 8::FunctionTemplate>(isolate, templ)); 6524 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v 8::FunctionTemplate>(isolate, templ));
6525 return handleScope.Escape(templ); 6525 return handleScope.Escape(templ);
6526 } 6526 }
6527 6527
6528 bool V8TestObjectPython::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isolate* isolate, WrapperWorldType currentWorldType) 6528 bool V8TestObjectPython::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isolate* isolate, WrapperWorldType currentWorldType)
6529 { 6529 {
6530 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu e, currentWorldType); 6530 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu e, currentWorldType);
6531 } 6531 }
6532 6532
6533 bool V8TestObjectPython::hasInstanceInAnyWorld(v8::Handle<v8::Value> jsValue, v8 ::Isolate* isolate) 6533 bool V8TestObjectPython::hasInstanceInAnyWorld(v8::Handle<v8::Value> jsValue, v8 ::Isolate* isolate)
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
6581 fromInternalPointer(object)->deref(); 6581 fromInternalPointer(object)->deref();
6582 } 6582 }
6583 6583
6584 template<> 6584 template<>
6585 v8::Handle<v8::Value> toV8NoInline(TestObjectPython* impl, v8::Handle<v8::Object > creationContext, v8::Isolate* isolate) 6585 v8::Handle<v8::Value> toV8NoInline(TestObjectPython* impl, v8::Handle<v8::Object > creationContext, v8::Isolate* isolate)
6586 { 6586 {
6587 return toV8(impl, creationContext, isolate); 6587 return toV8(impl, creationContext, isolate);
6588 } 6588 }
6589 6589
6590 } // namespace WebCore 6590 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/tests/results/V8TestObject.cpp ('k') | Source/bindings/tests/results/V8TestTypedefs.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698