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

Side by Side Diff: Source/bindings/tests/results/V8TestInterfacePython.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 20 matching lines...) Expand all
31 // This file has been auto-generated by code_generator_v8.pm. DO NOT MODIFY! 31 // This file has been auto-generated by code_generator_v8.pm. DO NOT MODIFY!
32 32
33 #include "config.h" 33 #include "config.h"
34 #if ENABLE(CONDITION) 34 #if ENABLE(CONDITION)
35 #include "V8TestInterfacePython.h" 35 #include "V8TestInterfacePython.h"
36 36
37 #include "RuntimeEnabledFeatures.h" 37 #include "RuntimeEnabledFeatures.h"
38 #include "V8ReferencedType.h" 38 #include "V8ReferencedType.h"
39 #include "bindings/v8/ExceptionState.h" 39 #include "bindings/v8/ExceptionState.h"
40 #include "bindings/v8/V8DOMConfiguration.h" 40 #include "bindings/v8/V8DOMConfiguration.h"
41 #include "bindings/v8/V8ObjectConstructor.h"
41 #include "core/dom/ContextFeatures.h" 42 #include "core/dom/ContextFeatures.h"
42 #include "core/dom/Document.h" 43 #include "core/dom/Document.h"
43 #include "platform/TraceEvent.h" 44 #include "platform/TraceEvent.h"
44 45
45 namespace WebCore { 46 namespace WebCore {
46 47
47 static void initializeScriptWrappableForInterface(TestInterfacePythonImplementat ion* object) 48 static void initializeScriptWrappableForInterface(TestInterfacePythonImplementat ion* object)
48 { 49 {
49 if (ScriptWrappable::wrapperCanBeStoredInObject(object)) 50 if (ScriptWrappable::wrapperCanBeStoredInObject(object))
50 ScriptWrappable::setTypeInfoInObject(object, &V8TestInterfacePython::wra pperTypeInfo); 51 ScriptWrappable::setTypeInfoInObject(object, &V8TestInterfacePython::wra pperTypeInfo);
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 } 168 }
168 169
169 static const V8DOMConfiguration::AttributeConfiguration V8TestInterfacePythonAtt ributes[] = { 170 static const V8DOMConfiguration::AttributeConfiguration V8TestInterfacePythonAtt ributes[] = {
170 {"perWorldBindingsStringAttribute", TestInterfacePythonImplementationV8Inter nal::perWorldBindingsStringAttributeAttributeGetterCallback, TestInterfacePython ImplementationV8Internal::perWorldBindingsStringAttributeAttributeSetterCallback , TestInterfacePythonImplementationV8Internal::perWorldBindingsStringAttributeAt tributeGetterCallbackForMainWorld, TestInterfacePythonImplementationV8Internal:: perWorldBindingsStringAttributeAttributeSetterCallbackForMainWorld, 0, static_ca st<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None) , 0 /* on instance */}, 171 {"perWorldBindingsStringAttribute", TestInterfacePythonImplementationV8Inter nal::perWorldBindingsStringAttributeAttributeGetterCallback, TestInterfacePython ImplementationV8Internal::perWorldBindingsStringAttributeAttributeSetterCallback , TestInterfacePythonImplementationV8Internal::perWorldBindingsStringAttributeAt tributeGetterCallbackForMainWorld, TestInterfacePythonImplementationV8Internal:: perWorldBindingsStringAttributeAttributeSetterCallbackForMainWorld, 0, static_ca st<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None) , 0 /* on instance */},
171 }; 172 };
172 173
173 static const V8DOMConfiguration::MethodConfiguration V8TestInterfacePythonMethod s[] = { 174 static const V8DOMConfiguration::MethodConfiguration V8TestInterfacePythonMethod s[] = {
174 {"voidMethod", TestInterfacePythonImplementationV8Internal::voidMethodMethod Callback, TestInterfacePythonImplementationV8Internal::voidMethodMethodCallbackF orMainWorld, 0}, 175 {"voidMethod", TestInterfacePythonImplementationV8Internal::voidMethodMethod Callback, TestInterfacePythonImplementationV8Internal::voidMethodMethodCallbackF orMainWorld, 0},
175 }; 176 };
176 177
177 static v8::Handle<v8::FunctionTemplate> ConfigureV8TestInterfacePythonTemplate(v 8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate, WrapperW orldType currentWorldType) 178 static void configureV8TestInterfacePythonTemplate(v8::Handle<v8::FunctionTempla te> functionTemplate, v8::Isolate* isolate, WrapperWorldType currentWorldType)
178 { 179 {
179 functionTemplate->ReadOnlyPrototype(); 180 functionTemplate->ReadOnlyPrototype();
180 181
181 v8::Local<v8::Signature> defaultSignature; 182 v8::Local<v8::Signature> defaultSignature;
182 if (!RuntimeEnabledFeatures::featureNameEnabled()) 183 if (!RuntimeEnabledFeatures::featureNameEnabled())
183 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionT emplate, "", V8TestInterfaceEmpty::domTemplate(isolate, currentWorldType), V8Tes tInterfacePython::internalFieldCount, 0, 0, 0, 0, 0, 0, isolate, currentWorldTyp e); 184 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionT emplate, "", V8TestInterfaceEmpty::domTemplate(isolate, currentWorldType), V8Tes tInterfacePython::internalFieldCount, 0, 0, 0, 0, 0, 0, isolate, currentWorldTyp e);
184 else 185 else
185 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionT emplate, "TestInterfacePython", V8TestInterfaceEmpty::domTemplate(isolate, curre ntWorldType), V8TestInterfacePython::internalFieldCount, 186 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionT emplate, "TestInterfacePython", V8TestInterfaceEmpty::domTemplate(isolate, curre ntWorldType), V8TestInterfacePython::internalFieldCount,
186 V8TestInterfacePythonAttributes, WTF_ARRAY_LENGTH(V8TestInterfacePyt honAttributes), 187 V8TestInterfacePythonAttributes, WTF_ARRAY_LENGTH(V8TestInterfacePyt honAttributes),
187 0, 0, 188 0, 0,
188 V8TestInterfacePythonMethods, WTF_ARRAY_LENGTH(V8TestInterfacePython Methods), 189 V8TestInterfacePythonMethods, WTF_ARRAY_LENGTH(V8TestInterfacePython Methods),
189 isolate, currentWorldType); 190 isolate, currentWorldType);
190 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla te->InstanceTemplate(); 191 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla te->InstanceTemplate();
191 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTempl ate->PrototypeTemplate(); 192 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTempl ate->PrototypeTemplate();
192 functionTemplate->InstanceTemplate()->SetCallAsFunctionHandler(V8TestInterfa cePython::legacyCallCustom); 193 functionTemplate->InstanceTemplate()->SetCallAsFunctionHandler(V8TestInterfa cePython::legacyCallCustom);
193 194
194 // Custom toString template 195 // Custom toString template
195 functionTemplate->Set(v8::String::NewFromUtf8(isolate, "toString", v8::Strin g::kInternalizedString), V8PerIsolateData::current()->toStringTemplate()); 196 functionTemplate->Set(v8::String::NewFromUtf8(isolate, "toString", v8::Strin g::kInternalizedString), V8PerIsolateData::current()->toStringTemplate());
196 return functionTemplate;
197 } 197 }
198 198
199 v8::Handle<v8::FunctionTemplate> V8TestInterfacePython::domTemplate(v8::Isolate* isolate, WrapperWorldType currentWorldType) 199 v8::Handle<v8::FunctionTemplate> V8TestInterfacePython::domTemplate(v8::Isolate* isolate, WrapperWorldType currentWorldType)
200 { 200 {
201 V8PerIsolateData* data = V8PerIsolateData::from(isolate); 201 V8PerIsolateData* data = V8PerIsolateData::from(isolate);
202 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo rldType).find(&wrapperTypeInfo); 202 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo rldType).find(&wrapperTypeInfo);
203 if (result != data->templateMap(currentWorldType).end()) 203 if (result != data->templateMap(currentWorldType).end())
204 return result->value.newLocal(isolate); 204 return result->value.newLocal(isolate);
205 205
206 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); 206 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate");
207 v8::EscapableHandleScope handleScope(isolate); 207 v8::EscapableHandleScope handleScope(isolate);
208 v8::Local<v8::FunctionTemplate> templ = 208 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate, V 8ObjectConstructor::isValidConstructorMode);
209 ConfigureV8TestInterfacePythonTemplate(data->rawDOMTemplate(&wrapperType Info, currentWorldType), isolate, currentWorldType); 209 configureV8TestInterfacePythonTemplate(templ, isolate, currentWorldType);
210 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v 8::FunctionTemplate>(isolate, templ)); 210 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v 8::FunctionTemplate>(isolate, templ));
211 return handleScope.Escape(templ); 211 return handleScope.Escape(templ);
212 } 212 }
213 213
214 bool V8TestInterfacePython::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isola te* isolate, WrapperWorldType currentWorldType) 214 bool V8TestInterfacePython::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isola te* isolate, WrapperWorldType currentWorldType)
215 { 215 {
216 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu e, currentWorldType); 216 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu e, currentWorldType);
217 } 217 }
218 218
219 bool V8TestInterfacePython::hasInstanceInAnyWorld(v8::Handle<v8::Value> jsValue, v8::Isolate* isolate) 219 bool V8TestInterfacePython::hasInstanceInAnyWorld(v8::Handle<v8::Value> jsValue, v8::Isolate* isolate)
(...skipping 14 matching lines...) Expand all
234 } 234 }
235 235
236 template<> 236 template<>
237 v8::Handle<v8::Value> toV8NoInline(TestInterfacePythonImplementation* impl, v8:: Handle<v8::Object> creationContext, v8::Isolate* isolate) 237 v8::Handle<v8::Value> toV8NoInline(TestInterfacePythonImplementation* impl, v8:: Handle<v8::Object> creationContext, v8::Isolate* isolate)
238 { 238 {
239 return toV8(impl, creationContext, isolate); 239 return toV8(impl, creationContext, isolate);
240 } 240 }
241 241
242 } // namespace WebCore 242 } // namespace WebCore
243 #endif // ENABLE(CONDITION) 243 #endif // ENABLE(CONDITION)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698