Commit 031743fc authored by Johannes Henkel's avatar Johannes Henkel Committed by Commit Bot

[DevTools] Switch the v8 inspector session state to cbor encoding.

This depends on the following patch in V8:
https://chromium-review.googlesource.com/c/v8/v8/+/1598254

Change-Id: Ic286f68b4cd4cd8be316ffe9ab9af0f6f24e413c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1604463Reviewed-by: default avatarAlexei Filippov <alph@chromium.org>
Commit-Queue: Johannes Henkel <johannes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#659099}
parent 26b3cd45
......@@ -135,7 +135,8 @@ DevToolsSession::DevToolsSession(
inspector_backend_dispatcher_(new protocol::UberDispatcher(this)),
session_state_(std::move(reattach_session_state)),
v8_session_state_(kV8StateKey),
v8_session_state_json_(&v8_session_state_, /*default_value=*/String()) {
v8_session_state_cbor_(&v8_session_state_,
/*default_value=*/std::vector<uint8_t>()) {
io_session_ =
new IOSession(agent_->io_task_runner_, agent_->inspector_task_runner_,
WrapCrossThreadWeakPersistent(this), std::move(io_request));
......@@ -160,9 +161,10 @@ DevToolsSession::~DevToolsSession() {
void DevToolsSession::ConnectToV8(v8_inspector::V8Inspector* inspector,
int context_group_id) {
const std::vector<uint8_t>& cbor = v8_session_state_cbor_.Get();
v8_session_ =
inspector->connect(context_group_id, this,
ToV8InspectorStringView(v8_session_state_json_.Get()));
v8_inspector::StringView(cbor.data(), cbor.size()));
}
bool DevToolsSession::IsDetached() {
......@@ -285,7 +287,7 @@ void DevToolsSession::SendProtocolResponse(
return;
flushProtocolNotifications();
if (v8_session_)
v8_session_state_json_.Set(ToCoreString(v8_session_->stateJSON()));
v8_session_state_cbor_.Set(v8_session_->state());
// Make tests more predictable by flushing all sessions before sending
// protocol response in any of them.
if (WebTestSupport::IsRunningWebTest())
......@@ -356,7 +358,7 @@ void DevToolsSession::flushProtocolNotifications() {
if (!notification_queue_.size())
return;
if (v8_session_)
v8_session_state_json_.Set(ToCoreString(v8_session_->stateJSON()));
v8_session_state_cbor_.Set(v8_session_->state());
for (wtf_size_t i = 0; i < notification_queue_.size(); ++i) {
auto serialized = notification_queue_[i]->Serialize();
host_ptr_->DispatchProtocolNotification(std::move(serialized),
......
......@@ -96,7 +96,7 @@ class CORE_EXPORT DevToolsSession
class Notification;
Vector<std::unique_ptr<Notification>> notification_queue_;
InspectorAgentState v8_session_state_;
InspectorAgentState::String v8_session_state_json_;
InspectorAgentState::Bytes v8_session_state_cbor_;
DISALLOW_COPY_AND_ASSIGN(DevToolsSession);
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment