OLD | NEW |
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 #include "chrome/browser/debugger/devtools_protocol_handler.h" | 5 #include "chrome/browser/debugger/devtools_protocol_handler.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "chrome/browser/browser_thread.h" | 8 #include "chrome/browser/browser_thread.h" |
9 #include "chrome/browser/debugger/inspectable_tab_proxy.h" | 9 #include "chrome/browser/debugger/inspectable_tab_proxy.h" |
| 10 #include "chrome/browser/debugger/debugger_remote_service.h" |
10 #include "chrome/browser/debugger/devtools_remote_message.h" | 11 #include "chrome/browser/debugger/devtools_remote_message.h" |
11 #include "chrome/browser/debugger/devtools_remote_listen_socket.h" | 12 #include "chrome/browser/debugger/devtools_remote_listen_socket.h" |
| 13 #include "chrome/browser/debugger/devtools_remote_service.h" |
| 14 #include "chrome/browser/debugger/extension_ports_remote_service.h" |
| 15 |
| 16 // static |
| 17 scoped_refptr<DevToolsProtocolHandler> DevToolsProtocolHandler::Start( |
| 18 int port) { |
| 19 scoped_refptr<DevToolsProtocolHandler> proto_handler = |
| 20 new DevToolsProtocolHandler(port); |
| 21 proto_handler->RegisterDestination( |
| 22 new DevToolsRemoteService(proto_handler), |
| 23 DevToolsRemoteService::kToolName); |
| 24 proto_handler->RegisterDestination( |
| 25 new DebuggerRemoteService(proto_handler), |
| 26 DebuggerRemoteService::kToolName); |
| 27 proto_handler->RegisterDestination( |
| 28 new ExtensionPortsRemoteService(proto_handler), |
| 29 ExtensionPortsRemoteService::kToolName); |
| 30 proto_handler->Start(); |
| 31 return proto_handler; |
| 32 } |
12 | 33 |
13 DevToolsProtocolHandler::DevToolsProtocolHandler(int port) | 34 DevToolsProtocolHandler::DevToolsProtocolHandler(int port) |
14 : port_(port), | 35 : port_(port), |
15 connection_(NULL), | 36 connection_(NULL), |
16 server_(NULL) { | 37 server_(NULL) { |
17 inspectable_tab_proxy_.reset(new InspectableTabProxy); | 38 inspectable_tab_proxy_.reset(new InspectableTabProxy); |
18 } | 39 } |
19 | 40 |
20 DevToolsProtocolHandler::~DevToolsProtocolHandler() { | 41 DevToolsProtocolHandler::~DevToolsProtocolHandler() { |
21 // Stop() must be called prior to this being called | 42 // Stop() must be called prior to this being called |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 for (ToolToListenerMap::const_iterator it = tool_to_listener_map_.begin(), | 116 for (ToolToListenerMap::const_iterator it = tool_to_listener_map_.begin(), |
96 end = tool_to_listener_map_.end(); | 117 end = tool_to_listener_map_.end(); |
97 it != end; | 118 it != end; |
98 ++it) { | 119 ++it) { |
99 BrowserThread::PostTask( | 120 BrowserThread::PostTask( |
100 BrowserThread::UI, FROM_HERE, | 121 BrowserThread::UI, FROM_HERE, |
101 NewRunnableMethod( | 122 NewRunnableMethod( |
102 it->second.get(), &DevToolsRemoteListener::OnConnectionLost)); | 123 it->second.get(), &DevToolsRemoteListener::OnConnectionLost)); |
103 } | 124 } |
104 } | 125 } |
OLD | NEW |