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

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

Issue 217053007: Revert of Make DOMWrapperWorld::current() return a reference instead of a pointer (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Revert 213543004 too 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
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY!
6
7 #include "config.h"
8 #include "V8TestInterface3.h"
9
10 #include "RuntimeEnabledFeatures.h"
11 #include "V8Node.h"
12 #include "bindings/v8/ExceptionState.h"
13 #include "bindings/v8/V8DOMConfiguration.h"
14 #include "bindings/v8/V8HiddenValue.h"
15 #include "bindings/v8/V8ObjectConstructor.h"
16 #include "core/dom/ContextFeatures.h"
17 #include "core/dom/Document.h"
18 #include "platform/TraceEvent.h"
19 #include "wtf/GetPtr.h"
20 #include "wtf/RefPtr.h"
21
22 namespace WebCore {
23
24 static void initializeScriptWrappableForInterface(TestInterface3* object)
25 {
26 if (ScriptWrappable::wrapperCanBeStoredInObject(object))
27 ScriptWrappable::setTypeInfoInObject(object, &V8TestInterface3::wrapperT ypeInfo);
28 else
29 ASSERT_NOT_REACHED();
30 }
31
32 } // namespace WebCore
33
34 void webCoreInitializeScriptWrappableForInterface(WebCore::TestInterface3* objec t)
35 {
36 WebCore::initializeScriptWrappableForInterface(object);
37 }
38
39 namespace WebCore {
40 const WrapperTypeInfo V8TestInterface3::wrapperTypeInfo = { gin::kEmbedderBlink, V8TestInterface3::domTemplate, V8TestInterface3::derefObject, 0, 0, V8TestInter face3::visitDOMWrapper, V8TestInterface3::installPerContextEnabledMethods, 0, Wr apperTypeObjectPrototype, false };
41
42 namespace TestInterface3V8Internal {
43
44 template <typename T> void V8_USE(T) { }
45
46 static void indexedPropertyGetterCallback(uint32_t index, const v8::PropertyCall backInfo<v8::Value>& info)
47 {
48 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMIndexedProperty");
49 V8TestInterface3::indexedPropertyGetterCustom(index, info);
50 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
51 }
52
53 static void indexedPropertySetterCallback(uint32_t index, v8::Local<v8::Value> v 8Value, const v8::PropertyCallbackInfo<v8::Value>& info)
54 {
55 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMIndexedProperty");
56 V8TestInterface3::indexedPropertySetterCustom(index, v8Value, info);
57 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
58 }
59
60 static void indexedPropertyDeleterCallback(uint32_t index, const v8::PropertyCal lbackInfo<v8::Boolean>& info)
61 {
62 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMIndexedProperty");
63 V8TestInterface3::indexedPropertyDeleterCustom(index, info);
64 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
65 }
66
67 static void namedPropertyGetterCallback(v8::Local<v8::String> name, const v8::Pr opertyCallbackInfo<v8::Value>& info)
68 {
69 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty");
70 V8TestInterface3::namedPropertyGetterCustom(name, info);
71 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
72 }
73
74 static void namedPropertySetterCallback(v8::Local<v8::String> name, v8::Local<v8 ::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info)
75 {
76 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty");
77 V8TestInterface3::namedPropertySetterCustom(name, v8Value, info);
78 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
79 }
80
81 static void namedPropertyQueryCallback(v8::Local<v8::String> name, const v8::Pro pertyCallbackInfo<v8::Integer>& info)
82 {
83 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty");
84 V8TestInterface3::namedPropertyQueryCustom(name, info);
85 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
86 }
87
88 static void namedPropertyDeleterCallback(v8::Local<v8::String> name, const v8::P ropertyCallbackInfo<v8::Boolean>& info)
89 {
90 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty");
91 V8TestInterface3::namedPropertyDeleterCustom(name, info);
92 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
93 }
94
95 static void namedPropertyEnumeratorCallback(const v8::PropertyCallbackInfo<v8::A rray>& info)
96 {
97 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty");
98 V8TestInterface3::namedPropertyEnumeratorCustom(info);
99 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
100 }
101
102 } // namespace TestInterface3V8Internal
103
104 static void configureV8TestInterface3Template(v8::Handle<v8::FunctionTemplate> f unctionTemplate, v8::Isolate* isolate)
105 {
106 functionTemplate->ReadOnlyPrototype();
107
108 v8::Local<v8::Signature> defaultSignature;
109 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl ate, "TestInterface3", v8::Local<v8::FunctionTemplate>(), V8TestInterface3::inte rnalFieldCount,
110 0, 0,
111 0, 0,
112 0, 0,
113 isolate);
114 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla te->InstanceTemplate();
115 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTempl ate->PrototypeTemplate();
116 functionTemplate->InstanceTemplate()->SetIndexedPropertyHandler(TestInterfac e3V8Internal::indexedPropertyGetterCallback, TestInterface3V8Internal::indexedPr opertySetterCallback, 0, TestInterface3V8Internal::indexedPropertyDeleterCallbac k, indexedPropertyEnumerator<TestInterface3>);
117 functionTemplate->InstanceTemplate()->SetNamedPropertyHandler(TestInterface3 V8Internal::namedPropertyGetterCallback, TestInterface3V8Internal::namedProperty SetterCallback, TestInterface3V8Internal::namedPropertyQueryCallback, TestInterf ace3V8Internal::namedPropertyDeleterCallback, TestInterface3V8Internal::namedPro pertyEnumeratorCallback);
118
119 // Custom toString template
120 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData: :current()->toStringTemplate());
121 }
122
123 v8::Handle<v8::FunctionTemplate> V8TestInterface3::domTemplate(v8::Isolate* isol ate)
124 {
125 V8PerIsolateData* data = V8PerIsolateData::from(isolate);
126 v8::Local<v8::FunctionTemplate> result = data->existingDOMTemplate(const_cas t<WrapperTypeInfo*>(&wrapperTypeInfo));
127 if (!result.IsEmpty())
128 return result;
129
130 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate");
131 result = v8::FunctionTemplate::New(isolate, V8ObjectConstructor::isValidCons tructorMode);
132 configureV8TestInterface3Template(result, isolate);
133 data->setDOMTemplate(const_cast<WrapperTypeInfo*>(&wrapperTypeInfo), result) ;
134 return result;
135 }
136
137 bool V8TestInterface3::hasInstance(v8::Handle<v8::Value> v8Value, v8::Isolate* i solate)
138 {
139 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Valu e);
140 }
141
142 v8::Handle<v8::Object> V8TestInterface3::findInstanceInPrototypeChain(v8::Handle <v8::Value> v8Value, v8::Isolate* isolate)
143 {
144 return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrappe rTypeInfo, v8Value);
145 }
146
147 TestInterface3* V8TestInterface3::toNativeWithTypeCheck(v8::Isolate* isolate, v8 ::Handle<v8::Value> value)
148 {
149 return hasInstance(value, isolate) ? fromInternalPointer(v8::Handle<v8::Obje ct>::Cast(value)->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex)) : 0;
150 }
151
152 v8::Handle<v8::Object> V8TestInterface3::createWrapper(PassRefPtr<TestInterface3 > impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
153 {
154 ASSERT(impl);
155 ASSERT(!DOMDataStore::containsWrapper<V8TestInterface3>(impl.get(), isolate) );
156 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) {
157 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje ct(impl.get());
158 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper TypeInfo. These will both have
159 // the same object de-ref functions, though, so use that as the basis of the check.
160 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction == wrapperTypeInfo.derefObjectFunction);
161 }
162
163 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext , &wrapperTypeInfo, toInternalPointer(impl.get()), isolate);
164 if (UNLIKELY(wrapper.IsEmpty()))
165 return wrapper;
166
167 installPerContextEnabledProperties(wrapper, impl.get(), isolate);
168 V8DOMWrapper::associateObjectWithWrapper<V8TestInterface3>(impl, &wrapperTyp eInfo, wrapper, isolate, WrapperConfiguration::Dependent);
169 return wrapper;
170 }
171
172 void V8TestInterface3::derefObject(void* object)
173 {
174 fromInternalPointer(object)->deref();
175 }
176
177 template<>
178 v8::Handle<v8::Value> toV8NoInline(TestInterface3* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
179 {
180 return toV8(impl, creationContext, isolate);
181 }
182
183 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/tests/results/V8TestInterface3.h ('k') | Source/bindings/tests/results/V8TestInterfaceCheckSecurity.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698