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

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

Issue 39393004: IDL compiler: rename WrapperTypeInfo info => wrapperTypeInfo (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 1 month 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 This file is part of the Blink open source project. 2 This file is part of the Blink open source project.
3 This file has been auto-generated by CodeGeneratorV8.pm. DO NOT MODIFY! 3 This file has been auto-generated by CodeGeneratorV8.pm. DO NOT MODIFY!
4 4
5 This library is free software; you can redistribute it and/or 5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public 6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either 7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version. 8 version 2 of the License, or (at your option) any later version.
9 9
10 This library is distributed in the hope that it will be useful, 10 This library is distributed in the hope that it will be useful,
(...skipping 22 matching lines...) Expand all
33 #include "core/dom/ContextFeatures.h" 33 #include "core/dom/ContextFeatures.h"
34 #include "core/dom/Document.h" 34 #include "core/dom/Document.h"
35 #include "platform/TraceEvent.h" 35 #include "platform/TraceEvent.h"
36 #include "wtf/UnusedParam.h" 36 #include "wtf/UnusedParam.h"
37 37
38 namespace WebCore { 38 namespace WebCore {
39 39
40 static void initializeScriptWrappableForInterface(TestActiveDOMObject* object) 40 static void initializeScriptWrappableForInterface(TestActiveDOMObject* object)
41 { 41 {
42 if (ScriptWrappable::wrapperCanBeStoredInObject(object)) 42 if (ScriptWrappable::wrapperCanBeStoredInObject(object))
43 ScriptWrappable::setTypeInfoInObject(object, &V8TestActiveDOMObject::inf o); 43 ScriptWrappable::setTypeInfoInObject(object, &V8TestActiveDOMObject::wra pperTypeInfo);
44 else 44 else
45 ASSERT_NOT_REACHED(); 45 ASSERT_NOT_REACHED();
46 } 46 }
47 47
48 } // namespace WebCore 48 } // namespace WebCore
49 49
50 // In ScriptWrappable::init, the use of a local function declaration has an issu e on Windows: 50 // In ScriptWrappable::init, the use of a local function declaration has an issu e on Windows:
51 // the local declaration does not pick up the surrounding namespace. Therefore, we provide this function 51 // the local declaration does not pick up the surrounding namespace. Therefore, we provide this function
52 // in the global namespace. 52 // in the global namespace.
53 // (More info on the MSVC bug here: http://connect.microsoft.com/VisualStudio/fe edback/details/664619/the-namespace-of-local-function-declarations-in-c) 53 // (More info on the MSVC bug here: http://connect.microsoft.com/VisualStudio/fe edback/details/664619/the-namespace-of-local-function-declarations-in-c)
54 void webCoreInitializeScriptWrappableForInterface(WebCore::TestActiveDOMObject* object) 54 void webCoreInitializeScriptWrappableForInterface(WebCore::TestActiveDOMObject* object)
55 { 55 {
56 WebCore::initializeScriptWrappableForInterface(object); 56 WebCore::initializeScriptWrappableForInterface(object);
57 } 57 }
58 58
59 namespace WebCore { 59 namespace WebCore {
60 WrapperTypeInfo V8TestActiveDOMObject::info = { V8TestActiveDOMObject::GetTempla te, V8TestActiveDOMObject::derefObject, 0, 0, 0, V8TestActiveDOMObject::installP erContextEnabledPrototypeProperties, 0, WrapperTypeObjectPrototype }; 60 WrapperTypeInfo V8TestActiveDOMObject::wrapperTypeInfo = { V8TestActiveDOMObject ::GetTemplate, V8TestActiveDOMObject::derefObject, 0, 0, 0, V8TestActiveDOMObjec t::installPerContextEnabledPrototypeProperties, 0, WrapperTypeObjectPrototype };
61 61
62 namespace TestActiveDOMObjectV8Internal { 62 namespace TestActiveDOMObjectV8Internal {
63 63
64 template <typename T> void V8_USE(T) { } 64 template <typename T> void V8_USE(T) { }
65 65
66 static void excitingAttrAttributeGetter(v8::Local<v8::String> name, const v8::Pr opertyCallbackInfo<v8::Value>& info) 66 static void excitingAttrAttributeGetter(v8::Local<v8::String> name, const v8::Pr opertyCallbackInfo<v8::Value>& info)
67 { 67 {
68 TestActiveDOMObject* imp = V8TestActiveDOMObject::toNative(info.Holder()); 68 TestActiveDOMObject* imp = V8TestActiveDOMObject::toNative(info.Holder());
69 v8SetReturnValueInt(info, imp->excitingAttr()); 69 v8SetReturnValueInt(info, imp->excitingAttr());
70 } 70 }
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 TestActiveDOMObjectV8Internal::postMessageMethod(args); 132 TestActiveDOMObjectV8Internal::postMessageMethod(args);
133 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 133 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
134 } 134 }
135 135
136 static void postMessageAttributeGetter(v8::Local<v8::String> name, const v8::Pro pertyCallbackInfo<v8::Value>& info) 136 static void postMessageAttributeGetter(v8::Local<v8::String> name, const v8::Pro pertyCallbackInfo<v8::Value>& info)
137 { 137 {
138 // This is only for getting a unique pointer which we can pass to privateTem plate. 138 // This is only for getting a unique pointer which we can pass to privateTem plate.
139 static const char* privateTemplateUniqueKey = "postMessagePrivateTemplate"; 139 static const char* privateTemplateUniqueKey = "postMessagePrivateTemplate";
140 WrapperWorldType currentWorldType = worldType(info.GetIsolate()); 140 WrapperWorldType currentWorldType = worldType(info.GetIsolate());
141 V8PerIsolateData* data = V8PerIsolateData::from(info.GetIsolate()); 141 V8PerIsolateData* data = V8PerIsolateData::from(info.GetIsolate());
142 v8::Handle<v8::FunctionTemplate> privateTemplate = data->privateTemplate(cur rentWorldType, &privateTemplateUniqueKey, TestActiveDOMObjectV8Internal::postMes sageMethodCallback, v8Undefined(), v8::Signature::New(V8PerIsolateData::from(inf o.GetIsolate())->rawTemplate(&V8TestActiveDOMObject::info, currentWorldType)), 1 ); 142 v8::Handle<v8::FunctionTemplate> privateTemplate = data->privateTemplate(cur rentWorldType, &privateTemplateUniqueKey, TestActiveDOMObjectV8Internal::postMes sageMethodCallback, v8Undefined(), v8::Signature::New(V8PerIsolateData::from(inf o.GetIsolate())->rawTemplate(&V8TestActiveDOMObject::wrapperTypeInfo, currentWor ldType)), 1);
143 143
144 v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain(V8 TestActiveDOMObject::GetTemplate(info.GetIsolate(), currentWorldType)); 144 v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain(V8 TestActiveDOMObject::GetTemplate(info.GetIsolate(), currentWorldType));
145 if (holder.IsEmpty()) { 145 if (holder.IsEmpty()) {
146 // can only reach here by 'object.__proto__.func', and it should passed 146 // can only reach here by 'object.__proto__.func', and it should passed
147 // domain security check already 147 // domain security check already
148 v8SetReturnValue(info, privateTemplate->GetFunction()); 148 v8SetReturnValue(info, privateTemplate->GetFunction());
149 return; 149 return;
150 } 150 }
151 TestActiveDOMObject* imp = V8TestActiveDOMObject::toNative(holder); 151 TestActiveDOMObject* imp = V8TestActiveDOMObject::toNative(holder);
152 if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), DoNotReportSecu rityError)) { 152 if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), DoNotReportSecu rityError)) {
153 static const char* sharedTemplateUniqueKey = "postMessageSharedTemplate" ; 153 static const char* sharedTemplateUniqueKey = "postMessageSharedTemplate" ;
154 v8::Handle<v8::FunctionTemplate> sharedTemplate = data->privateTemplate( currentWorldType, &sharedTemplateUniqueKey, TestActiveDOMObjectV8Internal::postM essageMethodCallback, v8Undefined(), v8::Signature::New(V8PerIsolateData::from(i nfo.GetIsolate())->rawTemplate(&V8TestActiveDOMObject::info, currentWorldType)), 1); 154 v8::Handle<v8::FunctionTemplate> sharedTemplate = data->privateTemplate( currentWorldType, &sharedTemplateUniqueKey, TestActiveDOMObjectV8Internal::postM essageMethodCallback, v8Undefined(), v8::Signature::New(V8PerIsolateData::from(i nfo.GetIsolate())->rawTemplate(&V8TestActiveDOMObject::wrapperTypeInfo, currentW orldType)), 1);
155 v8SetReturnValue(info, sharedTemplate->GetFunction()); 155 v8SetReturnValue(info, sharedTemplate->GetFunction());
156 return; 156 return;
157 } 157 }
158 158
159 v8::Local<v8::Value> hiddenValue = info.This()->GetHiddenValue(name); 159 v8::Local<v8::Value> hiddenValue = info.This()->GetHiddenValue(name);
160 if (!hiddenValue.IsEmpty()) { 160 if (!hiddenValue.IsEmpty()) {
161 v8SetReturnValue(info, hiddenValue); 161 v8SetReturnValue(info, hiddenValue);
162 return; 162 return;
163 } 163 }
164 164
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 199
200 v8::Local<v8::Signature> defaultSignature; 200 v8::Local<v8::Signature> defaultSignature;
201 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(desc, "TestAc tiveDOMObject", v8::Local<v8::FunctionTemplate>(), V8TestActiveDOMObject::intern alFieldCount, 201 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(desc, "TestAc tiveDOMObject", v8::Local<v8::FunctionTemplate>(), V8TestActiveDOMObject::intern alFieldCount,
202 V8TestActiveDOMObjectAttributes, WTF_ARRAY_LENGTH(V8TestActiveDOMObjectA ttributes), 202 V8TestActiveDOMObjectAttributes, WTF_ARRAY_LENGTH(V8TestActiveDOMObjectA ttributes),
203 0, 0, isolate, currentWorldType); 203 0, 0, isolate, currentWorldType);
204 UNUSED_PARAM(defaultSignature); 204 UNUSED_PARAM(defaultSignature);
205 v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate(); 205 v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate();
206 v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate(); 206 v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate();
207 UNUSED_PARAM(instance); 207 UNUSED_PARAM(instance);
208 UNUSED_PARAM(proto); 208 UNUSED_PARAM(proto);
209 instance->SetAccessCheckCallbacks(TestActiveDOMObjectV8Internal::namedSecuri tyCheck, TestActiveDOMObjectV8Internal::indexedSecurityCheck, v8::External::New( &V8TestActiveDOMObject::info)); 209 instance->SetAccessCheckCallbacks(TestActiveDOMObjectV8Internal::namedSecuri tyCheck, TestActiveDOMObjectV8Internal::indexedSecurityCheck, v8::External::New( &V8TestActiveDOMObject::wrapperTypeInfo));
210 210
211 // Custom Signature 'excitingFunction' 211 // Custom Signature 'excitingFunction'
212 const int excitingFunctionArgc = 1; 212 const int excitingFunctionArgc = 1;
213 v8::Handle<v8::FunctionTemplate> excitingFunctionArgv[excitingFunctionArgc] = { V8PerIsolateData::from(isolate)->rawTemplate(&V8Node::info, currentWorldType ) }; 213 v8::Handle<v8::FunctionTemplate> excitingFunctionArgv[excitingFunctionArgc] = { V8PerIsolateData::from(isolate)->rawTemplate(&V8Node::wrapperTypeInfo, curre ntWorldType) };
214 v8::Handle<v8::Signature> excitingFunctionSignature = v8::Signature::New(des c, excitingFunctionArgc, excitingFunctionArgv); 214 v8::Handle<v8::Signature> excitingFunctionSignature = v8::Signature::New(des c, excitingFunctionArgc, excitingFunctionArgv);
215 proto->Set(v8::String::NewSymbol("excitingFunction"), v8::FunctionTemplate:: New(TestActiveDOMObjectV8Internal::excitingFunctionMethodCallback, v8Undefined() , excitingFunctionSignature, 1)); 215 proto->Set(v8::String::NewSymbol("excitingFunction"), v8::FunctionTemplate:: New(TestActiveDOMObjectV8Internal::excitingFunctionMethodCallback, v8Undefined() , excitingFunctionSignature, 1));
216 216
217 // Function 'postMessage' (Extended Attributes: 'DoNotCheckSecurity') 217 // Function 'postMessage' (Extended Attributes: 'DoNotCheckSecurity')
218 proto->SetAccessor(v8::String::NewSymbol("postMessage"), TestActiveDOMObject V8Internal::postMessageAttributeGetterCallback, TestActiveDOMObjectV8Internal::T estActiveDOMObjectDomainSafeFunctionSetter, v8Undefined(), v8::ALL_CAN_READ, sta tic_cast<v8::PropertyAttribute>(v8::DontDelete)); 218 proto->SetAccessor(v8::String::NewSymbol("postMessage"), TestActiveDOMObject V8Internal::postMessageAttributeGetterCallback, TestActiveDOMObjectV8Internal::T estActiveDOMObjectDomainSafeFunctionSetter, v8Undefined(), v8::ALL_CAN_READ, sta tic_cast<v8::PropertyAttribute>(v8::DontDelete));
219 219
220 // Custom toString template 220 // Custom toString template
221 desc->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::current()->to StringTemplate()); 221 desc->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::current()->to StringTemplate());
222 return desc; 222 return desc;
223 } 223 }
224 224
225 v8::Handle<v8::FunctionTemplate> V8TestActiveDOMObject::GetTemplate(v8::Isolate* isolate, WrapperWorldType currentWorldType) 225 v8::Handle<v8::FunctionTemplate> V8TestActiveDOMObject::GetTemplate(v8::Isolate* isolate, WrapperWorldType currentWorldType)
226 { 226 {
227 V8PerIsolateData* data = V8PerIsolateData::from(isolate); 227 V8PerIsolateData* data = V8PerIsolateData::from(isolate);
228 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo rldType).find(&info); 228 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo rldType).find(&wrapperTypeInfo);
229 if (result != data->templateMap(currentWorldType).end()) 229 if (result != data->templateMap(currentWorldType).end())
230 return result->value.newLocal(isolate); 230 return result->value.newLocal(isolate);
231 231
232 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); 232 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate");
233 v8::HandleScope handleScope(isolate); 233 v8::HandleScope handleScope(isolate);
234 v8::Handle<v8::FunctionTemplate> templ = 234 v8::Handle<v8::FunctionTemplate> templ =
235 ConfigureV8TestActiveDOMObjectTemplate(data->rawTemplate(&info, currentW orldType), isolate, currentWorldType); 235 ConfigureV8TestActiveDOMObjectTemplate(data->rawTemplate(&wrapperTypeInf o, currentWorldType), isolate, currentWorldType);
236 data->templateMap(currentWorldType).add(&info, UnsafePersistent<v8::Function Template>(isolate, templ)); 236 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v 8::FunctionTemplate>(isolate, templ));
237 return handleScope.Close(templ); 237 return handleScope.Close(templ);
238 } 238 }
239 239
240 bool V8TestActiveDOMObject::HasInstance(v8::Handle<v8::Value> jsValue, v8::Isola te* isolate, WrapperWorldType currentWorldType) 240 bool V8TestActiveDOMObject::HasInstance(v8::Handle<v8::Value> jsValue, v8::Isola te* isolate, WrapperWorldType currentWorldType)
241 { 241 {
242 return V8PerIsolateData::from(isolate)->hasInstance(&info, jsValue, currentW orldType); 242 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu e, currentWorldType);
243 } 243 }
244 244
245 bool V8TestActiveDOMObject::HasInstanceInAnyWorld(v8::Handle<v8::Value> jsValue, v8::Isolate* isolate) 245 bool V8TestActiveDOMObject::HasInstanceInAnyWorld(v8::Handle<v8::Value> jsValue, v8::Isolate* isolate)
246 { 246 {
247 return V8PerIsolateData::from(isolate)->hasInstance(&info, jsValue, MainWorl d) 247 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu e, MainWorld)
248 || V8PerIsolateData::from(isolate)->hasInstance(&info, jsValue, Isolated World) 248 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu e, IsolatedWorld)
249 || V8PerIsolateData::from(isolate)->hasInstance(&info, jsValue, WorkerWo rld); 249 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu e, WorkerWorld);
250 } 250 }
251 251
252 v8::Handle<v8::Object> V8TestActiveDOMObject::createWrapper(PassRefPtr<TestActiv eDOMObject> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) 252 v8::Handle<v8::Object> V8TestActiveDOMObject::createWrapper(PassRefPtr<TestActiv eDOMObject> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
253 { 253 {
254 ASSERT(impl); 254 ASSERT(impl);
255 ASSERT(!DOMDataStore::containsWrapper<V8TestActiveDOMObject>(impl.get(), iso late)); 255 ASSERT(!DOMDataStore::containsWrapper<V8TestActiveDOMObject>(impl.get(), iso late));
256 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { 256 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) {
257 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje ct(impl.get()); 257 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje ct(impl.get());
258 // Might be a XXXConstructor::info instead of an XXX::info. These will b oth have 258 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper TypeInfo. These will both have
259 // the same object de-ref functions, though, so use that as the basis of the check. 259 // the same object de-ref functions, though, so use that as the basis of the check.
260 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction == info.derefObjectFunction); 260 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction == wrapperTypeInfo.derefObjectFunction);
261 } 261 }
262 262
263 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext , &info, toInternalPointer(impl.get()), isolate); 263 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext , &wrapperTypeInfo, toInternalPointer(impl.get()), isolate);
264 if (UNLIKELY(wrapper.IsEmpty())) 264 if (UNLIKELY(wrapper.IsEmpty()))
265 return wrapper; 265 return wrapper;
266 266
267 installPerContextEnabledProperties(wrapper, impl.get(), isolate); 267 installPerContextEnabledProperties(wrapper, impl.get(), isolate);
268 V8DOMWrapper::associateObjectWithWrapper<V8TestActiveDOMObject>(impl, &info, wrapper, isolate, WrapperConfiguration::Independent); 268 V8DOMWrapper::associateObjectWithWrapper<V8TestActiveDOMObject>(impl, &wrapp erTypeInfo, wrapper, isolate, WrapperConfiguration::Independent);
269 return wrapper; 269 return wrapper;
270 } 270 }
271 271
272 void V8TestActiveDOMObject::derefObject(void* object) 272 void V8TestActiveDOMObject::derefObject(void* object)
273 { 273 {
274 fromInternalPointer(object)->deref(); 274 fromInternalPointer(object)->deref();
275 } 275 }
276 276
277 } // namespace WebCore 277 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/tests/results/V8TestActiveDOMObject.h ('k') | Source/bindings/tests/results/V8TestConstants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698