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" | 20 #include "base/message_loop.h" |
21 #include "base/process_util.h" | 21 #include "base/process_util.h" |
22 #include "base/stl_util-inl.h" | 22 #include "base/stl_util-inl.h" |
23 #include "base/string_util.h" | 23 #include "base/string_util.h" |
24 #include "base/thread.h" | 24 #include "base/thread.h" |
25 #include "chrome/app/chrome_dll_resource.h" | 25 #include "chrome/app/chrome_dll_resource.h" |
26 #include "chrome/browser/browser_process.h" | 26 #include "chrome/browser/browser_process.h" |
27 #include "chrome/browser/browser_list.h" | 27 #include "chrome/browser/browser_list.h" |
| 28 #include "chrome/browser/chrome_thread.h" |
28 #include "chrome/browser/extensions/extension_host.h" | 29 #include "chrome/browser/extensions/extension_host.h" |
29 #include "chrome/browser/extensions/extension_process_manager.h" | 30 #include "chrome/browser/extensions/extension_process_manager.h" |
30 #include "chrome/browser/profile_manager.h" | 31 #include "chrome/browser/profile_manager.h" |
31 #include "chrome/browser/renderer_host/render_process_host.h" | 32 #include "chrome/browser/renderer_host/render_process_host.h" |
32 #include "chrome/browser/renderer_host/resource_message_filter.h" | 33 #include "chrome/browser/renderer_host/resource_message_filter.h" |
33 #include "chrome/browser/tab_contents/tab_util.h" | 34 #include "chrome/browser/tab_contents/tab_util.h" |
34 #include "chrome/browser/tab_contents/tab_contents.h" | 35 #include "chrome/browser/tab_contents/tab_contents.h" |
35 #include "chrome/common/child_process_host.h" | 36 #include "chrome/common/child_process_host.h" |
36 #include "chrome/common/extensions/extension.h" | 37 #include "chrome/common/extensions/extension.h" |
37 #include "chrome/common/notification_service.h" | 38 #include "chrome/common/notification_service.h" |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 DCHECK(!updating_); | 356 DCHECK(!updating_); |
356 updating_ = true; | 357 updating_ = true; |
357 | 358 |
358 // Register for notifications to get new plugin processes. | 359 // Register for notifications to get new plugin processes. |
359 registrar_.Add(this, NotificationType::CHILD_PROCESS_HOST_CONNECTED, | 360 registrar_.Add(this, NotificationType::CHILD_PROCESS_HOST_CONNECTED, |
360 NotificationService::AllSources()); | 361 NotificationService::AllSources()); |
361 registrar_.Add(this, NotificationType::CHILD_PROCESS_HOST_DISCONNECTED, | 362 registrar_.Add(this, NotificationType::CHILD_PROCESS_HOST_DISCONNECTED, |
362 NotificationService::AllSources()); | 363 NotificationService::AllSources()); |
363 | 364 |
364 // Get the existing plugins | 365 // Get the existing plugins |
365 MessageLoop* io_loop_ = g_browser_process->io_thread()->message_loop(); | 366 ChromeThread::PostTask( |
366 io_loop_->PostTask(FROM_HERE, NewRunnableMethod(this, | 367 ChromeThread::IO, FROM_HERE, |
367 &TaskManagerChildProcessResourceProvider::RetrieveChildProcessInfo)); | 368 NewRunnableMethod( |
| 369 this, |
| 370 &TaskManagerChildProcessResourceProvider::RetrieveChildProcessInfo)); |
368 } | 371 } |
369 | 372 |
370 void TaskManagerChildProcessResourceProvider::StopUpdating() { | 373 void TaskManagerChildProcessResourceProvider::StopUpdating() { |
371 DCHECK(updating_); | 374 DCHECK(updating_); |
372 updating_ = false; | 375 updating_ = false; |
373 | 376 |
374 // Unregister for notifications to get new plugin processes. | 377 // Unregister for notifications to get new plugin processes. |
375 registrar_.Remove(this, NotificationType::CHILD_PROCESS_HOST_CONNECTED, | 378 registrar_.Remove(this, NotificationType::CHILD_PROCESS_HOST_CONNECTED, |
376 NotificationService::AllSources()); | 379 NotificationService::AllSources()); |
377 registrar_.Remove(this, | 380 registrar_.Remove(this, |
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
739 | 742 |
740 return &resource_; | 743 return &resource_; |
741 } | 744 } |
742 | 745 |
743 void TaskManagerBrowserProcessResourceProvider::StartUpdating() { | 746 void TaskManagerBrowserProcessResourceProvider::StartUpdating() { |
744 task_manager_->AddResource(&resource_); | 747 task_manager_->AddResource(&resource_); |
745 } | 748 } |
746 | 749 |
747 void TaskManagerBrowserProcessResourceProvider::StopUpdating() { | 750 void TaskManagerBrowserProcessResourceProvider::StopUpdating() { |
748 } | 751 } |
OLD | NEW |