diff options
-rw-r--r-- | chrome/browser/debugger/devtools_http_protocol_handler.cc | 17 | ||||
-rw-r--r-- | chrome/browser/debugger/devtools_http_protocol_handler.h | 1 |
2 files changed, 18 insertions, 0 deletions
diff --git a/chrome/browser/debugger/devtools_http_protocol_handler.cc b/chrome/browser/debugger/devtools_http_protocol_handler.cc index e60045f..9f23945 100644 --- a/chrome/browser/debugger/devtools_http_protocol_handler.cc +++ b/chrome/browser/debugger/devtools_http_protocol_handler.cc @@ -270,6 +270,18 @@ void DevToolsHttpProtocolHandler::OnCloseUI(HttpListenSocket* socket) { client_host->NotifyCloseListener(); delete client_host; socket_to_client_host_ui_.erase(socket); + + // We are holding last reference to scoped refptr 'socket' here. + // We can't exit method just like that since 'socket' is going to + // be destroyed on the UI thread then. Schedule no-op to IO thread + // so that socket is destroyed on IO instead. + BrowserThread::PostTask( + BrowserThread::IO, + FROM_HERE, + NewRunnableMethod( + this, + &DevToolsHttpProtocolHandler::ReleaseSocket, + make_scoped_refptr(socket))); } void DevToolsHttpProtocolHandler::OnResponseStarted(net::URLRequest* request) { @@ -404,6 +416,11 @@ void DevToolsHttpProtocolHandler::AcceptWebSocket( request)); } +void DevToolsHttpProtocolHandler::ReleaseSocket( + HttpListenSocket* socket) { + // This in fact is scoped ref ptr. It'll get nuked on exit. +} + TabContents* DevToolsHttpProtocolHandler::GetTabContents(int session_id) { for (BrowserList::const_iterator it = BrowserList::begin(), end = BrowserList::end(); it != end; ++it) { diff --git a/chrome/browser/debugger/devtools_http_protocol_handler.h b/chrome/browser/debugger/devtools_http_protocol_handler.h index 5be89d2..c5c485f 100644 --- a/chrome/browser/debugger/devtools_http_protocol_handler.h +++ b/chrome/browser/debugger/devtools_http_protocol_handler.h @@ -68,6 +68,7 @@ class DevToolsHttpProtocolHandler const std::string& message); void AcceptWebSocket(HttpListenSocket* socket, const HttpServerRequestInfo& request); + void ReleaseSocket(HttpListenSocket* socket); TabContents* GetTabContents(int session_id); |