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

Unified Diff: content/browser/devtools/worker_devtools_agent_host.cc

Issue 2874613003: [DevTools] Support multiple clients in DevToolsAgentHost (Closed)
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/devtools/worker_devtools_agent_host.cc
diff --git a/content/browser/devtools/worker_devtools_agent_host.cc b/content/browser/devtools/worker_devtools_agent_host.cc
index 2839937066504a8ba21af4b7e08690b502f77dcb..b8f8cd994729999341a71d8d1d2794564126e2f5 100644
--- a/content/browser/devtools/worker_devtools_agent_host.cc
+++ b/content/browser/devtools/worker_devtools_agent_host.cc
@@ -107,12 +107,10 @@ void WorkerDevToolsAgentHost::WorkerReadyForInspection() {
state_ = WORKER_INSPECTED;
AttachToWorker();
if (RenderProcessHost* host = RenderProcessHost::FromID(worker_id_.first)) {
- std::string state_cookie;
- auto it = chunk_processors_.find(session()->session_id());
- if (it != chunk_processors_.end())
- state_cookie = it->second->state_cookie();
- host->Send(new DevToolsAgentMsg_Reattach(
- worker_id_.second, GetId(), session()->session_id(), state_cookie));
+ for (auto& it : chunk_processors_) {
+ host->Send(new DevToolsAgentMsg_Reattach(
+ worker_id_.second, GetId(), it.first, it.second->state_cookie()));
+ }
}
OnAttachedStateChanged(true);
} else if (state_ == WORKER_PAUSED_FOR_DEBUG_ON_START) {
@@ -180,8 +178,9 @@ void WorkerDevToolsAgentHost::OnDispatchOnInspectorFrontend(
void WorkerDevToolsAgentHost::SendChunkedMessage(int session_id,
const std::string& message) {
- if (session() && session()->session_id() == session_id)
- session()->SendMessageToClient(message);
+ auto it = sessions().find(session_id);
+ if (it != sessions().end())
+ it->second->SendMessageToClient(message);
}
} // namespace content
« no previous file with comments | « content/browser/devtools/render_frame_devtools_agent_host.cc ('k') | content/public/browser/devtools_agent_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698