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

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

Issue 11633035: DevTools: prepare workers for DevToolsManager::Attach(Detach)ClientHost removal. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Patch for landing Created 8 years 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_manager_impl.h" 5 #include "content/browser/devtools/devtools_manager_impl.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 agent_to_client_host_.erase(agent_host); 234 agent_to_client_host_.erase(agent_host);
235 client_to_agent_host_.erase(client_host); 235 client_to_agent_host_.erase(client_host);
236 agent_runtime_states_.erase(agent_host); 236 agent_runtime_states_.erase(agent_host);
237 237
238 if (client_to_agent_host_.empty()) { 238 if (client_to_agent_host_.empty()) {
239 BrowserThread::PostTask( 239 BrowserThread::PostTask(
240 BrowserThread::IO, 240 BrowserThread::IO,
241 FROM_HERE, 241 FROM_HERE,
242 base::Bind(&DevToolsNetLogObserver::Detach)); 242 base::Bind(&DevToolsNetLogObserver::Detach));
243 } 243 }
244 int process_id = agent_host->GetRenderProcessId();
245
246 // Lazy agent hosts can be deleted from within detach.
247 // Do not access agent_host below this line.
244 agent_host->Detach(); 248 agent_host->Detach();
245 249
246 int process_id = agent_host->GetRenderProcessId();
247 if (process_id == -1) 250 if (process_id == -1)
248 return; 251 return;
249 for (AgentToClientHostMap::iterator it = agent_to_client_host_.begin(); 252 for (AgentToClientHostMap::iterator it = agent_to_client_host_.begin();
250 it != agent_to_client_host_.end(); 253 it != agent_to_client_host_.end();
251 ++it) { 254 ++it) {
252 if (it->first->GetRenderProcessId() == process_id) 255 if (it->first->GetRenderProcessId() == process_id)
253 return; 256 return;
254 } 257 }
255 // We've disconnected from the last renderer -> revoke cookie permissions. 258 // We've disconnected from the last renderer -> revoke cookie permissions.
256 ChildProcessSecurityPolicyImpl::GetInstance()->RevokeReadRawCookies( 259 ChildProcessSecurityPolicyImpl::GetInstance()->RevokeReadRawCookies(
257 process_id); 260 process_id);
258 } 261 }
259 262
260 void DevToolsManagerImpl::CloseAllClientHosts() { 263 void DevToolsManagerImpl::CloseAllClientHosts() {
261 std::vector<DevToolsAgentHost*> agents; 264 std::vector<DevToolsAgentHost*> agents;
262 for (AgentToClientHostMap::iterator it = 265 for (AgentToClientHostMap::iterator it =
263 agent_to_client_host_.begin(); 266 agent_to_client_host_.begin();
264 it != agent_to_client_host_.end(); ++it) { 267 it != agent_to_client_host_.end(); ++it) {
265 agents.push_back(it->first); 268 agents.push_back(it->first);
266 } 269 }
267 for (std::vector<DevToolsAgentHost*>::iterator it = agents.begin(); 270 for (std::vector<DevToolsAgentHost*>::iterator it = agents.begin();
268 it != agents.end(); ++it) { 271 it != agents.end(); ++it) {
269 UnregisterDevToolsClientHostFor(*it); 272 UnregisterDevToolsClientHostFor(*it);
270 } 273 }
271 } 274 }
272 275
273 } // namespace content 276 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/devtools/devtools_agent_host.cc ('k') | content/browser/devtools/worker_devtools_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698