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

Unified Diff: content/browser/devtools/devtools_manager_impl.h

Issue 449043002: [DevTools] Make DevTools clients talk directly to DevToolsAgentHost instead of using DevToolsManage… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 6 years, 4 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_manager_impl.h
diff --git a/content/browser/devtools/devtools_manager_impl.h b/content/browser/devtools/devtools_manager_impl.h
index 19b6918518b46b17b79044c5c6e4cb9c564c6750..c5ceb2ac61892eace1c2df2db2d980a458e07122 100644
--- a/content/browser/devtools/devtools_manager_impl.h
+++ b/content/browser/devtools/devtools_manager_impl.h
@@ -11,32 +11,14 @@
#include "base/compiler_specific.h"
#include "base/memory/singleton.h"
-#include "content/browser/devtools/devtools_agent_host_impl.h"
-#include "content/common/content_export.h"
-#include "content/public/browser/devtools_client_host.h"
-#include "content/public/browser/devtools_manager.h"
-
-class GURL;
-
-namespace IPC {
-class Message;
-}
namespace content {
-class BrowserContext;
class DevToolsManagerDelegate;
-class RenderViewHost;
-// This class is a singleton that manages DevToolsClientHost instances and
-// routes messages between developer tools clients and agents.
-//
-// Methods below that accept inspected RenderViewHost as a parameter are
-// just convenience methods that call corresponding methods accepting
-// DevToolAgentHost.
-class CONTENT_EXPORT DevToolsManagerImpl
- : public DevToolsAgentHostImpl::CloseListener,
- public DevToolsManager {
+// This class is a singleton that manage global DevTools state for the whole
+// browser.
+class DevToolsManagerImpl {
public:
// Returns single instance of this class. The instance is destroyed on the
// browser main loop exit so this method MUST NOT be called after that point.
@@ -45,65 +27,15 @@ class CONTENT_EXPORT DevToolsManagerImpl
DevToolsManagerImpl();
virtual ~DevToolsManagerImpl();
- // Opens the inspector for |agent_host|.
- void Inspect(BrowserContext* browser_context, DevToolsAgentHost* agent_host);
-
- void DispatchOnInspectorFrontend(DevToolsAgentHost* agent_host,
- const std::string& message);
-
DevToolsManagerDelegate* delegate() const { return delegate_.get(); }
-
- // DevToolsManager implementation
- virtual bool DispatchOnInspectorBackend(DevToolsClientHost* from,
- const std::string& message) OVERRIDE;
- virtual void CloseAllClientHosts() OVERRIDE;
- virtual DevToolsAgentHost* GetDevToolsAgentHostFor(
- DevToolsClientHost* client_host) OVERRIDE;
- virtual void RegisterDevToolsClientHostFor(
- DevToolsAgentHost* agent_host,
- DevToolsClientHost* client_host) OVERRIDE;
- virtual void ClientHostClosing(DevToolsClientHost* host) OVERRIDE;
- virtual void AddAgentStateCallback(const Callback& callback) OVERRIDE;
- virtual void RemoveAgentStateCallback(const Callback& callback) OVERRIDE;
+ void OnClientAttached();
+ void OnClientDetached();
private:
- friend class DevToolsAgentHostImpl;
- friend class RenderViewDevToolsAgentHost;
friend struct DefaultSingletonTraits<DevToolsManagerImpl>;
- // DevToolsAgentHost::CloseListener implementation.
- virtual void AgentHostClosing(DevToolsAgentHostImpl* host) OVERRIDE;
-
- void BindClientHost(DevToolsAgentHostImpl* agent_host,
- DevToolsClientHost* client_host);
- void UnbindClientHost(DevToolsAgentHostImpl* agent_host,
- DevToolsClientHost* client_host);
-
- DevToolsClientHost* GetDevToolsClientHostFor(
- DevToolsAgentHostImpl* agent_host);
-
- void UnregisterDevToolsClientHostFor(DevToolsAgentHostImpl* agent_host);
-
- void NotifyObservers(DevToolsAgentHost* agent_host, bool attached);
-
- // These two maps are for tracking dependencies between inspected contents and
- // their DevToolsClientHosts. They are useful for routing devtools messages
- // and allow us to have at most one devtools client host per contents.
- //
- // DevToolsManagerImpl starts listening to DevToolsClientHosts when they are
- // put into these maps and removes them when they are closing.
- typedef std::map<DevToolsAgentHostImpl*, DevToolsClientHost*>
- AgentToClientHostMap;
- AgentToClientHostMap agent_to_client_host_;
-
- typedef std::map<DevToolsClientHost*, scoped_refptr<DevToolsAgentHostImpl> >
- ClientToAgentHostMap;
- ClientToAgentHostMap client_to_agent_host_;
-
- typedef std::vector<const Callback*> CallbackContainer;
- CallbackContainer callbacks_;
-
scoped_ptr<DevToolsManagerDelegate> delegate_;
+ int client_count_;
DISALLOW_COPY_AND_ASSIGN(DevToolsManagerImpl);
};

Powered by Google App Engine
This is Rietveld 408576698