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

Side by Side Diff: Source/bindings/tests/results/V8TestObject.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 5305 matching lines...) Expand 10 before | Expand all | Expand 10 after
5316 } 5316 }
5317 5317
5318 if (ConstructorMode::current() == ConstructorMode::WrapExistingObject) { 5318 if (ConstructorMode::current() == ConstructorMode::WrapExistingObject) {
5319 v8SetReturnValue(info, info.Holder()); 5319 v8SetReturnValue(info, info.Holder());
5320 return; 5320 return;
5321 } 5321 }
5322 5322
5323 TestObjV8Internal::constructor(info); 5323 TestObjV8Internal::constructor(info);
5324 } 5324 }
5325 5325
5326 static v8::Handle<v8::FunctionTemplate> ConfigureV8TestObjectTemplate(v8::Handle <v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate, WrapperWorldType currentWorldType) 5326 static void configureV8TestObjectTemplate(v8::Handle<v8::FunctionTemplate> funct ionTemplate, v8::Isolate* isolate, WrapperWorldType currentWorldType)
5327 { 5327 {
5328 functionTemplate->ReadOnlyPrototype(); 5328 functionTemplate->ReadOnlyPrototype();
5329 5329
5330 v8::Local<v8::Signature> defaultSignature; 5330 v8::Local<v8::Signature> defaultSignature;
5331 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl ate, "TestObject", V8EventTarget::domTemplate(isolate, currentWorldType), V8Test Object::internalFieldCount, 5331 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl ate, "TestObject", V8EventTarget::domTemplate(isolate, currentWorldType), V8Test Object::internalFieldCount,
5332 V8TestObjectAttributes, WTF_ARRAY_LENGTH(V8TestObjectAttributes), 5332 V8TestObjectAttributes, WTF_ARRAY_LENGTH(V8TestObjectAttributes),
5333 V8TestObjectAccessors, WTF_ARRAY_LENGTH(V8TestObjectAccessors), 5333 V8TestObjectAccessors, WTF_ARRAY_LENGTH(V8TestObjectAccessors),
5334 V8TestObjectMethods, WTF_ARRAY_LENGTH(V8TestObjectMethods), 5334 V8TestObjectMethods, WTF_ARRAY_LENGTH(V8TestObjectMethods),
5335 isolate, currentWorldType); 5335 isolate, currentWorldType);
5336 functionTemplate->SetCallHandler(V8TestObject::constructorCallback); 5336 functionTemplate->SetCallHandler(V8TestObject::constructorCallback);
(...skipping 21 matching lines...) Expand all
5358 prototypeTemplate->Set(v8::String::NewFromUtf8(isolate, "enabledAtRuntim eMethod", v8::String::kInternalizedString), v8::FunctionTemplate::New(isolate, T estObjV8Internal::enabledAtRuntimeMethodMethodCallback, v8Undefined(), defaultSi gnature, 1)); 5358 prototypeTemplate->Set(v8::String::NewFromUtf8(isolate, "enabledAtRuntim eMethod", v8::String::kInternalizedString), v8::FunctionTemplate::New(isolate, T estObjV8Internal::enabledAtRuntimeMethodMethodCallback, v8Undefined(), defaultSi gnature, 1));
5359 functionTemplate->Set(v8::String::NewFromUtf8(isolate, "deprecatedStaticMeth od", v8::String::kInternalizedString), v8::FunctionTemplate::New(isolate, TestOb jV8Internal::deprecatedStaticMethodMethodCallback, v8Undefined(), v8::Local<v8:: Signature>(), 0)); 5359 functionTemplate->Set(v8::String::NewFromUtf8(isolate, "deprecatedStaticMeth od", v8::String::kInternalizedString), v8::FunctionTemplate::New(isolate, TestOb jV8Internal::deprecatedStaticMethodMethodCallback, v8Undefined(), v8::Local<v8:: Signature>(), 0));
5360 functionTemplate->SetNativeDataProperty(v8::String::NewFromUtf8(isolate, "st aticReadOnlyLongAttr", v8::String::kInternalizedString), TestObjV8Internal::stat icReadOnlyLongAttrAttributeGetterCallback, 0, v8::External::New(isolate, 0), sta tic_cast<v8::PropertyAttribute>(v8::None), v8::Handle<v8::AccessorSignature>(), static_cast<v8::AccessControl>(v8::DEFAULT)); 5360 functionTemplate->SetNativeDataProperty(v8::String::NewFromUtf8(isolate, "st aticReadOnlyLongAttr", v8::String::kInternalizedString), TestObjV8Internal::stat icReadOnlyLongAttrAttributeGetterCallback, 0, v8::External::New(isolate, 0), sta tic_cast<v8::PropertyAttribute>(v8::None), v8::Handle<v8::AccessorSignature>(), static_cast<v8::AccessControl>(v8::DEFAULT));
5361 functionTemplate->SetNativeDataProperty(v8::String::NewFromUtf8(isolate, "st aticStringAttr", v8::String::kInternalizedString), TestObjV8Internal::staticStri ngAttrAttributeGetterCallback, TestObjV8Internal::staticStringAttrAttributeSette rCallback, v8::External::New(isolate, 0), static_cast<v8::PropertyAttribute>(v8: :None), v8::Handle<v8::AccessorSignature>(), static_cast<v8::AccessControl>(v8:: DEFAULT)); 5361 functionTemplate->SetNativeDataProperty(v8::String::NewFromUtf8(isolate, "st aticStringAttr", v8::String::kInternalizedString), TestObjV8Internal::staticStri ngAttrAttributeGetterCallback, TestObjV8Internal::staticStringAttrAttributeSette rCallback, v8::External::New(isolate, 0), static_cast<v8::PropertyAttribute>(v8: :None), v8::Handle<v8::AccessorSignature>(), static_cast<v8::AccessControl>(v8:: DEFAULT));
5362 functionTemplate->SetNativeDataProperty(v8::String::NewFromUtf8(isolate, "Te stSubObj", v8::String::kInternalizedString), TestObjV8Internal::TestObjConstruct orGetter, 0, v8::External::New(isolate, const_cast<WrapperTypeInfo*>(&V8TestSubO bj::wrapperTypeInfo)), static_cast<v8::PropertyAttribute>(v8::DontEnum), v8::Han dle<v8::AccessorSignature>(), static_cast<v8::AccessControl>(v8::DEFAULT)); 5362 functionTemplate->SetNativeDataProperty(v8::String::NewFromUtf8(isolate, "Te stSubObj", v8::String::kInternalizedString), TestObjV8Internal::TestObjConstruct orGetter, 0, v8::External::New(isolate, const_cast<WrapperTypeInfo*>(&V8TestSubO bj::wrapperTypeInfo)), static_cast<v8::PropertyAttribute>(v8::DontEnum), v8::Han dle<v8::AccessorSignature>(), static_cast<v8::AccessControl>(v8::DEFAULT));
5363 functionTemplate->SetNativeDataProperty(v8::String::NewFromUtf8(isolate, "de precatedStaticReadOnlyAttr", v8::String::kInternalizedString), TestObjV8Internal ::deprecatedStaticReadOnlyAttrAttributeGetterCallback, 0, v8::External::New(isol ate, 0), static_cast<v8::PropertyAttribute>(v8::None), v8::Handle<v8::AccessorSi gnature>(), static_cast<v8::AccessControl>(v8::DEFAULT)); 5363 functionTemplate->SetNativeDataProperty(v8::String::NewFromUtf8(isolate, "de precatedStaticReadOnlyAttr", v8::String::kInternalizedString), TestObjV8Internal ::deprecatedStaticReadOnlyAttrAttributeGetterCallback, 0, v8::External::New(isol ate, 0), static_cast<v8::PropertyAttribute>(v8::None), v8::Handle<v8::AccessorSi gnature>(), static_cast<v8::AccessControl>(v8::DEFAULT));
5364 functionTemplate->SetNativeDataProperty(v8::String::NewFromUtf8(isolate, "de precatedStaticAttr", v8::String::kInternalizedString), TestObjV8Internal::deprec atedStaticAttrAttributeGetterCallback, TestObjV8Internal::deprecatedStaticAttrAt tributeSetterCallback, v8::External::New(isolate, 0), static_cast<v8::PropertyAt tribute>(v8::None), v8::Handle<v8::AccessorSignature>(), static_cast<v8::AccessC ontrol>(v8::DEFAULT)); 5364 functionTemplate->SetNativeDataProperty(v8::String::NewFromUtf8(isolate, "de precatedStaticAttr", v8::String::kInternalizedString), TestObjV8Internal::deprec atedStaticAttrAttributeGetterCallback, TestObjV8Internal::deprecatedStaticAttrAt tributeSetterCallback, v8::External::New(isolate, 0), static_cast<v8::PropertyAt tribute>(v8::None), v8::Handle<v8::AccessorSignature>(), static_cast<v8::AccessC ontrol>(v8::DEFAULT));
5365 5365
5366 // Custom toString template 5366 // Custom toString template
5367 functionTemplate->Set(v8::String::NewFromUtf8(isolate, "toString", v8::Strin g::kInternalizedString), V8PerIsolateData::current()->toStringTemplate()); 5367 functionTemplate->Set(v8::String::NewFromUtf8(isolate, "toString", v8::Strin g::kInternalizedString), V8PerIsolateData::current()->toStringTemplate());
5368 return functionTemplate;
5369 } 5368 }
5370 5369
5371 v8::Handle<v8::FunctionTemplate> V8TestObject::domTemplate(v8::Isolate* isolate, WrapperWorldType currentWorldType) 5370 v8::Handle<v8::FunctionTemplate> V8TestObject::domTemplate(v8::Isolate* isolate, WrapperWorldType currentWorldType)
5372 { 5371 {
5373 V8PerIsolateData* data = V8PerIsolateData::from(isolate); 5372 V8PerIsolateData* data = V8PerIsolateData::from(isolate);
5374 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo rldType).find(&wrapperTypeInfo); 5373 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo rldType).find(&wrapperTypeInfo);
5375 if (result != data->templateMap(currentWorldType).end()) 5374 if (result != data->templateMap(currentWorldType).end())
5376 return result->value.newLocal(isolate); 5375 return result->value.newLocal(isolate);
5377 5376
5378 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); 5377 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate");
5379 v8::EscapableHandleScope handleScope(isolate); 5378 v8::EscapableHandleScope handleScope(isolate);
5380 v8::Local<v8::FunctionTemplate> templ = 5379 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate, V 8ObjectConstructor::isValidConstructorMode);
5381 ConfigureV8TestObjectTemplate(data->rawDOMTemplate(&wrapperTypeInfo, cur rentWorldType), isolate, currentWorldType); 5380 configureV8TestObjectTemplate(templ, isolate, currentWorldType);
5382 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v 8::FunctionTemplate>(isolate, templ)); 5381 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v 8::FunctionTemplate>(isolate, templ));
5383 return handleScope.Escape(templ); 5382 return handleScope.Escape(templ);
5384 } 5383 }
5385 5384
5386 bool V8TestObject::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isolate* isola te, WrapperWorldType currentWorldType) 5385 bool V8TestObject::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isolate* isola te, WrapperWorldType currentWorldType)
5387 { 5386 {
5388 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu e, currentWorldType); 5387 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu e, currentWorldType);
5389 } 5388 }
5390 5389
5391 bool V8TestObject::hasInstanceInAnyWorld(v8::Handle<v8::Value> jsValue, v8::Isol ate* isolate) 5390 bool V8TestObject::hasInstanceInAnyWorld(v8::Handle<v8::Value> jsValue, v8::Isol ate* isolate)
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
5444 fromInternalPointer(object)->deref(); 5443 fromInternalPointer(object)->deref();
5445 } 5444 }
5446 5445
5447 template<> 5446 template<>
5448 v8::Handle<v8::Value> toV8NoInline(TestObj* impl, v8::Handle<v8::Object> creatio nContext, v8::Isolate* isolate) 5447 v8::Handle<v8::Value> toV8NoInline(TestObj* impl, v8::Handle<v8::Object> creatio nContext, v8::Isolate* isolate)
5449 { 5448 {
5450 return toV8(impl, creationContext, isolate); 5449 return toV8(impl, creationContext, isolate);
5451 } 5450 }
5452 5451
5453 } // namespace WebCore 5452 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/tests/results/V8TestNode.cpp ('k') | Source/bindings/tests/results/V8TestObjectPython.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698