| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/debugger/devtools_http_handler_impl.h" | 5 #include "content/browser/debugger/devtools_http_handler_impl.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 virtual ~TabContentsIDHelper() {} | 109 virtual ~TabContentsIDHelper() {} |
| 110 | 110 |
| 111 virtual void WebContentsDestroyed(WebContents* tab) OVERRIDE { | 111 virtual void WebContentsDestroyed(WebContents* tab) OVERRIDE { |
| 112 id_to_tabcontents_.Get().erase(id_); | 112 id_to_tabcontents_.Get().erase(id_); |
| 113 tabcontents_to_id_.Get().erase(static_cast<TabContents*>(tab)); | 113 tabcontents_to_id_.Get().erase(static_cast<TabContents*>(tab)); |
| 114 delete this; | 114 delete this; |
| 115 } | 115 } |
| 116 | 116 |
| 117 int id_; | 117 int id_; |
| 118 typedef std::map<int, TabContents*> IdToTabContentsMap; | 118 typedef std::map<int, TabContents*> IdToTabContentsMap; |
| 119 static base::LazyInstance<IdToTabContentsMap, | 119 static base::LazyInstance<IdToTabContentsMap>::Leaky |
| 120 base::LeakyLazyInstanceTraits<IdToTabContentsMap> > | |
| 121 id_to_tabcontents_; | 120 id_to_tabcontents_; |
| 122 typedef std::map<TabContents*, int> TabContentsToIdMap; | 121 typedef std::map<TabContents*, int> TabContentsToIdMap; |
| 123 static base::LazyInstance<TabContentsToIdMap, | 122 static base::LazyInstance<TabContentsToIdMap>::Leaky |
| 124 base::LeakyLazyInstanceTraits<TabContentsToIdMap> > | |
| 125 tabcontents_to_id_; | 123 tabcontents_to_id_; |
| 126 }; | 124 }; |
| 127 | 125 |
| 128 base::LazyInstance< | 126 base::LazyInstance<TabContentsIDHelper::IdToTabContentsMap>::Leaky |
| 129 TabContentsIDHelper::IdToTabContentsMap, | 127 TabContentsIDHelper::id_to_tabcontents_ = LAZY_INSTANCE_INITIALIZER; |
| 130 base::LeakyLazyInstanceTraits<TabContentsIDHelper::IdToTabContentsMap> > | 128 base::LazyInstance<TabContentsIDHelper::TabContentsToIdMap>::Leaky |
| 131 TabContentsIDHelper::id_to_tabcontents_ = LAZY_INSTANCE_INITIALIZER; | 129 TabContentsIDHelper::tabcontents_to_id_ = LAZY_INSTANCE_INITIALIZER; |
| 132 base::LazyInstance< | |
| 133 TabContentsIDHelper::TabContentsToIdMap, | |
| 134 base::LeakyLazyInstanceTraits<TabContentsIDHelper::TabContentsToIdMap> > | |
| 135 TabContentsIDHelper::tabcontents_to_id_ = LAZY_INSTANCE_INITIALIZER; | |
| 136 | 130 |
| 137 } // namespace | 131 } // namespace |
| 138 | 132 |
| 139 // static | 133 // static |
| 140 DevToolsHttpHandler* DevToolsHttpHandler::Start( | 134 DevToolsHttpHandler* DevToolsHttpHandler::Start( |
| 141 const std::string& ip, | 135 const std::string& ip, |
| 142 int port, | 136 int port, |
| 143 const std::string& frontend_url, | 137 const std::string& frontend_url, |
| 144 DevToolsHttpHandlerDelegate* delegate) { | 138 DevToolsHttpHandlerDelegate* delegate) { |
| 145 DevToolsHttpHandlerImpl* http_handler = | 139 DevToolsHttpHandlerImpl* http_handler = |
| (...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 554 void DevToolsHttpHandlerImpl::AcceptWebSocket( | 548 void DevToolsHttpHandlerImpl::AcceptWebSocket( |
| 555 int connection_id, | 549 int connection_id, |
| 556 const net::HttpServerRequestInfo& request) { | 550 const net::HttpServerRequestInfo& request) { |
| 557 BrowserThread::PostTask( | 551 BrowserThread::PostTask( |
| 558 BrowserThread::IO, FROM_HERE, | 552 BrowserThread::IO, FROM_HERE, |
| 559 base::Bind(&net::HttpServer::AcceptWebSocket, server_.get(), | 553 base::Bind(&net::HttpServer::AcceptWebSocket, server_.get(), |
| 560 connection_id, request)); | 554 connection_id, request)); |
| 561 } | 555 } |
| 562 | 556 |
| 563 } // namespace content | 557 } // namespace content |
| OLD | NEW |