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

Unified Diff: chrome/browser/devtools/devtools_adb_bridge.h

Issue 12586010: DevTools: extract ADB command classes, change objects' lifetimes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Win build fixed. Created 7 years, 9 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 | « chrome/browser/devtools/adb_client_socket.cc ('k') | chrome/browser/devtools/devtools_adb_bridge.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/devtools/devtools_adb_bridge.h
diff --git a/chrome/browser/devtools/devtools_adb_bridge.h b/chrome/browser/devtools/devtools_adb_bridge.h
index 2043ffc0b2e5c6dc654e0dccf76567b733f1d65d..8c9141b025ea86998ab4211025f0ea5d1b937358 100644
--- a/chrome/browser/devtools/devtools_adb_bridge.h
+++ b/chrome/browser/devtools/devtools_adb_bridge.h
@@ -9,7 +9,9 @@
#include <vector>
#include "base/callback.h"
+#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
+#include "base/memory/weak_ptr.h"
#include "net/socket/tcp_client_socket.h"
namespace base {
@@ -17,92 +19,77 @@ class Thread;
class DictionaryValue;
}
+class MessageLoop;
+class Profile;
+
class DevToolsAdbBridge {
public:
typedef base::Callback<void(int result,
const std::string& response)> Callback;
- class AgentHost : public base::RefCounted<AgentHost> {
+ class RemotePage : public base::RefCounted<RemotePage> {
public:
- AgentHost(const std::string& serial,
- const std::string& model,
- const base::DictionaryValue& value);
+ RemotePage(const std::string& serial,
+ const std::string& model,
+ const base::DictionaryValue& value);
std::string serial() { return serial_; }
std::string model() { return model_; }
std::string id() { return id_; }
+ std::string url() { return url_; }
std::string title() { return title_; }
std::string description() { return description_; }
std::string favicon_url() { return favicon_url_; }
std::string debug_url() { return debug_url_; }
+ std::string frontend_url() { return frontend_url_; }
private:
- friend class base::RefCounted<AgentHost>;
-
- virtual ~AgentHost();
+ friend class base::RefCounted<RemotePage>;
+ virtual ~RemotePage();
std::string serial_;
std::string model_;
std::string id_;
+ std::string url_;
std::string title_;
std::string description_;
std::string favicon_url_;
std::string debug_url_;
- DISALLOW_COPY_AND_ASSIGN(AgentHost);
+ std::string frontend_url_;
+ DISALLOW_COPY_AND_ASSIGN(RemotePage);
};
- typedef std::vector<scoped_refptr<AgentHost> > AgentHosts;
- typedef base::Callback<void(int, AgentHosts*)> HostsCallback;
+ typedef std::vector<scoped_refptr<RemotePage> > RemotePages;
+ typedef base::Callback<void(int, RemotePages*)> PagesCallback;
+
+ explicit DevToolsAdbBridge(Profile* profile);
+ ~DevToolsAdbBridge();
- static DevToolsAdbBridge* Start();
void Query(const std::string query, const Callback& callback);
- void Devices();
- void Stop();
+ void Pages(const PagesCallback& callback);
+ void Attach(scoped_refptr<RemotePage> page);
private:
- friend class base::RefCountedThreadSafe<DevToolsAdbBridge>;
-
-
- explicit DevToolsAdbBridge();
- virtual ~DevToolsAdbBridge();
-
- void StopHandlerOnFileThread();
-
- void ResetHandlerAndReleaseOnUIThread();
- void ResetHandlerOnUIThread();
-
- void QueryOnHandlerThread(const std::string query, const Callback& callback);
- void QueryResponseOnHandlerThread(const Callback& callback,
- int result,
- const std::string& response);
-
- void DevicesOnHandlerThread(const HostsCallback& callback);
- void ReceivedDevices(const HostsCallback& callback,
- int result,
- const std::string& response);
- void ProcessSerials(const HostsCallback& callback,
- AgentHosts* hosts,
- std::vector<std::string>* serials);
- void ReceivedModel(const HostsCallback& callback,
- AgentHosts* hosts,
- std::vector<std::string>* serials,
- int result,
- const std::string& response);
- void ReceivedPages(const HostsCallback& callback,
- AgentHosts* hosts,
- std::vector<std::string>* serials,
- const std::string& model,
- int result,
- const std::string& response);
-
- void RespondOnUIThread(const Callback& callback,
- int result,
- const std::string& response);
-
- void PrintHosts(int result, AgentHosts* hosts);
-
- // The thread used by the devtools to run client socket.
- scoped_ptr<base::Thread> thread_;
+ friend class AdbWebSocket;
+
+ class RefCountedAdbThread : public base::RefCounted<RefCountedAdbThread> {
+ public:
+ static scoped_refptr<RefCountedAdbThread> GetInstance();
+ RefCountedAdbThread();
+ MessageLoop* message_loop();
+
+ private:
+ friend class base::RefCounted<RefCountedAdbThread>;
+ static DevToolsAdbBridge::RefCountedAdbThread* instance_;
+ static void StopThread(base::Thread* thread);
+
+ virtual ~RefCountedAdbThread();
+ base::Thread* thread_;
+ };
+ Profile* profile_;
+ scoped_refptr<RefCountedAdbThread> adb_thread_;
+ base::WeakPtrFactory<DevToolsAdbBridge> weak_factory_;
+ bool has_message_loop_;
DISALLOW_COPY_AND_ASSIGN(DevToolsAdbBridge);
};
« no previous file with comments | « chrome/browser/devtools/adb_client_socket.cc ('k') | chrome/browser/devtools/devtools_adb_bridge.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698