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

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

Issue 693603003: [DevTools] Split DevToolsHttpHandler into two classes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@shell
Patch Set: Created 6 years, 1 month 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 | « no previous file | content/browser/devtools/devtools_http_handler_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/devtools/devtools_http_handler_impl.h
diff --git a/content/browser/devtools/devtools_http_handler_impl.h b/content/browser/devtools/devtools_http_handler_impl.h
index 5750dede95596b6cb74d2e6c5f5d6e9abf2038b1..c712f115811f6f29eb3f427d4a3e2789e1cb1c90 100644
--- a/content/browser/devtools/devtools_http_handler_impl.h
+++ b/content/browser/devtools/devtools_http_handler_impl.h
@@ -34,66 +34,54 @@ class URLRequestContextGetter;
namespace content {
-class DevToolsHttpHandlerImpl
- : public DevToolsHttpHandler,
- public base::RefCountedThreadSafe<DevToolsHttpHandlerImpl>,
- public net::HttpServer::Delegate {
+class DevToolsHttpHandlerImpl : public DevToolsHttpHandler {
private:
- friend class base::RefCountedThreadSafe<DevToolsHttpHandlerImpl>;
friend class DevToolsHttpHandler;
class BrowserTarget;
+ class ServerWrapper;
+ class AgentHostClientImpl;
DevToolsHttpHandlerImpl(scoped_ptr<ServerSocketFactory> server_socket_factory,
const std::string& frontend_url,
DevToolsHttpHandlerDelegate* delegate,
- const base::FilePath& active_port_output_directory);
+ const base::FilePath& output_directory);
~DevToolsHttpHandlerImpl() override;
- void Start();
// DevToolsHttpHandler implementation.
void Stop() override;
GURL GetFrontendURL() override;
- // net::HttpServer::Delegate implementation.
- void OnConnect(int connection_id) override {}
- void OnHttpRequest(int connection_id,
- const net::HttpServerRequestInfo& info) override;
- void OnWebSocketRequest(int connection_id,
- const net::HttpServerRequestInfo& info) override;
- void OnWebSocketMessage(int connection_id, const std::string& data) override;
- void OnClose(int connection_id) override;
-
- void OnJsonRequestUI(int connection_id,
- const net::HttpServerRequestInfo& info);
- void OnThumbnailRequestUI(int connection_id, const GURL& page_url);
- void OnDiscoveryPageRequestUI(int connection_id);
+ void OnJsonRequest(int connection_id,
dgozman 2014/11/07 13:03:55 Can we extract meaningful methods to a separate "d
vkuzkokov 2014/11/10 09:04:34 Extracted to static methods.
+ const net::HttpServerRequestInfo& info);
+ void OnThumbnailRequest(int connection_id, const std::string& target_id);
+ void OnDiscoveryPageRequest(int connection_id);
- void OnWebSocketRequestUI(int connection_id,
- const net::HttpServerRequestInfo& info);
- void OnWebSocketMessageUI(int connection_id, const std::string& data);
- void OnCloseUI(int connection_id);
+ void OnWebSocketRequest(int connection_id,
+ const net::HttpServerRequestInfo& info);
+ void OnWebSocketMessage(int connection_id, const std::string& data);
+ void OnClose(int connection_id);
- void ResetHandlerThread();
- void ResetHandlerThreadAndRelease();
+ static void OnTargetListReceivedWeak(
dgozman 2014/11/07 13:03:56 Let's comment on the purpose of this method.
vkuzkokov 2014/11/10 09:04:34 File removed.
+ base::WeakPtr<DevToolsHttpHandlerImpl> handler,
+ int connection_id,
+ const std::string& host,
+ const DevToolsManagerDelegate::TargetList& targets);
void OnTargetListReceived(
int connection_id,
const std::string& host,
const DevToolsManagerDelegate::TargetList& targets);
- void OnHttpServerInitialized(const net::IPEndPoint& ip_address);
-
DevToolsTarget* GetTarget(const std::string& id);
- void Init();
- void Teardown();
+ void ThreadStarted(scoped_ptr<ServerSocketFactory> server_socket_factory,
+ const base::FilePath& output_directory,
+ scoped_ptr<base::Thread> thread);
+ void ServerStarted(scoped_ptr<ServerWrapper> server,
+ scoped_ptr<net::IPEndPoint> ip_address);
- void StartHandlerThread();
void StopHandlerThread();
- void StopWithoutRelease();
-
- void WriteActivePortToUserProfile();
void SendJson(int connection_id,
net::HttpStatusCode status_code,
@@ -119,17 +107,17 @@ class DevToolsHttpHandlerImpl
scoped_ptr<base::Thread> thread_;
std::string frontend_url_;
- const scoped_ptr<ServerSocketFactory> server_socket_factory_;
- scoped_ptr<net::HttpServer> server_;
+ scoped_ptr<ServerWrapper> server_;
dgozman 2014/11/07 13:03:55 Let's call this |server_wrapper_|.
vkuzkokov 2014/11/10 09:04:34 Done.
scoped_ptr<net::IPEndPoint> server_ip_address_;
- typedef std::map<int, DevToolsAgentHostClient*> ConnectionToClientMap;
- ConnectionToClientMap connection_to_client_ui_;
+ typedef std::map<int, AgentHostClientImpl*> ConnectionToClientMap;
+ ConnectionToClientMap connection_to_client_;
const scoped_ptr<DevToolsHttpHandlerDelegate> delegate_;
- const base::FilePath active_port_output_directory_;
typedef std::map<std::string, DevToolsTarget*> TargetMap;
TargetMap target_map_;
typedef std::map<int, BrowserTarget*> BrowserTargets;
BrowserTargets browser_targets_;
+ base::WeakPtrFactory<DevToolsHttpHandlerImpl> weak_factory_;
+
DISALLOW_COPY_AND_ASSIGN(DevToolsHttpHandlerImpl);
};
« no previous file with comments | « no previous file | content/browser/devtools/devtools_http_handler_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698