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

Unified Diff: chrome/browser/debugger/devtools_protocol_handler.cc

Issue 8635005: DevTools: remove support for legacy remote debugger (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed tests compilation Created 9 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 | « chrome/browser/debugger/devtools_protocol_handler.h ('k') | chrome/browser/debugger/devtools_remote.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/debugger/devtools_protocol_handler.cc
diff --git a/chrome/browser/debugger/devtools_protocol_handler.cc b/chrome/browser/debugger/devtools_protocol_handler.cc
deleted file mode 100644
index af9490299a6c1c5a1914792eb9aecdac242901e4..0000000000000000000000000000000000000000
--- a/chrome/browser/debugger/devtools_protocol_handler.cc
+++ /dev/null
@@ -1,128 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/debugger/devtools_protocol_handler.h"
-
-#include "base/bind.h"
-#include "base/logging.h"
-#include "chrome/browser/debugger/debugger_remote_service.h"
-#include "chrome/browser/debugger/devtools_remote_listen_socket.h"
-#include "chrome/browser/debugger/devtools_remote_message.h"
-#include "chrome/browser/debugger/devtools_remote_service.h"
-#include "chrome/browser/debugger/extension_ports_remote_service.h"
-#include "chrome/browser/debugger/inspectable_tab_proxy.h"
-#include "content/public/browser/browser_thread.h"
-
-using content::BrowserThread;
-
-// static
-scoped_refptr<DevToolsProtocolHandler> DevToolsProtocolHandler::Start(
- int port) {
- scoped_refptr<DevToolsProtocolHandler> proto_handler =
- new DevToolsProtocolHandler(port);
- proto_handler->RegisterDestination(
- new DevToolsRemoteService(proto_handler),
- DevToolsRemoteService::kToolName);
- proto_handler->RegisterDestination(
- new DebuggerRemoteService(proto_handler),
- DebuggerRemoteService::kToolName);
- proto_handler->RegisterDestination(
- new ExtensionPortsRemoteService(proto_handler),
- ExtensionPortsRemoteService::kToolName);
- proto_handler->Start();
- return proto_handler;
-}
-
-DevToolsProtocolHandler::DevToolsProtocolHandler(int port)
- : port_(port),
- connection_(NULL),
- server_(NULL) {
- inspectable_tab_proxy_.reset(new InspectableTabProxy);
-}
-
-DevToolsProtocolHandler::~DevToolsProtocolHandler() {
- // Stop() must be called prior to this being called
- DCHECK(server_.get() == NULL);
- DCHECK(connection_.get() == NULL);
-}
-
-void DevToolsProtocolHandler::Start() {
- BrowserThread::PostTask(
- BrowserThread::IO, FROM_HERE,
- base::Bind(&DevToolsProtocolHandler::Init, this));
-}
-
-void DevToolsProtocolHandler::Init() {
- server_ = DevToolsRemoteListenSocket::Listen(
- "127.0.0.1", port_, this);
-}
-
-void DevToolsProtocolHandler::Stop() {
- BrowserThread::PostTask(
- BrowserThread::IO, FROM_HERE,
- base::Bind(&DevToolsProtocolHandler::Teardown, this));
- tool_to_listener_map_.clear(); // Releases all scoped_refptr's to listeners
-}
-
-// Run in I/O thread
-void DevToolsProtocolHandler::Teardown() {
- connection_ = NULL;
- server_ = NULL;
-}
-
-void DevToolsProtocolHandler::RegisterDestination(
- DevToolsRemoteListener* listener,
- const std::string& tool_name) {
- DCHECK(tool_to_listener_map_.find(tool_name) == tool_to_listener_map_.end());
- tool_to_listener_map_.insert(std::make_pair(tool_name, listener));
-}
-
-void DevToolsProtocolHandler::UnregisterDestination(
- DevToolsRemoteListener* listener,
- const std::string& tool_name) {
- DCHECK(tool_to_listener_map_.find(tool_name) != tool_to_listener_map_.end());
- DCHECK(tool_to_listener_map_.find(tool_name)->second == listener);
- tool_to_listener_map_.erase(tool_name);
-}
-
-void DevToolsProtocolHandler::HandleMessage(
- const DevToolsRemoteMessage& message) {
- std::string tool = message.GetHeaderWithEmptyDefault(
- DevToolsRemoteMessageHeaders::kTool);
- ToolToListenerMap::const_iterator it = tool_to_listener_map_.find(tool);
- if (it == tool_to_listener_map_.end()) {
- NOTREACHED(); // an unsupported tool, bail out
- return;
- }
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
- BrowserThread::PostTask(
- BrowserThread::UI, FROM_HERE,
- base::Bind(&DevToolsRemoteListener::HandleMessage, it->second.get(),
- message));
-}
-
-void DevToolsProtocolHandler::Send(const DevToolsRemoteMessage& message) {
- if (connection_ != NULL) {
- connection_->Send(message.ToString());
- }
-}
-
-void DevToolsProtocolHandler::OnAcceptConnection(
- net::ListenSocket *connection) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
- connection_ = connection;
-}
-
-void DevToolsProtocolHandler::OnConnectionLost() {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
- connection_ = NULL;
- for (ToolToListenerMap::const_iterator it = tool_to_listener_map_.begin(),
- end = tool_to_listener_map_.end();
- it != end;
- ++it) {
- BrowserThread::PostTask(
- BrowserThread::UI, FROM_HERE,
- base::Bind(&DevToolsRemoteListener::OnConnectionLost, it->second.get()));
- }
-}
« no previous file with comments | « chrome/browser/debugger/devtools_protocol_handler.h ('k') | chrome/browser/debugger/devtools_remote.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698