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

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

Issue 116983005: Use v8AtomicString instead of v8::String::NewFromUtf8 (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 1661 matching lines...) Expand 10 before | Expand all | Expand 10 after
1672 1672
1673 static void cachedAttribute2AttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) 1673 static void cachedAttribute2AttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
1674 { 1674 {
1675 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 1675 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
1676 TestObjV8Internal::cachedAttribute2AttributeGetter(info); 1676 TestObjV8Internal::cachedAttribute2AttributeGetter(info);
1677 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 1677 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
1678 } 1678 }
1679 1679
1680 static void cachedDirtyableAttributeAttributeGetter(const v8::PropertyCallbackIn fo<v8::Value>& info) 1680 static void cachedDirtyableAttributeAttributeGetter(const v8::PropertyCallbackIn fo<v8::Value>& info)
1681 { 1681 {
1682 v8::Handle<v8::String> propertyName = v8::String::NewFromUtf8(info.GetIsolat e(), "cachedDirtyableAttribute", v8::String::kInternalizedString); 1682 v8::Handle<v8::String> propertyName = v8AtomicString(info.GetIsolate(), "cac hedDirtyableAttribute");
1683 TestObj* imp = V8TestObject::toNative(info.Holder()); 1683 TestObj* imp = V8TestObject::toNative(info.Holder());
1684 if (!imp->isValueDirty()) { 1684 if (!imp->isValueDirty()) {
1685 v8::Handle<v8::Value> jsValue = info.Holder()->GetHiddenValue(propertyNa me); 1685 v8::Handle<v8::Value> jsValue = info.Holder()->GetHiddenValue(propertyNa me);
1686 if (!jsValue.IsEmpty()) { 1686 if (!jsValue.IsEmpty()) {
1687 v8SetReturnValue(info, jsValue); 1687 v8SetReturnValue(info, jsValue);
1688 return; 1688 return;
1689 } 1689 }
1690 } 1690 }
1691 ScriptValue jsValue = imp->cachedDirtyableAttribute(); 1691 ScriptValue jsValue = imp->cachedDirtyableAttribute();
1692 info.Holder()->SetHiddenValue(propertyName, jsValue.v8Value()); 1692 info.Holder()->SetHiddenValue(propertyName, jsValue.v8Value());
1693 v8SetReturnValue(info, jsValue.v8Value()); 1693 v8SetReturnValue(info, jsValue.v8Value());
1694 } 1694 }
1695 1695
1696 static void cachedDirtyableAttributeAttributeGetterCallback(v8::Local<v8::String >, const v8::PropertyCallbackInfo<v8::Value>& info) 1696 static void cachedDirtyableAttributeAttributeGetterCallback(v8::Local<v8::String >, const v8::PropertyCallbackInfo<v8::Value>& info)
1697 { 1697 {
1698 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 1698 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
1699 TestObjV8Internal::cachedDirtyableAttributeAttributeGetter(info); 1699 TestObjV8Internal::cachedDirtyableAttributeAttributeGetter(info);
1700 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 1700 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
1701 } 1701 }
1702 1702
1703 static void cachedDirtyableAttributeRaisesAttributeGetter(const v8::PropertyCall backInfo<v8::Value>& info) 1703 static void cachedDirtyableAttributeRaisesAttributeGetter(const v8::PropertyCall backInfo<v8::Value>& info)
1704 { 1704 {
1705 v8::Handle<v8::String> propertyName = v8::String::NewFromUtf8(info.GetIsolat e(), "cachedDirtyableAttributeRaises", v8::String::kInternalizedString); 1705 v8::Handle<v8::String> propertyName = v8AtomicString(info.GetIsolate(), "cac hedDirtyableAttributeRaises");
1706 TestObj* imp = V8TestObject::toNative(info.Holder()); 1706 TestObj* imp = V8TestObject::toNative(info.Holder());
1707 if (!imp->isValueDirty()) { 1707 if (!imp->isValueDirty()) {
1708 v8::Handle<v8::Value> jsValue = info.Holder()->GetHiddenValue(propertyNa me); 1708 v8::Handle<v8::Value> jsValue = info.Holder()->GetHiddenValue(propertyNa me);
1709 if (!jsValue.IsEmpty()) { 1709 if (!jsValue.IsEmpty()) {
1710 v8SetReturnValue(info, jsValue); 1710 v8SetReturnValue(info, jsValue);
1711 return; 1711 return;
1712 } 1712 }
1713 } 1713 }
1714 ExceptionState exceptionState(ExceptionState::GetterContext, "cachedDirtyabl eAttributeRaises", "TestObject", info.Holder(), info.GetIsolate()); 1714 ExceptionState exceptionState(ExceptionState::GetterContext, "cachedDirtyabl eAttributeRaises", "TestObject", info.Holder(), info.GetIsolate());
1715 ScriptValue jsValue = imp->cachedDirtyableAttributeRaises(exceptionState); 1715 ScriptValue jsValue = imp->cachedDirtyableAttributeRaises(exceptionState);
(...skipping 3659 matching lines...) Expand 10 before | Expand all | Expand 10 after
5375 v8::Handle<v8::FunctionTemplate> svgPointMethodArgv[svgPointMethodArgc] = { V8PerIsolateData::from(isolate)->rawDOMTemplate(&V8SVGPoint::wrapperTypeInfo, cu rrentWorldType), v8::Handle<v8::FunctionTemplate>() }; 5375 v8::Handle<v8::FunctionTemplate> svgPointMethodArgv[svgPointMethodArgc] = { V8PerIsolateData::from(isolate)->rawDOMTemplate(&V8SVGPoint::wrapperTypeInfo, cu rrentWorldType), v8::Handle<v8::FunctionTemplate>() };
5376 v8::Handle<v8::Signature> svgPointMethodSignature = v8::Signature::New(isola te, functionTemplate, svgPointMethodArgc, svgPointMethodArgv); 5376 v8::Handle<v8::Signature> svgPointMethodSignature = v8::Signature::New(isola te, functionTemplate, svgPointMethodArgc, svgPointMethodArgv);
5377 prototypeTemplate->Set(v8::String::NewFromUtf8(isolate, "svgPointMethod", v8 ::String::kInternalizedString), v8::FunctionTemplate::New(isolate, TestObjV8Inte rnal::svgPointMethodMethodCallback, v8Undefined(), svgPointMethodSignature, 2)); 5377 prototypeTemplate->Set(v8::String::NewFromUtf8(isolate, "svgPointMethod", v8 ::String::kInternalizedString), v8::FunctionTemplate::New(isolate, TestObjV8Inte rnal::svgPointMethodMethodCallback, v8Undefined(), svgPointMethodSignature, 2));
5378 5378
5379 // Custom Signature 'variadicNodeMethod' 5379 // Custom Signature 'variadicNodeMethod'
5380 const int variadicNodeMethodArgc = 2; 5380 const int variadicNodeMethodArgc = 2;
5381 v8::Handle<v8::FunctionTemplate> variadicNodeMethodArgv[variadicNodeMethodAr gc] = { V8PerIsolateData::from(isolate)->rawDOMTemplate(&V8Node::wrapperTypeInfo , currentWorldType), V8PerIsolateData::from(isolate)->rawDOMTemplate(&V8Node::wr apperTypeInfo, currentWorldType) }; 5381 v8::Handle<v8::FunctionTemplate> variadicNodeMethodArgv[variadicNodeMethodAr gc] = { V8PerIsolateData::from(isolate)->rawDOMTemplate(&V8Node::wrapperTypeInfo , currentWorldType), V8PerIsolateData::from(isolate)->rawDOMTemplate(&V8Node::wr apperTypeInfo, currentWorldType) };
5382 v8::Handle<v8::Signature> variadicNodeMethodSignature = v8::Signature::New(i solate, functionTemplate, variadicNodeMethodArgc, variadicNodeMethodArgv); 5382 v8::Handle<v8::Signature> variadicNodeMethodSignature = v8::Signature::New(i solate, functionTemplate, variadicNodeMethodArgc, variadicNodeMethodArgv);
5383 prototypeTemplate->Set(v8::String::NewFromUtf8(isolate, "variadicNodeMethod" , v8::String::kInternalizedString), v8::FunctionTemplate::New(isolate, TestObjV8 Internal::variadicNodeMethodMethodCallback, v8Undefined(), variadicNodeMethodSig nature, 2)); 5383 prototypeTemplate->Set(v8::String::NewFromUtf8(isolate, "variadicNodeMethod" , v8::String::kInternalizedString), v8::FunctionTemplate::New(isolate, TestObjV8 Internal::variadicNodeMethodMethodCallback, v8Undefined(), variadicNodeMethodSig nature, 2));
5384 functionTemplate->Set(v8::String::NewFromUtf8(isolate, "deprecatedStaticMeth od", v8::String::kInternalizedString), v8::FunctionTemplate::New(isolate, TestOb jV8Internal::deprecatedStaticMethodMethodCallback, v8Undefined(), v8::Local<v8:: Signature>(), 0)); 5384 functionTemplate->Set(v8::String::NewFromUtf8(isolate, "deprecatedStaticMeth od", v8::String::kInternalizedString), v8::FunctionTemplate::New(isolate, TestOb jV8Internal::deprecatedStaticMethodMethodCallback, v8Undefined(), v8::Local<v8:: Signature>(), 0));
5385 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)); 5385 functionTemplate->SetNativeDataProperty(v8AtomicString(isolate, "staticReadO nlyLongAttr"), TestObjV8Internal::staticReadOnlyLongAttrAttributeGetterCallback, 0, v8::External::New(isolate, 0), static_cast<v8::PropertyAttribute>(v8::None), v8::Handle<v8::AccessorSignature>(), static_cast<v8::AccessControl>(v8::DEFAULT ));
5386 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)); 5386 functionTemplate->SetNativeDataProperty(v8AtomicString(isolate, "staticStrin gAttr"), TestObjV8Internal::staticStringAttrAttributeGetterCallback, TestObjV8In ternal::staticStringAttrAttributeSetterCallback, v8::External::New(isolate, 0), static_cast<v8::PropertyAttribute>(v8::None), v8::Handle<v8::AccessorSignature>( ), static_cast<v8::AccessControl>(v8::DEFAULT));
5387 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)); 5387 functionTemplate->SetNativeDataProperty(v8AtomicString(isolate, "TestSubObj" ), TestObjV8Internal::TestObjConstructorGetter, 0, v8::External::New(isolate, co nst_cast<WrapperTypeInfo*>(&V8TestSubObj::wrapperTypeInfo)), static_cast<v8::Pro pertyAttribute>(v8::DontEnum), v8::Handle<v8::AccessorSignature>(), static_cast< v8::AccessControl>(v8::DEFAULT));
5388 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)); 5388 functionTemplate->SetNativeDataProperty(v8AtomicString(isolate, "deprecatedS taticReadOnlyAttr"), TestObjV8Internal::deprecatedStaticReadOnlyAttrAttributeGet terCallback, 0, v8::External::New(isolate, 0), static_cast<v8::PropertyAttribute >(v8::None), v8::Handle<v8::AccessorSignature>(), static_cast<v8::AccessControl> (v8::DEFAULT));
5389 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)); 5389 functionTemplate->SetNativeDataProperty(v8AtomicString(isolate, "deprecatedS taticAttr"), TestObjV8Internal::deprecatedStaticAttrAttributeGetterCallback, Tes tObjV8Internal::deprecatedStaticAttrAttributeSetterCallback, v8::External::New(i solate, 0), static_cast<v8::PropertyAttribute>(v8::None), v8::Handle<v8::Accesso rSignature>(), static_cast<v8::AccessControl>(v8::DEFAULT));
5390 5390
5391 // Custom toString template 5391 // Custom toString template
5392 functionTemplate->Set(v8::String::NewFromUtf8(isolate, "toString", v8::Strin g::kInternalizedString), V8PerIsolateData::current()->toStringTemplate()); 5392 functionTemplate->Set(v8::String::NewFromUtf8(isolate, "toString", v8::Strin g::kInternalizedString), V8PerIsolateData::current()->toStringTemplate());
5393 return functionTemplate; 5393 return functionTemplate;
5394 } 5394 }
5395 5395
5396 v8::Handle<v8::FunctionTemplate> V8TestObject::domTemplate(v8::Isolate* isolate, WrapperWorldType currentWorldType) 5396 v8::Handle<v8::FunctionTemplate> V8TestObject::domTemplate(v8::Isolate* isolate, WrapperWorldType currentWorldType)
5397 { 5397 {
5398 V8PerIsolateData* data = V8PerIsolateData::from(isolate); 5398 V8PerIsolateData* data = V8PerIsolateData::from(isolate);
5399 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo rldType).find(&wrapperTypeInfo); 5399 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo rldType).find(&wrapperTypeInfo);
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
5469 fromInternalPointer(object)->deref(); 5469 fromInternalPointer(object)->deref();
5470 } 5470 }
5471 5471
5472 template<> 5472 template<>
5473 v8::Handle<v8::Value> toV8NoInline(TestObj* impl, v8::Handle<v8::Object> creatio nContext, v8::Isolate* isolate) 5473 v8::Handle<v8::Value> toV8NoInline(TestObj* impl, v8::Handle<v8::Object> creatio nContext, v8::Isolate* isolate)
5474 { 5474 {
5475 return toV8(impl, creationContext, isolate); 5475 return toV8(impl, creationContext, isolate);
5476 } 5476 }
5477 5477
5478 } // namespace WebCore 5478 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698