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

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

Issue 2047833002: DevTools: introduce browser domain for basic target discovery. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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/devtools_agent_host_impl.cc
diff --git a/content/browser/devtools/devtools_agent_host_impl.cc b/content/browser/devtools/devtools_agent_host_impl.cc
index 033f2f18bd90375c7800e59f529ff51db66ebf56..98dfe911d068872cbb3a635e1c7a9441f77433f7 100644
--- a/content/browser/devtools/devtools_agent_host_impl.cc
+++ b/content/browser/devtools/devtools_agent_host_impl.cc
@@ -102,7 +102,11 @@ scoped_refptr<DevToolsAgentHost> DevToolsAgentHost::Create(
return new ForwardingAgentHost(delegate);
}
-void DevToolsAgentHostImpl::AttachClient(DevToolsAgentHostClient* client) {
+bool DevToolsAgentHostImpl::InnerAttach(DevToolsAgentHostClient* client,
+ bool force) {
+ if (client_ && !force)
+ return false;
+
scoped_refptr<DevToolsAgentHostImpl> protect(this);
++session_id_;
if (client_) {
@@ -111,15 +115,25 @@ void DevToolsAgentHostImpl::AttachClient(DevToolsAgentHostClient* client) {
}
client_ = client;
Attach();
+ return true;
}
-void DevToolsAgentHostImpl::DetachClient() {
- if (!client_)
- return;
+bool DevToolsAgentHostImpl::AttachClient(DevToolsAgentHostClient* client) {
+ return InnerAttach(client, false);
+}
+
+bool DevToolsAgentHostImpl::ForceAttachClient(DevToolsAgentHostClient* client) {
+ return InnerAttach(client, true);
+}
+
+bool DevToolsAgentHostImpl::DetachClient(DevToolsAgentHostClient* client) {
+ if (!client_ || client_ != client)
+ return false;
scoped_refptr<DevToolsAgentHostImpl> protect(this);
client_ = NULL;
InnerDetach();
+ return true;
}
void DevToolsAgentHostImpl::InnerDetach() {

Powered by Google App Engine
This is Rietveld 408576698