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

Side by Side Diff: Source/bindings/tests/results/V8TestInterfacePython2.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 "V8TestInterfacePython2.h" 34 #include "V8TestInterfacePython2.h"
35 35
36 #include "RuntimeEnabledFeatures.h" 36 #include "RuntimeEnabledFeatures.h"
37 #include "V8Interface1.h" 37 #include "V8Interface1.h"
38 #include "V8Interface2.h" 38 #include "V8Interface2.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/V8GCController.h" 41 #include "bindings/v8/V8GCController.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 "core/dom/Element.h" 45 #include "core/dom/Element.h"
45 #include "platform/TraceEvent.h" 46 #include "platform/TraceEvent.h"
46 47
47 namespace WebCore { 48 namespace WebCore {
48 49
49 static void initializeScriptWrappableForInterface(TestInterfacePython2* object) 50 static void initializeScriptWrappableForInterface(TestInterfacePython2* object)
50 { 51 {
51 if (ScriptWrappable::wrapperCanBeStoredInObject(object)) 52 if (ScriptWrappable::wrapperCanBeStoredInObject(object))
(...skipping 25 matching lines...) Expand all
77 void V8TestInterfacePython2::visitDOMWrapper(void* object, const v8::Persistent< v8::Object>& wrapper, v8::Isolate* isolate) 78 void V8TestInterfacePython2::visitDOMWrapper(void* object, const v8::Persistent< v8::Object>& wrapper, v8::Isolate* isolate)
78 { 79 {
79 TestInterfacePython2* impl = fromInternalPointer(object); 80 TestInterfacePython2* impl = fromInternalPointer(object);
80 if (Node* owner = impl->ownerNode()) { 81 if (Node* owner = impl->ownerNode()) {
81 setObjectGroup(V8GCController::opaqueRootForGC(owner, isolate), wrapper, isolate); 82 setObjectGroup(V8GCController::opaqueRootForGC(owner, isolate), wrapper, isolate);
82 return; 83 return;
83 } 84 }
84 setObjectGroup(object, wrapper, isolate); 85 setObjectGroup(object, wrapper, isolate);
85 } 86 }
86 87
87 static v8::Handle<v8::FunctionTemplate> ConfigureV8TestInterfacePython2Template( v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate, Wrapper WorldType currentWorldType) 88 static void configureV8TestInterfacePython2Template(v8::Handle<v8::FunctionTempl ate> functionTemplate, v8::Isolate* isolate, WrapperWorldType currentWorldType)
88 { 89 {
89 functionTemplate->ReadOnlyPrototype(); 90 functionTemplate->ReadOnlyPrototype();
90 91
91 v8::Local<v8::Signature> defaultSignature; 92 v8::Local<v8::Signature> defaultSignature;
92 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl ate, "TestInterfacePython2", v8::Local<v8::FunctionTemplate>(), V8TestInterfaceP ython2::internalFieldCount, 93 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl ate, "TestInterfacePython2", v8::Local<v8::FunctionTemplate>(), V8TestInterfaceP ython2::internalFieldCount,
93 0, 0, 94 0, 0,
94 0, 0, 95 0, 0,
95 0, 0, 96 0, 0,
96 isolate, currentWorldType); 97 isolate, currentWorldType);
97 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla te->InstanceTemplate(); 98 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla te->InstanceTemplate();
98 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTempl ate->PrototypeTemplate(); 99 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTempl ate->PrototypeTemplate();
99 100
100 // Custom toString template 101 // Custom toString template
101 functionTemplate->Set(v8::String::NewFromUtf8(isolate, "toString", v8::Strin g::kInternalizedString), V8PerIsolateData::current()->toStringTemplate()); 102 functionTemplate->Set(v8::String::NewFromUtf8(isolate, "toString", v8::Strin g::kInternalizedString), V8PerIsolateData::current()->toStringTemplate());
102 return functionTemplate;
103 } 103 }
104 104
105 v8::Handle<v8::FunctionTemplate> V8TestInterfacePython2::domTemplate(v8::Isolate * isolate, WrapperWorldType currentWorldType) 105 v8::Handle<v8::FunctionTemplate> V8TestInterfacePython2::domTemplate(v8::Isolate * isolate, WrapperWorldType currentWorldType)
106 { 106 {
107 V8PerIsolateData* data = V8PerIsolateData::from(isolate); 107 V8PerIsolateData* data = V8PerIsolateData::from(isolate);
108 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo rldType).find(&wrapperTypeInfo); 108 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo rldType).find(&wrapperTypeInfo);
109 if (result != data->templateMap(currentWorldType).end()) 109 if (result != data->templateMap(currentWorldType).end())
110 return result->value.newLocal(isolate); 110 return result->value.newLocal(isolate);
111 111
112 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); 112 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate");
113 v8::EscapableHandleScope handleScope(isolate); 113 v8::EscapableHandleScope handleScope(isolate);
114 v8::Local<v8::FunctionTemplate> templ = 114 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate, V 8ObjectConstructor::isValidConstructorMode);
115 ConfigureV8TestInterfacePython2Template(data->rawDOMTemplate(&wrapperTyp eInfo, currentWorldType), isolate, currentWorldType); 115 configureV8TestInterfacePython2Template(templ, isolate, currentWorldType);
116 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v 8::FunctionTemplate>(isolate, templ)); 116 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v 8::FunctionTemplate>(isolate, templ));
117 return handleScope.Escape(templ); 117 return handleScope.Escape(templ);
118 } 118 }
119 119
120 bool V8TestInterfacePython2::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isol ate* isolate, WrapperWorldType currentWorldType) 120 bool V8TestInterfacePython2::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isol ate* isolate, WrapperWorldType currentWorldType)
121 { 121 {
122 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu e, currentWorldType); 122 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu e, currentWorldType);
123 } 123 }
124 124
125 bool V8TestInterfacePython2::hasInstanceInAnyWorld(v8::Handle<v8::Value> jsValue , v8::Isolate* isolate) 125 bool V8TestInterfacePython2::hasInstanceInAnyWorld(v8::Handle<v8::Value> jsValue , v8::Isolate* isolate)
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 fromInternalPointer(object)->deref(); 165 fromInternalPointer(object)->deref();
166 } 166 }
167 167
168 template<> 168 template<>
169 v8::Handle<v8::Value> toV8NoInline(TestInterfacePython2* impl, v8::Handle<v8::Ob ject> creationContext, v8::Isolate* isolate) 169 v8::Handle<v8::Value> toV8NoInline(TestInterfacePython2* impl, v8::Handle<v8::Ob ject> creationContext, v8::Isolate* isolate)
170 { 170 {
171 return toV8(impl, creationContext, isolate); 171 return toV8(impl, creationContext, isolate);
172 } 172 }
173 173
174 } // namespace WebCore 174 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/tests/results/V8TestInterfacePython.cpp ('k') | Source/bindings/tests/results/V8TestInterfacePython3.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698