| Index: content/browser/devtools/browser_devtools_agent_host.cc
|
| diff --git a/content/browser/devtools/browser_devtools_agent_host.cc b/content/browser/devtools/browser_devtools_agent_host.cc
|
| index c89dda6194e870138cd466547f7c72ed82a0e940..abd3c6e9ea422351d7bf9aae253e9b89d84ba5f4 100644
|
| --- a/content/browser/devtools/browser_devtools_agent_host.cc
|
| +++ b/content/browser/devtools/browser_devtools_agent_host.cc
|
| @@ -5,10 +5,12 @@
|
| #include "content/browser/devtools/browser_devtools_agent_host.h"
|
|
|
| #include "base/bind.h"
|
| +#include "base/json/json_reader.h"
|
| #include "base/guid.h"
|
| #include "content/browser/devtools/devtools_protocol_handler.h"
|
| #include "content/browser/devtools/protocol/io_handler.h"
|
| #include "content/browser/devtools/protocol/memory_handler.h"
|
| +#include "content/browser/devtools/protocol/protocol.h"
|
| #include "content/browser/devtools/protocol/system_info_handler.h"
|
| #include "content/browser/devtools/protocol/tethering_handler.h"
|
| #include "content/browser/devtools/protocol/tracing_handler.h"
|
| @@ -26,23 +28,24 @@ BrowserDevToolsAgentHost::BrowserDevToolsAgentHost(
|
| scoped_refptr<base::SingleThreadTaskRunner> tethering_task_runner,
|
| const CreateServerSocketCallback& socket_callback)
|
| : DevToolsAgentHostImpl(base::GenerateGUID()),
|
| - io_handler_(new devtools::io::IOHandler(GetIOContext())),
|
| + io_handler_(new protocol::IOHandler(GetIOContext())),
|
| memory_handler_(new devtools::memory::MemoryHandler()),
|
| system_info_handler_(new devtools::system_info::SystemInfoHandler()),
|
| tethering_handler_(
|
| new devtools::tethering::TetheringHandler(socket_callback,
|
| tethering_task_runner)),
|
| - tracing_handler_(new devtools::tracing::TracingHandler(
|
| - devtools::tracing::TracingHandler::Browser,
|
| + tracing_handler_(new protocol::TracingHandler(
|
| + protocol::TracingHandler::Browser,
|
| FrameTreeNode::kFrameTreeNodeInvalidId,
|
| GetIOContext())),
|
| - protocol_handler_(new DevToolsProtocolHandler(this)) {
|
| + protocol_handler_(new DevToolsProtocolHandler(this)),
|
| + protocol_dispatcher_(new protocol::UberDispatcher(this, true)) {
|
| DevToolsProtocolDispatcher* dispatcher = protocol_handler_->dispatcher();
|
| - dispatcher->SetIOHandler(io_handler_.get());
|
| + io_handler_->Wire(protocol_dispatcher_.get());
|
| dispatcher->SetMemoryHandler(memory_handler_.get());
|
| dispatcher->SetSystemInfoHandler(system_info_handler_.get());
|
| dispatcher->SetTetheringHandler(tethering_handler_.get());
|
| - dispatcher->SetTracingHandler(tracing_handler_.get());
|
| + tracing_handler_->Wire(protocol_dispatcher_.get());
|
| NotifyCreated();
|
| }
|
|
|
| @@ -80,7 +83,12 @@ void BrowserDevToolsAgentHost::Reload() {
|
|
|
| bool BrowserDevToolsAgentHost::DispatchProtocolMessage(
|
| const std::string& message) {
|
| - protocol_handler_->HandleMessage(session_id(), message);
|
| + std::unique_ptr<base::Value> value = base::JSONReader::Read(message);
|
| + if (protocol_dispatcher_->dispatch(
|
| + protocol::toProtocolValue(value.get(), 1000)) ==
|
| + protocol::Response::kFallThrough) {
|
| + protocol_handler_->HandleMessage(session_id(), std::move(value));
|
| + }
|
| return true;
|
| }
|
|
|
|
|