| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/task_manager_resource_providers.h" | 5 #include "chrome/browser/task_manager_resource_providers.h" |
| 6 | 6 |
| 7 #include "base/file_version_info.h" | 7 #include "base/file_version_info.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/process_util.h" | 9 #include "base/process_util.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| 11 #include "chrome/app/chrome_dll_resource.h" | 11 #include "chrome/app/chrome_dll_resource.h" |
| 12 #include "grit/theme_resources.h" | 12 #include "grit/theme_resources.h" |
| 13 #include "chrome/browser/browser_process.h" | 13 #include "chrome/browser/browser_process.h" |
| 14 #include "chrome/browser/browser_list.h" | 14 #include "chrome/browser/browser_list.h" |
| 15 #include "chrome/browser/plugin_process_host.h" | |
| 16 #include "chrome/browser/plugin_service.h" | |
| 17 #include "chrome/browser/renderer_host/render_process_host.h" | 15 #include "chrome/browser/renderer_host/render_process_host.h" |
| 18 #include "chrome/browser/renderer_host/resource_message_filter.h" | 16 #include "chrome/browser/renderer_host/resource_message_filter.h" |
| 19 #include "chrome/browser/tab_contents/tab_util.h" | 17 #include "chrome/browser/tab_contents/tab_util.h" |
| 20 #include "chrome/browser/tab_contents/web_contents.h" | 18 #include "chrome/browser/tab_contents/web_contents.h" |
| 21 #include "chrome/common/notification_service.h" | 19 #include "chrome/common/notification_service.h" |
| 22 #include "chrome/common/resource_bundle.h" | 20 #include "chrome/common/resource_bundle.h" |
| 23 #include "chrome/common/stl_util-inl.h" | 21 #include "chrome/common/stl_util-inl.h" |
| 24 #include "chrome/common/gfx/icon_util.h" | 22 #include "chrome/common/gfx/icon_util.h" |
| 25 | 23 |
| 26 #include "generated_resources.h" | 24 #include "generated_resources.h" |
| (...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 | 418 |
| 421 void TaskManagerChildProcessResourceProvider::AddToTaskManager( | 419 void TaskManagerChildProcessResourceProvider::AddToTaskManager( |
| 422 ChildProcessInfo child_process_info) { | 420 ChildProcessInfo child_process_info) { |
| 423 TaskManagerChildProcessResource* resource = | 421 TaskManagerChildProcessResource* resource = |
| 424 new TaskManagerChildProcessResource(child_process_info); | 422 new TaskManagerChildProcessResource(child_process_info); |
| 425 resources_[child_process_info] = resource; | 423 resources_[child_process_info] = resource; |
| 426 pid_to_resources_[resource->process_id()] = resource; | 424 pid_to_resources_[resource->process_id()] = resource; |
| 427 task_manager_->AddResource(resource); | 425 task_manager_->AddResource(resource); |
| 428 } | 426 } |
| 429 | 427 |
| 430 // The PluginProcessIterator has to be used from the IO thread. | 428 // The ChildProcessInfo::Iterator has to be used from the IO thread. |
| 431 void TaskManagerChildProcessResourceProvider::RetrieveChildProcessInfo() { | 429 void TaskManagerChildProcessResourceProvider::RetrieveChildProcessInfo() { |
| 432 for (PluginProcessHostIterator iter; !iter.Done(); ++iter) { | 430 for (ChildProcessInfo::Iterator iter; !iter.Done(); ++iter) { |
| 433 const ChildProcessInfo* child = *iter; | 431 existing_child_process_info_.push_back(**iter); |
| 434 existing_child_process_info_.push_back(*child); | |
| 435 } | 432 } |
| 436 // Now notify the UI thread that we have retrieved the PluginProcessHosts. | 433 // Now notify the UI thread that we have retrieved information about child |
| 434 // processes. |
| 437 ui_loop_->PostTask(FROM_HERE, NewRunnableMethod(this, | 435 ui_loop_->PostTask(FROM_HERE, NewRunnableMethod(this, |
| 438 &TaskManagerChildProcessResourceProvider::ChildProcessInfoRetreived)); | 436 &TaskManagerChildProcessResourceProvider::ChildProcessInfoRetreived)); |
| 439 } | 437 } |
| 440 | 438 |
| 441 // This is called on the UI thread. | 439 // This is called on the UI thread. |
| 442 void TaskManagerChildProcessResourceProvider::ChildProcessInfoRetreived() { | 440 void TaskManagerChildProcessResourceProvider::ChildProcessInfoRetreived() { |
| 443 std::vector<ChildProcessInfo>::const_iterator iter; | 441 std::vector<ChildProcessInfo>::const_iterator iter; |
| 444 for (iter = existing_child_process_info_.begin(); | 442 for (iter = existing_child_process_info_.begin(); |
| 445 iter != existing_child_process_info_.end(); ++iter) { | 443 iter != existing_child_process_info_.end(); ++iter) { |
| 446 Add(*iter); | 444 Add(*iter); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 523 } | 521 } |
| 524 | 522 |
| 525 void TaskManagerBrowserProcessResourceProvider::StartUpdating() { | 523 void TaskManagerBrowserProcessResourceProvider::StartUpdating() { |
| 526 task_manager_->AddResource(&resource_); | 524 task_manager_->AddResource(&resource_); |
| 527 } | 525 } |
| 528 | 526 |
| 529 void TaskManagerBrowserProcessResourceProvider::StopUpdating() { | 527 void TaskManagerBrowserProcessResourceProvider::StopUpdating() { |
| 530 } | 528 } |
| 531 | 529 |
| 532 | 530 |
| OLD | NEW |