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

Unified Diff: third_party/WebKit/Source/platform/v8_inspector/V8StringUtil.cpp

Issue 1784463002: DevTools: [regression] do not go back and forth via utf8 in the debugger/runtime agents. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2661
Patch Set: Created 4 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/v8_inspector/V8StringUtil.cpp
diff --git a/third_party/WebKit/Source/platform/v8_inspector/V8StringUtil.cpp b/third_party/WebKit/Source/platform/v8_inspector/V8StringUtil.cpp
index 69c92e4b799e29e64fe22da259c49667134cbc15..f17d971fe335e8d38457892197b654e85bdc116b 100644
--- a/third_party/WebKit/Source/platform/v8_inspector/V8StringUtil.cpp
+++ b/third_party/WebKit/Source/platform/v8_inspector/V8StringUtil.cpp
@@ -136,12 +136,20 @@ PassOwnPtr<V8Regex> createSearchRegex(V8DebuggerImpl* debugger, const String& qu
v8::Local<v8::String> toV8String(v8::Isolate* isolate, const String& string)
{
- return v8::String::NewFromUtf8(isolate, string.utf8().data(), v8::NewStringType::kNormal).ToLocalChecked();
+ if (string.isNull())
+ return v8::String::Empty(isolate);
+ if (string.is8Bit())
+ return v8::String::NewFromOneByte(isolate, string.characters8(), v8::NewStringType::kNormal, string.length()).ToLocalChecked();
+ return v8::String::NewFromTwoByte(isolate, reinterpret_cast<const uint16_t*>(string.characters16()), v8::NewStringType::kNormal, string.length()).ToLocalChecked();
}
v8::Local<v8::String> toV8StringInternalized(v8::Isolate* isolate, const String& string)
{
- return v8::String::NewFromUtf8(isolate, string.utf8().data(), v8::NewStringType::kInternalized).ToLocalChecked();
+ if (string.isNull())
+ return v8::String::Empty(isolate);
+ if (string.is8Bit())
+ return v8::String::NewFromOneByte(isolate, string.characters8(), v8::NewStringType::kInternalized, string.length()).ToLocalChecked();
+ return v8::String::NewFromTwoByte(isolate, reinterpret_cast<const uint16_t*>(string.characters16()), v8::NewStringType::kInternalized, string.length()).ToLocalChecked();
}
String toWTFString(v8::Local<v8::String> value)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698