| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "chrome/browser/debugger/devtools_manager.h" | 5 #include "chrome/browser/debugger/devtools_manager.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| 11 #include "chrome/browser/browser_process.h" | 11 #include "chrome/browser/browser_process.h" |
| 12 #include "chrome/browser/browsing_instance.h" | 12 #include "chrome/browser/browsing_instance.h" |
| 13 #include "chrome/browser/child_process_security_policy.h" | 13 #include "chrome/browser/child_process_security_policy.h" |
| 14 #include "chrome/browser/debugger/devtools_client_host.h" |
| 15 #include "chrome/browser/debugger/devtools_netlog_observer.h" |
| 14 #include "chrome/browser/debugger/devtools_window.h" | 16 #include "chrome/browser/debugger/devtools_window.h" |
| 15 #include "chrome/browser/debugger/devtools_client_host.h" | 17 #include "chrome/browser/io_thread.h" |
| 16 #include "chrome/browser/prefs/pref_service.h" | 18 #include "chrome/browser/prefs/pref_service.h" |
| 17 #include "chrome/browser/profile.h" | 19 #include "chrome/browser/profile.h" |
| 18 #include "chrome/browser/renderer_host/render_view_host.h" | 20 #include "chrome/browser/renderer_host/render_view_host.h" |
| 19 #include "chrome/browser/renderer_host/site_instance.h" | 21 #include "chrome/browser/renderer_host/site_instance.h" |
| 20 #include "chrome/browser/tab_contents/tab_contents.h" | 22 #include "chrome/browser/tab_contents/tab_contents.h" |
| 21 #include "chrome/common/pref_names.h" | 23 #include "chrome/common/pref_names.h" |
| 22 #include "googleurl/src/gurl.h" | 24 #include "googleurl/src/gurl.h" |
| 23 | 25 |
| 24 // static | 26 // static |
| 25 DevToolsManager* DevToolsManager::GetInstance() { | 27 DevToolsManager* DevToolsManager::GetInstance() { |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 | 381 |
| 380 void DevToolsManager::BindClientHost( | 382 void DevToolsManager::BindClientHost( |
| 381 RenderViewHost* inspected_rvh, | 383 RenderViewHost* inspected_rvh, |
| 382 DevToolsClientHost* client_host, | 384 DevToolsClientHost* client_host, |
| 383 const DevToolsRuntimeProperties& runtime_properties) { | 385 const DevToolsRuntimeProperties& runtime_properties) { |
| 384 DCHECK(inspected_rvh_to_client_host_.find(inspected_rvh) == | 386 DCHECK(inspected_rvh_to_client_host_.find(inspected_rvh) == |
| 385 inspected_rvh_to_client_host_.end()); | 387 inspected_rvh_to_client_host_.end()); |
| 386 DCHECK(client_host_to_inspected_rvh_.find(client_host) == | 388 DCHECK(client_host_to_inspected_rvh_.find(client_host) == |
| 387 client_host_to_inspected_rvh_.end()); | 389 client_host_to_inspected_rvh_.end()); |
| 388 | 390 |
| 391 if (client_host_to_inspected_rvh_.empty()) { |
| 392 ChromeThread::PostTask( |
| 393 ChromeThread::IO, |
| 394 FROM_HERE, |
| 395 NewRunnableFunction(&DevToolsNetLogObserver::Attach, |
| 396 g_browser_process->io_thread())); |
| 397 } |
| 389 inspected_rvh_to_client_host_[inspected_rvh] = client_host; | 398 inspected_rvh_to_client_host_[inspected_rvh] = client_host; |
| 390 client_host_to_inspected_rvh_[client_host] = inspected_rvh; | 399 client_host_to_inspected_rvh_[client_host] = inspected_rvh; |
| 391 runtime_properties_map_[inspected_rvh] = runtime_properties; | 400 runtime_properties_map_[inspected_rvh] = runtime_properties; |
| 392 } | 401 } |
| 393 | 402 |
| 394 void DevToolsManager::UnbindClientHost(RenderViewHost* inspected_rvh, | 403 void DevToolsManager::UnbindClientHost(RenderViewHost* inspected_rvh, |
| 395 DevToolsClientHost* client_host) { | 404 DevToolsClientHost* client_host) { |
| 396 DCHECK(inspected_rvh_to_client_host_.find(inspected_rvh)->second == | 405 DCHECK(inspected_rvh_to_client_host_.find(inspected_rvh)->second == |
| 397 client_host); | 406 client_host); |
| 398 DCHECK(client_host_to_inspected_rvh_.find(client_host)->second == | 407 DCHECK(client_host_to_inspected_rvh_.find(client_host)->second == |
| 399 inspected_rvh); | 408 inspected_rvh); |
| 400 | 409 |
| 401 inspected_rvh_to_client_host_.erase(inspected_rvh); | 410 inspected_rvh_to_client_host_.erase(inspected_rvh); |
| 402 client_host_to_inspected_rvh_.erase(client_host); | 411 client_host_to_inspected_rvh_.erase(client_host); |
| 403 runtime_properties_map_.erase(inspected_rvh); | 412 runtime_properties_map_.erase(inspected_rvh); |
| 413 |
| 414 if (client_host_to_inspected_rvh_.empty()) { |
| 415 ChromeThread::PostTask( |
| 416 ChromeThread::IO, |
| 417 FROM_HERE, |
| 418 NewRunnableFunction(&DevToolsNetLogObserver::Detach)); |
| 419 } |
| 404 } | 420 } |
| OLD | NEW |