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/task_manager_resource_providers.h" | 5 #include "chrome/browser/task_manager_resource_providers.h" |
6 | 6 |
7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
8 | 8 |
9 #if defined(OS_WIN) | 9 #if defined(OS_WIN) |
10 #include <atlbase.h> | 10 #include <atlbase.h> |
11 #endif // defined(OS_WIN) | 11 #endif // defined(OS_WIN) |
12 | 12 |
13 #if defined(OS_WIN) | 13 #if defined(OS_WIN) |
14 #include "app/gfx/icon_util.h" | 14 #include "app/gfx/icon_util.h" |
15 #endif // defined(OS_WIN) | 15 #endif // defined(OS_WIN) |
16 #include "app/l10n_util.h" | 16 #include "app/l10n_util.h" |
17 #include "app/resource_bundle.h" | 17 #include "app/resource_bundle.h" |
18 #include "base/basictypes.h" | 18 #include "base/basictypes.h" |
19 #include "base/file_version_info.h" | 19 #include "base/file_version_info.h" |
20 #include "base/message_loop.h" | |
21 #include "base/process_util.h" | 20 #include "base/process_util.h" |
22 #include "base/stl_util-inl.h" | 21 #include "base/stl_util-inl.h" |
23 #include "base/string_util.h" | 22 #include "base/string_util.h" |
24 #include "base/thread.h" | 23 #include "base/thread.h" |
25 #include "chrome/app/chrome_dll_resource.h" | 24 #include "chrome/app/chrome_dll_resource.h" |
26 #include "chrome/browser/browser_process.h" | 25 #include "chrome/browser/browser_process.h" |
27 #include "chrome/browser/browser_list.h" | 26 #include "chrome/browser/browser_list.h" |
28 #include "chrome/browser/chrome_thread.h" | 27 #include "chrome/browser/chrome_thread.h" |
29 #include "chrome/browser/extensions/extension_host.h" | 28 #include "chrome/browser/extensions/extension_host.h" |
30 #include "chrome/browser/extensions/extension_process_manager.h" | 29 #include "chrome/browser/extensions/extension_process_manager.h" |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 return child_process_.handle(); | 324 return child_process_.handle(); |
326 } | 325 } |
327 | 326 |
328 //////////////////////////////////////////////////////////////////////////////// | 327 //////////////////////////////////////////////////////////////////////////////// |
329 // TaskManagerChildProcessResourceProvider class | 328 // TaskManagerChildProcessResourceProvider class |
330 //////////////////////////////////////////////////////////////////////////////// | 329 //////////////////////////////////////////////////////////////////////////////// |
331 | 330 |
332 TaskManagerChildProcessResourceProvider:: | 331 TaskManagerChildProcessResourceProvider:: |
333 TaskManagerChildProcessResourceProvider(TaskManager* task_manager) | 332 TaskManagerChildProcessResourceProvider(TaskManager* task_manager) |
334 : updating_(false), | 333 : updating_(false), |
335 task_manager_(task_manager), | 334 task_manager_(task_manager) { |
336 ui_loop_(MessageLoop::current()) { | |
337 } | 335 } |
338 | 336 |
339 TaskManagerChildProcessResourceProvider:: | 337 TaskManagerChildProcessResourceProvider:: |
340 ~TaskManagerChildProcessResourceProvider() { | 338 ~TaskManagerChildProcessResourceProvider() { |
341 } | 339 } |
342 | 340 |
343 TaskManager::Resource* TaskManagerChildProcessResourceProvider::GetResource( | 341 TaskManager::Resource* TaskManagerChildProcessResourceProvider::GetResource( |
344 int origin_pid, | 342 int origin_pid, |
345 int render_process_host_id, | 343 int render_process_host_id, |
346 int routing_id) { | 344 int routing_id) { |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
459 task_manager_->AddResource(resource); | 457 task_manager_->AddResource(resource); |
460 } | 458 } |
461 | 459 |
462 // The ChildProcessInfo::Iterator has to be used from the IO thread. | 460 // The ChildProcessInfo::Iterator has to be used from the IO thread. |
463 void TaskManagerChildProcessResourceProvider::RetrieveChildProcessInfo() { | 461 void TaskManagerChildProcessResourceProvider::RetrieveChildProcessInfo() { |
464 for (ChildProcessHost::Iterator iter; !iter.Done(); ++iter) { | 462 for (ChildProcessHost::Iterator iter; !iter.Done(); ++iter) { |
465 existing_child_process_info_.push_back(**iter); | 463 existing_child_process_info_.push_back(**iter); |
466 } | 464 } |
467 // Now notify the UI thread that we have retrieved information about child | 465 // Now notify the UI thread that we have retrieved information about child |
468 // processes. | 466 // processes. |
469 ui_loop_->PostTask(FROM_HERE, NewRunnableMethod(this, | 467 ChromeThread::PostTask( |
470 &TaskManagerChildProcessResourceProvider::ChildProcessInfoRetreived)); | 468 ChromeThread::UI, FROM_HERE, |
| 469 NewRunnableMethod(this, |
| 470 &TaskManagerChildProcessResourceProvider::ChildProcessInfoRetreived)); |
471 } | 471 } |
472 | 472 |
473 // This is called on the UI thread. | 473 // This is called on the UI thread. |
474 void TaskManagerChildProcessResourceProvider::ChildProcessInfoRetreived() { | 474 void TaskManagerChildProcessResourceProvider::ChildProcessInfoRetreived() { |
475 std::vector<ChildProcessInfo>::const_iterator iter; | 475 std::vector<ChildProcessInfo>::const_iterator iter; |
476 for (iter = existing_child_process_info_.begin(); | 476 for (iter = existing_child_process_info_.begin(); |
477 iter != existing_child_process_info_.end(); ++iter) { | 477 iter != existing_child_process_info_.end(); ++iter) { |
478 Add(*iter); | 478 Add(*iter); |
479 } | 479 } |
480 existing_child_process_info_.clear(); | 480 existing_child_process_info_.clear(); |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
742 | 742 |
743 return &resource_; | 743 return &resource_; |
744 } | 744 } |
745 | 745 |
746 void TaskManagerBrowserProcessResourceProvider::StartUpdating() { | 746 void TaskManagerBrowserProcessResourceProvider::StartUpdating() { |
747 task_manager_->AddResource(&resource_); | 747 task_manager_->AddResource(&resource_); |
748 } | 748 } |
749 | 749 |
750 void TaskManagerBrowserProcessResourceProvider::StopUpdating() { | 750 void TaskManagerBrowserProcessResourceProvider::StopUpdating() { |
751 } | 751 } |
OLD | NEW |