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

Side by Side Diff: content/browser/devtools/devtools_agent_host_impl.cc

Issue 2833213002: DevTools: retain DTAH in all the targets to match their life time. (Closed)
Patch Set: Created 3 years, 8 months 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 unified diff | Download patch
OLDNEW
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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698