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

Side by Side Diff: chrome/browser/debugger/devtools_protocol_handler.h

Issue 2868036: Brushed up listen socket: (Closed)
Patch Set: Lint. Created 10 years, 5 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/debugger/devtools_protocol_handler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_DEBUGGER_DEVTOOLS_PROTOCOL_HANDLER_H_ 5 #ifndef CHROME_BROWSER_DEBUGGER_DEVTOOLS_PROTOCOL_HANDLER_H_
6 #define CHROME_BROWSER_DEBUGGER_DEVTOOLS_PROTOCOL_HANDLER_H_ 6 #define CHROME_BROWSER_DEBUGGER_DEVTOOLS_PROTOCOL_HANDLER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/hash_tables.h" 10 #include "base/hash_tables.h"
11 #include "base/ref_counted.h" 11 #include "base/ref_counted.h"
12 #include "base/scoped_ptr.h" 12 #include "base/scoped_ptr.h"
13 #include "chrome/browser/debugger/devtools_remote.h" 13 #include "chrome/browser/debugger/devtools_remote.h"
14 #include "net/base/listen_socket.h" 14 #include "net/base/listen_socket.h"
15 15
16 class InspectableTabProxy; 16 class InspectableTabProxy;
17 class DevToolsRemoteListenSocket; 17 class DevToolsRemoteListenSocket;
18 class DevToolsRemoteMessage; 18 class DevToolsRemoteMessage;
19 19
20 // Dispatches DevToolsRemoteMessages to their appropriate handlers (Tools) 20 // Dispatches DevToolsRemoteMessages to their appropriate handlers (Tools)
21 // based on the "Tool" message header value. 21 // based on the "Tool" message header value.
22 class DevToolsProtocolHandler 22 class DevToolsProtocolHandler
23 : public DevToolsRemoteListener, 23 : public DevToolsRemoteListener,
24 public OutboundSocketDelegate, 24 public OutboundSocketDelegate {
25 public ListenSocket::ListenSocketDelegate {
26 public: 25 public:
27 typedef base::hash_map< std::string, scoped_refptr<DevToolsRemoteListener> > 26 typedef base::hash_map< std::string, scoped_refptr<DevToolsRemoteListener> >
28 ToolToListenerMap; 27 ToolToListenerMap;
29 28
30 explicit DevToolsProtocolHandler(int port); 29 explicit DevToolsProtocolHandler(int port);
31 30
32 // This method should be called after the object construction. 31 // This method should be called after the object construction.
33 void Start(); 32 void Start();
34 33
35 // This method should be called before the object destruction. 34 // This method should be called before the object destruction.
(...skipping 11 matching lines...) Expand all
47 // directed to the specified |tool_name| tool. 46 // directed to the specified |tool_name| tool.
48 void UnregisterDestination(DevToolsRemoteListener* listener, 47 void UnregisterDestination(DevToolsRemoteListener* listener,
49 const std::string& tool_name); 48 const std::string& tool_name);
50 49
51 InspectableTabProxy* inspectable_tab_proxy() { 50 InspectableTabProxy* inspectable_tab_proxy() {
52 return inspectable_tab_proxy_.get(); 51 return inspectable_tab_proxy_.get();
53 } 52 }
54 53
55 // DevToolsRemoteListener interface 54 // DevToolsRemoteListener interface
56 virtual void HandleMessage(const DevToolsRemoteMessage& message); 55 virtual void HandleMessage(const DevToolsRemoteMessage& message);
57 virtual void OnConnectionLost() {} 56 virtual void OnAcceptConnection(ListenSocket *connection);
57 virtual void OnConnectionLost();
58 58
59 // OutboundSocketDelegate interface 59 // OutboundSocketDelegate interface
60 virtual void Send(const DevToolsRemoteMessage& message); 60 virtual void Send(const DevToolsRemoteMessage& message);
61 61
62 // ListenSocket::ListenSocketDelegate interface
63 virtual void DidAccept(ListenSocket *server, ListenSocket *connection);
64 virtual void DidRead(ListenSocket *connection, const std::string& data);
65 virtual void DidClose(ListenSocket *sock);
66
67 private: 62 private:
68 virtual ~DevToolsProtocolHandler(); 63 virtual ~DevToolsProtocolHandler();
69 64
70 void Init(); 65 void Init();
71 void Teardown(); 66 void Teardown();
72 int port_; 67 int port_;
73 ToolToListenerMap tool_to_listener_map_; 68 ToolToListenerMap tool_to_listener_map_;
74 scoped_refptr<ListenSocket> connection_; 69 scoped_refptr<ListenSocket> connection_;
75 scoped_refptr<DevToolsRemoteListenSocket> server_; 70 scoped_refptr<DevToolsRemoteListenSocket> server_;
76 scoped_ptr<InspectableTabProxy> inspectable_tab_proxy_; 71 scoped_ptr<InspectableTabProxy> inspectable_tab_proxy_;
77 DISALLOW_COPY_AND_ASSIGN(DevToolsProtocolHandler); 72 DISALLOW_COPY_AND_ASSIGN(DevToolsProtocolHandler);
78 }; 73 };
79 74
80 #endif // CHROME_BROWSER_DEBUGGER_DEVTOOLS_PROTOCOL_HANDLER_H_ 75 #endif // CHROME_BROWSER_DEBUGGER_DEVTOOLS_PROTOCOL_HANDLER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/debugger/devtools_protocol_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698