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

Unified Diff: Source/bindings/v8/V8Binding.h

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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/bindings/v8/NPV8Object.cpp ('k') | Source/bindings/v8/V8DOMConfiguration.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/v8/V8Binding.h
diff --git a/Source/bindings/v8/V8Binding.h b/Source/bindings/v8/V8Binding.h
index efb74a6157f9f701ceb42b886db942451cee7b14..0dce307d76318c7b7573c94fc0e5dd8000b2e5ed 100644
--- a/Source/bindings/v8/V8Binding.h
+++ b/Source/bindings/v8/V8Binding.h
@@ -202,6 +202,18 @@ namespace WebCore {
return V8PerIsolateData::from(isolate)->stringCache()->v8ExternalString(string.impl(), isolate);
}
+ inline v8::Handle<v8::String> v8AtomicString(v8::Isolate* isolate, const char* str)
+ {
+ ASSERT(isolate);
+ return v8::String::NewFromUtf8(isolate, str, v8::String::kInternalizedString, strlen(str));
+ }
+
+ inline v8::Handle<v8::String> v8AtomicString(v8::Isolate* isolate, const char* str, size_t length)
+ {
+ ASSERT(isolate);
+ return v8::String::NewFromUtf8(isolate, str, v8::String::kInternalizedString, length);
+ }
+
inline v8::Handle<v8::Value> v8Undefined()
{
return v8::Handle<v8::Value>();
@@ -549,7 +561,7 @@ namespace WebCore {
v8::Local<v8::Value> v8Value(v8::Local<v8::Value>::New(isolate, value));
v8::Local<v8::Object> object = v8::Local<v8::Object>::Cast(v8Value);
- v8::Local<v8::String> lengthSymbol = v8::String::NewFromUtf8(isolate, "length", v8::String::kInternalizedString, 6);
+ v8::Local<v8::String> lengthSymbol = v8AtomicString(isolate, "length");
// FIXME: The specification states that the length property should be used as fallback, if value
// is not a platform object that supports indexed properties. If it supports indexed properties,
@@ -616,19 +628,6 @@ namespace WebCore {
return std::isfinite(value) ? v8::Date::New(isolate, value) : v8::Handle<v8::Value>::Cast(v8::Null(isolate));
}
- inline v8::Handle<v8::String> v8AtomicString(v8::Isolate* isolate, const char* str)
- {
- ASSERT(isolate);
- return v8::String::NewFromUtf8(isolate, str, v8::String::kInternalizedString, strlen(str));
- }
-
- inline v8::Handle<v8::String> v8AtomicString(v8::Isolate* isolate, const char* str, size_t length)
- {
- ASSERT(isolate);
- return v8::String::NewFromUtf8(isolate, str, v8::String::kInternalizedString, length);
- }
-
-
PassRefPtr<XPathNSResolver> toXPathNSResolver(v8::Handle<v8::Value>, v8::Isolate*);
v8::Handle<v8::Object> toInnerGlobalObject(v8::Handle<v8::Context>);
« no previous file with comments | « Source/bindings/v8/NPV8Object.cpp ('k') | Source/bindings/v8/V8DOMConfiguration.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698