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

Unified Diff: content/renderer/devtools/devtools_agent.cc

Issue 2858043003: [DevTools] Pass session id in detach request (Closed)
Patch Set: test compile 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
« no previous file with comments | « content/renderer/devtools/devtools_agent.h ('k') | content/renderer/render_frame_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/devtools/devtools_agent.cc
diff --git a/content/renderer/devtools/devtools_agent.cc b/content/renderer/devtools/devtools_agent.cc
index d45c2a0e8d95cb6008df247ae52c187e89d3bcb0..a9b2b5929bb756df2ab7a1268eb8ba4a0f3251f7 100644
--- a/content/renderer/devtools/devtools_agent.cc
+++ b/content/renderer/devtools/devtools_agent.cc
@@ -83,7 +83,6 @@ base::LazyInstance<IdToAgentMap>::Leaky
DevToolsAgent::DevToolsAgent(RenderFrameImpl* frame)
: RenderFrameObserver(frame),
- is_attached_(false),
is_devtools_client_(false),
paused_(false),
frame_(frame),
@@ -235,7 +234,7 @@ void DevToolsAgent::SendChunkedProtocolMessage(IPC::Sender* sender,
void DevToolsAgent::OnAttach(const std::string& host_id, int session_id) {
GetWebAgent()->Attach(WebString::FromUTF8(host_id), session_id);
- is_attached_ = true;
+ session_ids_.insert(session_id);
}
void DevToolsAgent::OnReattach(const std::string& host_id,
@@ -243,12 +242,12 @@ void DevToolsAgent::OnReattach(const std::string& host_id,
const std::string& agent_state) {
GetWebAgent()->Reattach(WebString::FromUTF8(host_id), session_id,
WebString::FromUTF8(agent_state));
- is_attached_ = true;
+ session_ids_.insert(session_id);
}
-void DevToolsAgent::OnDetach() {
- GetWebAgent()->Detach();
- is_attached_ = false;
+void DevToolsAgent::OnDetach(int session_id) {
+ GetWebAgent()->Detach(session_id);
+ session_ids_.erase(session_id);
}
void DevToolsAgent::OnDispatchOnInspectorBackend(int session_id,
@@ -299,7 +298,13 @@ WebDevToolsAgent* DevToolsAgent::GetWebAgent() {
}
bool DevToolsAgent::IsAttached() {
- return is_attached_;
+ return !!session_ids_.size();
+}
+
+void DevToolsAgent::DetachAllSessions() {
+ for (int session_id : session_ids_)
+ GetWebAgent()->Detach(session_id);
+ session_ids_.clear();
}
void DevToolsAgent::GotManifest(int session_id,
@@ -307,7 +312,7 @@ void DevToolsAgent::GotManifest(int session_id,
const GURL& manifest_url,
const Manifest& manifest,
const ManifestDebugInfo& debug_info) {
- if (!is_attached_)
+ if (!IsAttached())
return;
std::unique_ptr<base::DictionaryValue> response(new base::DictionaryValue());
« no previous file with comments | « content/renderer/devtools/devtools_agent.h ('k') | content/renderer/render_frame_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698