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

Side by Side Diff: content/browser/devtools/devtools_session.cc

Issue 2864103002: [DevTools] Support multiple DevToolsMessageChunkProcessor instances (Closed)
Patch Set: fix Created 3 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/devtools/devtools_session.h" 5 #include "content/browser/devtools/devtools_session.h"
6 6
7 #include "base/json/json_reader.h" 7 #include "base/json/json_reader.h"
8 #include "base/json/json_writer.h" 8 #include "base/json/json_writer.h"
9 #include "content/browser/devtools/devtools_manager.h" 9 #include "content/browser/devtools/devtools_manager.h"
10 #include "content/browser/devtools/protocol/protocol.h" 10 #include "content/browser/devtools/protocol/protocol.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 } 43 }
44 44
45 void DevToolsSession::SetFallThroughForNotFound(bool value) { 45 void DevToolsSession::SetFallThroughForNotFound(bool value) {
46 dispatcher_->setFallThroughForNotFound(value); 46 dispatcher_->setFallThroughForNotFound(value);
47 } 47 }
48 48
49 void DevToolsSession::sendResponse( 49 void DevToolsSession::sendResponse(
50 std::unique_ptr<base::DictionaryValue> response) { 50 std::unique_ptr<base::DictionaryValue> response) {
51 std::string json; 51 std::string json;
52 base::JSONWriter::Write(*response.get(), &json); 52 base::JSONWriter::Write(*response.get(), &json);
53 agent_host_->SendMessageToClient(session_id_, json); 53 SendMessageToClient(json);
54 } 54 }
55 55
56 protocol::Response::Status DevToolsSession::Dispatch( 56 protocol::Response::Status DevToolsSession::Dispatch(
57 const std::string& message, 57 const std::string& message,
58 int* call_id, 58 int* call_id,
59 std::string* method) { 59 std::string* method) {
60 std::unique_ptr<base::Value> value = base::JSONReader::Read(message); 60 std::unique_ptr<base::Value> value = base::JSONReader::Read(message);
61 61
62 DevToolsManagerDelegate* delegate = 62 DevToolsManagerDelegate* delegate =
63 DevToolsManager::GetInstance()->delegate(); 63 DevToolsManager::GetInstance()->delegate();
(...skipping 10 matching lines...) Expand all
74 base::Bind(&DevToolsSession::sendResponse, 74 base::Bind(&DevToolsSession::sendResponse,
75 weak_factory_.GetWeakPtr()))) { 75 weak_factory_.GetWeakPtr()))) {
76 return protocol::Response::kAsync; 76 return protocol::Response::kAsync;
77 } 77 }
78 } 78 }
79 79
80 return dispatcher_->dispatch(protocol::toProtocolValue(value.get(), 1000), 80 return dispatcher_->dispatch(protocol::toProtocolValue(value.get(), 1000),
81 call_id, method); 81 call_id, method);
82 } 82 }
83 83
84 void DevToolsSession::SendMessageToClient(const std::string& message) {
85 client_->DispatchProtocolMessage(agent_host_, message);
86 }
87
84 void DevToolsSession::sendProtocolResponse( 88 void DevToolsSession::sendProtocolResponse(
85 int call_id, 89 int call_id,
86 std::unique_ptr<protocol::Serializable> message) { 90 std::unique_ptr<protocol::Serializable> message) {
87 agent_host_->SendMessageToClient(session_id_, message->serialize()); 91 SendMessageToClient(message->serialize());
88 } 92 }
89 93
90 void DevToolsSession::sendProtocolNotification( 94 void DevToolsSession::sendProtocolNotification(
91 std::unique_ptr<protocol::Serializable> message) { 95 std::unique_ptr<protocol::Serializable> message) {
92 agent_host_->SendMessageToClient(session_id_, message->serialize()); 96 SendMessageToClient(message->serialize());
93 } 97 }
94 98
95 void DevToolsSession::flushProtocolNotifications() { 99 void DevToolsSession::flushProtocolNotifications() {
96 } 100 }
97 101
98 } // namespace content 102 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/devtools/devtools_session.h ('k') | content/browser/devtools/forwarding_agent_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698