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

Unified Diff: test/inspector/task-runner.cc

Issue 2403493002: [inspector] don't use String16 in inspector test runner (Closed)
Patch Set: a Created 4 years, 2 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 | « test/inspector/task-runner.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/inspector/task-runner.cc
diff --git a/test/inspector/task-runner.cc b/test/inspector/task-runner.cc
index c78d23b41559f5d11090c2d78aef160121989933..e4386e58ec4cfcafb88cbeb7682e85a7169eec03 100644
--- a/test/inspector/task-runner.cc
+++ b/test/inspector/task-runner.cc
@@ -117,9 +117,14 @@ TaskRunner* TaskRunner::FromContext(v8::Local<v8::Context> context) {
context->GetAlignedPointerFromEmbedderData(kTaskRunnerIndex));
}
-ExecuteStringTask::ExecuteStringTask(const v8_inspector::String16& expression)
+ExecuteStringTask::ExecuteStringTask(
+ const v8::internal::Vector<uint16_t>& expression)
: expression_(expression) {}
+ExecuteStringTask::ExecuteStringTask(
+ const v8::internal::Vector<const char>& expression)
+ : expression_utf8_(expression) {}
+
void ExecuteStringTask::Run(v8::Isolate* isolate,
const v8::Global<v8::Context>& context) {
v8::MicrotasksScope microtasks_scope(isolate,
@@ -129,11 +134,18 @@ void ExecuteStringTask::Run(v8::Isolate* isolate,
v8::Context::Scope context_scope(local_context);
v8::ScriptOrigin origin(v8::String::Empty(isolate));
- v8::Local<v8::String> source =
- v8::String::NewFromTwoByte(isolate, expression_.characters16(),
- v8::NewStringType::kNormal,
- static_cast<int>(expression_.length()))
- .ToLocalChecked();
+ v8::Local<v8::String> source;
+ if (expression_.length()) {
+ source = v8::String::NewFromTwoByte(isolate, expression_.start(),
+ v8::NewStringType::kNormal,
+ expression_.length())
+ .ToLocalChecked();
+ } else {
+ source = v8::String::NewFromUtf8(isolate, expression_utf8_.start(),
+ v8::NewStringType::kNormal,
+ expression_utf8_.length())
+ .ToLocalChecked();
+ }
v8::ScriptCompiler::Source scriptSource(source, origin);
v8::Local<v8::Script> script;
« no previous file with comments | « test/inspector/task-runner.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698