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

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

Issue 1027593003: bindings: Use Maybe version of v8::String::NewFromUtf8() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/bindings/core/v8/ScriptValueSerializer.cpp ('k') | Source/bindings/core/v8/V8DOMConfiguration.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/core/v8/V8Binding.h
diff --git a/Source/bindings/core/v8/V8Binding.h b/Source/bindings/core/v8/V8Binding.h
index 514a9112b029e7546f69b31f5c84e0e95868d99a..ec48ec713e6847efc67ab827381cd863024ab1ca 100644
--- a/Source/bindings/core/v8/V8Binding.h
+++ b/Source/bindings/core/v8/V8Binding.h
@@ -347,16 +347,13 @@ inline v8::Handle<v8::String> v8String(v8::Isolate* isolate, const String& strin
return V8PerIsolateData::from(isolate)->stringCache()->v8ExternalString(string.impl(), isolate);
}
-inline v8::Handle<v8::String> v8AtomicString(v8::Isolate* isolate, const char* str)
+inline v8::Handle<v8::String> v8AtomicString(v8::Isolate* isolate, const char* str, int length = -1)
{
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);
+ v8::Local<v8::String> value;
+ if (LIKELY(v8::String::NewFromUtf8(isolate, str, v8::NewStringType::kInternalized, length).ToLocal(&value)))
+ return value;
+ return v8::String::Empty(isolate);
pfeldman 2015/03/25 05:43:37 At this point we know that there is a bug in the c
bashi 2015/03/25 05:50:09 OK, How about having RELEASE_ASSERT() here then?
yurys 2015/03/25 07:07:22 Having RELEASE_ASSERT_NOT_REACHED() here would be
}
inline v8::Handle<v8::Value> v8Undefined()
« no previous file with comments | « Source/bindings/core/v8/ScriptValueSerializer.cpp ('k') | Source/bindings/core/v8/V8DOMConfiguration.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698