Chromium Code Reviews| 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 | 85 // static |
| 86 void DevToolsAgentHost::DiscoverAllHosts(const DiscoveryCallback& callback) { | 86 DevToolsAgentHost::List DevToolsAgentHost::DiscoverAllHosts() { |
|
dgozman
2017/04/22 00:00:45
Inline this method to http handler.
| |
| 87 DevToolsManager* manager = DevToolsManager::GetInstance(); | 87 DevToolsManager* manager = DevToolsManager::GetInstance(); |
| 88 if (!manager->delegate() || !manager->delegate()->DiscoverTargets(callback)) | 88 if (!manager->delegate() || !manager->delegate()->CanDiscoverTargets()) |
| 89 callback.Run(DevToolsAgentHost::GetOrCreateAll()); | 89 return DevToolsAgentHost::GetOrCreateAll(); |
| 90 return manager->delegate()->DiscoverTargets(); | |
|
dgozman
2017/04/22 00:00:45
DiscoverTargetsAvailableRemotely
| |
| 90 } | 91 } |
| 91 | 92 |
| 92 // Called on the UI thread. | 93 // Called on the UI thread. |
| 93 // static | 94 // static |
| 94 scoped_refptr<DevToolsAgentHost> DevToolsAgentHost::GetForWorker( | 95 scoped_refptr<DevToolsAgentHost> DevToolsAgentHost::GetForWorker( |
| 95 int worker_process_id, | 96 int worker_process_id, |
| 96 int worker_route_id) { | 97 int worker_route_id) { |
| 97 if (scoped_refptr<DevToolsAgentHost> host = | 98 if (scoped_refptr<DevToolsAgentHost> host = |
| 98 SharedWorkerDevToolsManager::GetInstance() | 99 SharedWorkerDevToolsManager::GetInstance() |
| 99 ->GetDevToolsAgentHostForWorker(worker_process_id, | 100 ->GetDevToolsAgentHostForWorker(worker_process_id, |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 389 if (message_buffer_.size() != message_buffer_size_) | 390 if (message_buffer_.size() != message_buffer_size_) |
| 390 return false; | 391 return false; |
| 391 callback_.Run(chunk.session_id, message_buffer_); | 392 callback_.Run(chunk.session_id, message_buffer_); |
| 392 message_buffer_ = std::string(); | 393 message_buffer_ = std::string(); |
| 393 message_buffer_size_ = 0; | 394 message_buffer_size_ = 0; |
| 394 } | 395 } |
| 395 return true; | 396 return true; |
| 396 } | 397 } |
| 397 | 398 |
| 398 } // namespace content | 399 } // namespace content |
| OLD | NEW |