Commit eb59a900 authored by Henrique Ferreiro's avatar Henrique Ferreiro Committed by Commit Bot

Finish migration of DevToolsSession to the new Mojo types

Finish the migration of blink.mojom.DevToolsSession started at
https://crrev.com/c/1748906.

Bug: 955171, 978694
Change-Id: Icd73c8a5205afcb8cf42e588450588068ad28297
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1768518Reviewed-by: default avatarKen Rockot <rockot@google.com>
Reviewed-by: default avatarAndrey Kosyakov <caseq@chromium.org>
Commit-Queue: Henrique Ferreiro <hferreiro@igalia.com>
Cr-Commit-Position: refs/heads/master@{#691565}
parent 007ef30a
...@@ -4,6 +4,10 @@ ...@@ -4,6 +4,10 @@
#include "third_party/blink/renderer/core/inspector/devtools_session.h" #include "third_party/blink/renderer/core/inspector/devtools_session.h"
#include <string>
#include <utility>
#include <vector>
#include "base/containers/span.h" #include "base/containers/span.h"
#include "third_party/blink/renderer/bindings/core/v8/script_controller.h" #include "third_party/blink/renderer/bindings/core/v8/script_controller.h"
#include "third_party/blink/renderer/core/frame/local_frame.h" #include "third_party/blink/renderer/core/frame/local_frame.h"
...@@ -111,21 +115,21 @@ class DevToolsSession::IOSession : public mojom::blink::DevToolsSession { ...@@ -111,21 +115,21 @@ class DevToolsSession::IOSession : public mojom::blink::DevToolsSession {
IOSession(scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, IOSession(scoped_refptr<base::SingleThreadTaskRunner> io_task_runner,
scoped_refptr<InspectorTaskRunner> inspector_task_runner, scoped_refptr<InspectorTaskRunner> inspector_task_runner,
CrossThreadWeakPersistent<::blink::DevToolsSession> session, CrossThreadWeakPersistent<::blink::DevToolsSession> session,
mojom::blink::DevToolsSessionRequest request) mojo::PendingReceiver<mojom::blink::DevToolsSession> receiver)
: io_task_runner_(io_task_runner), : io_task_runner_(io_task_runner),
inspector_task_runner_(inspector_task_runner), inspector_task_runner_(inspector_task_runner),
session_(std::move(session)), session_(std::move(session)) {
binding_(this) {
PostCrossThreadTask(*io_task_runner, FROM_HERE, PostCrossThreadTask(*io_task_runner, FROM_HERE,
CrossThreadBindOnce(&IOSession::BindInterface, CrossThreadBindOnce(&IOSession::BindInterface,
CrossThreadUnretained(this), CrossThreadUnretained(this),
WTF::Passed(std::move(request)))); WTF::Passed(std::move(receiver))));
} }
~IOSession() override {} ~IOSession() override {}
void BindInterface(mojom::blink::DevToolsSessionRequest request) { void BindInterface(
binding_.Bind(std::move(request), io_task_runner_); mojo::PendingReceiver<mojom::blink::DevToolsSession> receiver) {
receiver_.Bind(std::move(receiver), io_task_runner_);
} }
void DeleteSoon() { io_task_runner_->DeleteSoon(FROM_HERE, this); } void DeleteSoon() { io_task_runner_->DeleteSoon(FROM_HERE, this); }
...@@ -148,7 +152,7 @@ class DevToolsSession::IOSession : public mojom::blink::DevToolsSession { ...@@ -148,7 +152,7 @@ class DevToolsSession::IOSession : public mojom::blink::DevToolsSession {
scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_;
scoped_refptr<InspectorTaskRunner> inspector_task_runner_; scoped_refptr<InspectorTaskRunner> inspector_task_runner_;
CrossThreadWeakPersistent<::blink::DevToolsSession> session_; CrossThreadWeakPersistent<::blink::DevToolsSession> session_;
mojo::Binding<mojom::blink::DevToolsSession> binding_; mojo::Receiver<mojom::blink::DevToolsSession> receiver_{this};
DISALLOW_COPY_AND_ASSIGN(IOSession); DISALLOW_COPY_AND_ASSIGN(IOSession);
}; };
...@@ -157,7 +161,7 @@ DevToolsSession::DevToolsSession( ...@@ -157,7 +161,7 @@ DevToolsSession::DevToolsSession(
DevToolsAgent* agent, DevToolsAgent* agent,
mojom::blink::DevToolsSessionHostAssociatedPtrInfo host_ptr_info, mojom::blink::DevToolsSessionHostAssociatedPtrInfo host_ptr_info,
mojom::blink::DevToolsSessionAssociatedRequest main_request, mojom::blink::DevToolsSessionAssociatedRequest main_request,
mojom::blink::DevToolsSessionRequest io_request, mojo::PendingReceiver<mojom::blink::DevToolsSession> io_receiver,
mojom::blink::DevToolsSessionStatePtr reattach_session_state, mojom::blink::DevToolsSessionStatePtr reattach_session_state,
bool client_expects_binary_responses) bool client_expects_binary_responses)
: agent_(agent), : agent_(agent),
...@@ -168,9 +172,9 @@ DevToolsSession::DevToolsSession( ...@@ -168,9 +172,9 @@ DevToolsSession::DevToolsSession(
v8_session_state_(kV8StateKey), v8_session_state_(kV8StateKey),
v8_session_state_cbor_(&v8_session_state_, v8_session_state_cbor_(&v8_session_state_,
/*default_value=*/{}) { /*default_value=*/{}) {
io_session_ = io_session_ = new IOSession(
new IOSession(agent_->io_task_runner_, agent_->inspector_task_runner_, agent_->io_task_runner_, agent_->inspector_task_runner_,
WrapCrossThreadWeakPersistent(this), std::move(io_request)); WrapCrossThreadWeakPersistent(this), std::move(io_receiver));
host_ptr_.Bind(std::move(host_ptr_info)); host_ptr_.Bind(std::move(host_ptr_info));
host_ptr_.set_connection_error_handler( host_ptr_.set_connection_error_handler(
......
...@@ -5,8 +5,11 @@ ...@@ -5,8 +5,11 @@
#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_INSPECTOR_DEVTOOLS_SESSION_H_ #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_INSPECTOR_DEVTOOLS_SESSION_H_
#define THIRD_PARTY_BLINK_RENDERER_CORE_INSPECTOR_DEVTOOLS_SESSION_H_ #define THIRD_PARTY_BLINK_RENDERER_CORE_INSPECTOR_DEVTOOLS_SESSION_H_
#include <memory>
#include "base/macros.h" #include "base/macros.h"
#include "mojo/public/cpp/bindings/associated_binding.h" #include "mojo/public/cpp/bindings/associated_binding.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "third_party/blink/public/mojom/devtools/devtools_agent.mojom-blink.h" #include "third_party/blink/public/mojom/devtools/devtools_agent.mojom-blink.h"
#include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/core/core_export.h"
#include "third_party/blink/renderer/core/inspector/inspector_session_state.h" #include "third_party/blink/renderer/core/inspector/inspector_session_state.h"
...@@ -34,7 +37,7 @@ class CORE_EXPORT DevToolsSession ...@@ -34,7 +37,7 @@ class CORE_EXPORT DevToolsSession
DevToolsAgent*, DevToolsAgent*,
mojom::blink::DevToolsSessionHostAssociatedPtrInfo host_ptr_info, mojom::blink::DevToolsSessionHostAssociatedPtrInfo host_ptr_info,
mojom::blink::DevToolsSessionAssociatedRequest main_request, mojom::blink::DevToolsSessionAssociatedRequest main_request,
mojom::blink::DevToolsSessionRequest io_request, mojo::PendingReceiver<mojom::blink::DevToolsSession> io_receiver,
mojom::blink::DevToolsSessionStatePtr reattach_session_state, mojom::blink::DevToolsSessionStatePtr reattach_session_state,
bool client_expects_binary_responses); bool client_expects_binary_responses);
~DevToolsSession() override; ~DevToolsSession() override;
......
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