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

Unified Diff: test/inspector/inspector-impl.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/inspector.gyp ('k') | test/inspector/inspector-test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/inspector/inspector-impl.cc
diff --git a/test/inspector/inspector-impl.cc b/test/inspector/inspector-impl.cc
index 929fd1400caa023b9936042f396e988fff57b78b..87b3c7b4a1fa21f8344a83ab64fa93f93877f79d 100644
--- a/test/inspector/inspector-impl.cc
+++ b/test/inspector/inspector-impl.cc
@@ -5,7 +5,8 @@
#include "test/inspector/inspector-impl.h"
#include "include/v8.h"
-#include "src/inspector/string-16.h"
+
+#include "src/vector.h"
namespace {
@@ -40,10 +41,11 @@ InspectorClientImpl* InspectorClientFromContext(
return inspector_client;
}
-v8_inspector::String16 ToString16(v8::Local<v8::String> str) {
- std::unique_ptr<uint16_t[]> buffer(new uint16_t[str->Length()]);
- str->Write(reinterpret_cast<uint16_t*>(buffer.get()), 0, str->Length());
- return v8_inspector::String16(buffer.get(), str->Length());
+v8::internal::Vector<uint16_t> ToVector(v8::Local<v8::String> str) {
+ v8::internal::Vector<uint16_t> buffer =
+ v8::internal::Vector<uint16_t>::New(str->Length());
+ str->Write(buffer.start(), 0, str->Length());
+ return buffer;
}
void MessageHandler(v8::Local<v8::Message> message,
@@ -67,15 +69,15 @@ void MessageHandler(v8::Local<v8::Message> message,
column_number = message->GetStartColumn(context).FromJust() + 1;
v8_inspector::StringView detailed_message;
- v8_inspector::String16 message_text_string = ToString16(message->Get());
- v8_inspector::StringView message_text(message_text_string.characters16(),
+ v8::internal::Vector<uint16_t> message_text_string = ToVector(message->Get());
+ v8_inspector::StringView message_text(message_text_string.start(),
message_text_string.length());
- v8_inspector::String16 url_string;
+ v8::internal::Vector<uint16_t> url_string;
if (message->GetScriptOrigin().ResourceName()->IsString()) {
url_string =
- ToString16(message->GetScriptOrigin().ResourceName().As<v8::String>());
+ ToVector(message->GetScriptOrigin().ResourceName().As<v8::String>());
}
- v8_inspector::StringView url(url_string.characters16(), url_string.length());
+ v8_inspector::StringView url(url_string.start(), url_string.length());
inspector->exceptionThrown(context, message_text, exception, detailed_message,
url, line_number, column_number,
@@ -159,7 +161,8 @@ v8_inspector::V8InspectorSession* InspectorClientImpl::SessionFromContext(
class SendMessageToBackendTask : public TaskRunner::Task {
public:
- explicit SendMessageToBackendTask(const v8_inspector::String16& message)
+ explicit SendMessageToBackendTask(
+ const v8::internal::Vector<uint16_t>& message)
: message_(message) {}
bool is_inspector_task() final { return true; }
@@ -173,14 +176,12 @@ class SendMessageToBackendTask : public TaskRunner::Task {
session = InspectorClientImpl::SessionFromContext(context);
CHECK(session);
}
- v8_inspector::StringView message_view(
- reinterpret_cast<const uint16_t*>(message_.characters16()),
- message_.length());
+ v8_inspector::StringView message_view(message_.start(), message_.length());
session->dispatchProtocolMessage(message_view);
}
private:
- v8_inspector::String16 message_;
+ v8::internal::Vector<uint16_t> message_;
};
TaskRunner* SendMessageToBackendExtension::backend_task_runner_ = nullptr;
@@ -197,6 +198,5 @@ void SendMessageToBackendExtension::SendMessageToBackend(
CHECK(backend_task_runner_);
CHECK(args.Length() == 1 && args[0]->IsString());
v8::Local<v8::String> message = args[0].As<v8::String>();
- backend_task_runner_->Append(
- new SendMessageToBackendTask(ToString16(message)));
+ backend_task_runner_->Append(new SendMessageToBackendTask(ToVector(message)));
}
« no previous file with comments | « test/inspector/inspector.gyp ('k') | test/inspector/inspector-test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698