| 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/devtools/devtools_agent_host_impl.h" | 5 #include "content/browser/devtools/devtools_agent_host_impl.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 #if DCHECK_IS_ON() | 75 #if DCHECK_IS_ON() |
| 76 for (auto it : result) { | 76 for (auto it : result) { |
| 77 DevToolsAgentHostImpl* host = static_cast<DevToolsAgentHostImpl*>(it.get()); | 77 DevToolsAgentHostImpl* host = static_cast<DevToolsAgentHostImpl*>(it.get()); |
| 78 DCHECK(g_instances.Get().find(host->id_) != g_instances.Get().end()); | 78 DCHECK(g_instances.Get().find(host->id_) != g_instances.Get().end()); |
| 79 } | 79 } |
| 80 #endif | 80 #endif |
| 81 | 81 |
| 82 return result; | 82 return result; |
| 83 } | 83 } |
| 84 | 84 |
| 85 // static | |
| 86 void DevToolsAgentHost::DiscoverAllHosts(const DiscoveryCallback& callback) { | |
| 87 DevToolsManager* manager = DevToolsManager::GetInstance(); | |
| 88 if (!manager->delegate() || !manager->delegate()->DiscoverTargets(callback)) | |
| 89 callback.Run(DevToolsAgentHost::GetOrCreateAll()); | |
| 90 } | |
| 91 | |
| 92 // Called on the UI thread. | 85 // Called on the UI thread. |
| 93 // static | 86 // static |
| 94 scoped_refptr<DevToolsAgentHost> DevToolsAgentHost::GetForWorker( | 87 scoped_refptr<DevToolsAgentHost> DevToolsAgentHost::GetForWorker( |
| 95 int worker_process_id, | 88 int worker_process_id, |
| 96 int worker_route_id) { | 89 int worker_route_id) { |
| 97 if (scoped_refptr<DevToolsAgentHost> host = | 90 if (scoped_refptr<DevToolsAgentHost> host = |
| 98 SharedWorkerDevToolsManager::GetInstance() | 91 SharedWorkerDevToolsManager::GetInstance() |
| 99 ->GetDevToolsAgentHostForWorker(worker_process_id, | 92 ->GetDevToolsAgentHostForWorker(worker_process_id, |
| 100 worker_route_id)) { | 93 worker_route_id)) { |
| 101 return host; | 94 return host; |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 if (message_buffer_.size() != message_buffer_size_) | 382 if (message_buffer_.size() != message_buffer_size_) |
| 390 return false; | 383 return false; |
| 391 callback_.Run(chunk.session_id, message_buffer_); | 384 callback_.Run(chunk.session_id, message_buffer_); |
| 392 message_buffer_ = std::string(); | 385 message_buffer_ = std::string(); |
| 393 message_buffer_size_ = 0; | 386 message_buffer_size_ = 0; |
| 394 } | 387 } |
| 395 return true; | 388 return true; |
| 396 } | 389 } |
| 397 | 390 |
| 398 } // namespace content | 391 } // namespace content |
| OLD | NEW |