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

Unified Diff: content/browser/devtools/protocol/target_handler.cc

Issue 2890973002: [DevTools] Show icon in top toolbar when Node target is available (Closed)
Patch Set: better, with hover 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/browser/devtools/protocol/target_handler.h ('k') | third_party/WebKit/Source/devtools/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/devtools/protocol/target_handler.cc
diff --git a/content/browser/devtools/protocol/target_handler.cc b/content/browser/devtools/protocol/target_handler.cc
index 6ce10663f85ae482733daf7d4904b1f9b2b66e01..8b982c8a9186764405f8956d885bfb25c0dbb8ee 100644
--- a/content/browser/devtools/protocol/target_handler.cc
+++ b/content/browser/devtools/protocol/target_handler.cc
@@ -223,9 +223,11 @@ void TargetHandler::TargetDestroyedInternal(
bool TargetHandler::AttachToTargetInternal(
DevToolsAgentHost* host, bool waiting_for_debugger) {
- if (!host->AttachClient(this))
- return false;
attached_hosts_[host->GetId()] = host;
+ if (!host->AttachClient(this)) {
+ attached_hosts_.erase(host->GetId());
+ return false;
+ }
frontend_->AttachedToTarget(CreateInfo(host), waiting_for_debugger);
return true;
}
@@ -415,6 +417,8 @@ bool TargetHandler::ShouldForceDevToolsAgentHostCreation() {
}
void TargetHandler::DevToolsAgentHostCreated(DevToolsAgentHost* agent_host) {
+ if (agent_host->GetType() == "node" && agent_host->IsAttached())
+ return;
// If we start discovering late, all existing agent hosts will be reported,
// but we could have already attached to some.
TargetCreatedInternal(agent_host);
@@ -425,6 +429,22 @@ void TargetHandler::DevToolsAgentHostDestroyed(DevToolsAgentHost* agent_host) {
TargetDestroyedInternal(agent_host);
}
+void TargetHandler::DevToolsAgentHostAttached(DevToolsAgentHost* host) {
+ if (host->GetType() == "node" &&
+ reported_hosts_.find(host->GetId()) != reported_hosts_.end() &&
+ attached_hosts_.find(host->GetId()) == attached_hosts_.end()) {
+ TargetDestroyedInternal(host);
+ }
+}
+
+void TargetHandler::DevToolsAgentHostDetached(DevToolsAgentHost* host) {
+ if (host->GetType() == "node" &&
+ reported_hosts_.find(host->GetId()) == reported_hosts_.end() &&
+ attached_hosts_.find(host->GetId()) == attached_hosts_.end()) {
+ TargetCreatedInternal(host);
+ }
+}
+
// -------- ServiceWorkerDevToolsManager::Observer ----------
void TargetHandler::WorkerCreated(
« no previous file with comments | « content/browser/devtools/protocol/target_handler.h ('k') | third_party/WebKit/Source/devtools/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698