OLD | NEW |
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 "chrome/browser/task_manager/task_manager_resource_providers.h" | 5 #include "chrome/browser/task_manager/task_manager_resource_providers.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 #include "chrome/browser/tab_contents/background_contents.h" | 34 #include "chrome/browser/tab_contents/background_contents.h" |
35 #include "chrome/browser/tab_contents/tab_util.h" | 35 #include "chrome/browser/tab_contents/tab_util.h" |
36 #include "chrome/browser/ui/browser_list.h" | 36 #include "chrome/browser/ui/browser_list.h" |
37 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 37 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
38 #include "chrome/common/chrome_notification_types.h" | 38 #include "chrome/common/chrome_notification_types.h" |
39 #include "chrome/common/chrome_switches.h" | 39 #include "chrome/common/chrome_switches.h" |
40 #include "chrome/common/chrome_view_type.h" | 40 #include "chrome/common/chrome_view_type.h" |
41 #include "chrome/common/extensions/extension.h" | 41 #include "chrome/common/extensions/extension.h" |
42 #include "chrome/common/render_messages.h" | 42 #include "chrome/common/render_messages.h" |
43 #include "chrome/common/url_constants.h" | 43 #include "chrome/common/url_constants.h" |
44 #include "content/browser/browser_child_process_host.h" | |
45 #include "content/browser/renderer_host/render_view_host.h" | 44 #include "content/browser/renderer_host/render_view_host.h" |
| 45 #include "content/public/browser/browser_child_process_host_iterator.h" |
46 #include "content/public/browser/browser_thread.h" | 46 #include "content/public/browser/browser_thread.h" |
| 47 #include "content/public/browser/child_process_data.h" |
47 #include "content/public/browser/notification_service.h" | 48 #include "content/public/browser/notification_service.h" |
48 #include "content/public/browser/render_process_host.h" | 49 #include "content/public/browser/render_process_host.h" |
49 #include "content/public/browser/web_contents.h" | 50 #include "content/public/browser/web_contents.h" |
50 #include "content/public/common/process_type.h" | 51 #include "content/public/common/process_type.h" |
51 #include "grit/generated_resources.h" | 52 #include "grit/generated_resources.h" |
52 #include "grit/theme_resources.h" | 53 #include "grit/theme_resources.h" |
53 #include "grit/theme_resources_standard.h" | 54 #include "grit/theme_resources_standard.h" |
54 #include "third_party/sqlite/sqlite3.h" | 55 #include "third_party/sqlite/sqlite3.h" |
55 #include "ui/base/l10n/l10n_util.h" | 56 #include "ui/base/l10n/l10n_util.h" |
56 #include "ui/base/resource/resource_bundle.h" | 57 #include "ui/base/resource/resource_bundle.h" |
57 #include "v8/include/v8.h" | 58 #include "v8/include/v8.h" |
58 | 59 |
59 #if defined(OS_MACOSX) | 60 #if defined(OS_MACOSX) |
60 #include "skia/ext/skia_utils_mac.h" | 61 #include "skia/ext/skia_utils_mac.h" |
61 #endif | 62 #endif |
62 #if defined(OS_WIN) | 63 #if defined(OS_WIN) |
63 #include "chrome/browser/app_icon_win.h" | 64 #include "chrome/browser/app_icon_win.h" |
64 #include "ui/gfx/icon_util.h" | 65 #include "ui/gfx/icon_util.h" |
65 #endif // defined(OS_WIN) | 66 #endif // defined(OS_WIN) |
66 | 67 |
| 68 using content::BrowserChildProcessHostIterator; |
67 using content::BrowserThread; | 69 using content::BrowserThread; |
68 using content::WebContents; | 70 using content::WebContents; |
69 | 71 |
70 namespace { | 72 namespace { |
71 | 73 |
72 // Returns the appropriate message prefix ID for tabs and extensions, | 74 // Returns the appropriate message prefix ID for tabs and extensions, |
73 // reflecting whether they are apps or in incognito mode. | 75 // reflecting whether they are apps or in incognito mode. |
74 int GetMessagePrefixID(bool is_app, | 76 int GetMessagePrefixID(bool is_app, |
75 bool is_extension, | 77 bool is_extension, |
76 bool is_incognito, | 78 bool is_incognito, |
(...skipping 984 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1061 child_process_data.name, | 1063 child_process_data.name, |
1062 child_process_data.handle); | 1064 child_process_data.handle); |
1063 resources_[child_process_data.handle] = resource; | 1065 resources_[child_process_data.handle] = resource; |
1064 pid_to_resources_[resource->process_id()] = resource; | 1066 pid_to_resources_[resource->process_id()] = resource; |
1065 task_manager_->AddResource(resource); | 1067 task_manager_->AddResource(resource); |
1066 } | 1068 } |
1067 | 1069 |
1068 // The ChildProcessData::Iterator has to be used from the IO thread. | 1070 // The ChildProcessData::Iterator has to be used from the IO thread. |
1069 void TaskManagerChildProcessResourceProvider::RetrieveChildProcessData() { | 1071 void TaskManagerChildProcessResourceProvider::RetrieveChildProcessData() { |
1070 std::vector<content::ChildProcessData> child_processes; | 1072 std::vector<content::ChildProcessData> child_processes; |
1071 for (BrowserChildProcessHost::Iterator iter; !iter.Done(); ++iter) { | 1073 for (BrowserChildProcessHostIterator iter; !iter.Done(); ++iter) { |
1072 // Only add processes which are already started, since we need their handle. | 1074 // Only add processes which are already started, since we need their handle. |
1073 if ((*iter)->data().handle == base::kNullProcessHandle) | 1075 if (iter.GetData().handle == base::kNullProcessHandle) |
1074 continue; | 1076 continue; |
1075 child_processes.push_back((*iter)->data()); | 1077 child_processes.push_back(iter.GetData()); |
1076 } | 1078 } |
1077 // Now notify the UI thread that we have retrieved information about child | 1079 // Now notify the UI thread that we have retrieved information about child |
1078 // processes. | 1080 // processes. |
1079 BrowserThread::PostTask( | 1081 BrowserThread::PostTask( |
1080 BrowserThread::UI, FROM_HERE, | 1082 BrowserThread::UI, FROM_HERE, |
1081 base::Bind( | 1083 base::Bind( |
1082 &TaskManagerChildProcessResourceProvider::ChildProcessDataRetreived, | 1084 &TaskManagerChildProcessResourceProvider::ChildProcessDataRetreived, |
1083 this, child_processes)); | 1085 this, child_processes)); |
1084 } | 1086 } |
1085 | 1087 |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1433 | 1435 |
1434 return &resource_; | 1436 return &resource_; |
1435 } | 1437 } |
1436 | 1438 |
1437 void TaskManagerBrowserProcessResourceProvider::StartUpdating() { | 1439 void TaskManagerBrowserProcessResourceProvider::StartUpdating() { |
1438 task_manager_->AddResource(&resource_); | 1440 task_manager_->AddResource(&resource_); |
1439 } | 1441 } |
1440 | 1442 |
1441 void TaskManagerBrowserProcessResourceProvider::StopUpdating() { | 1443 void TaskManagerBrowserProcessResourceProvider::StopUpdating() { |
1442 } | 1444 } |
OLD | NEW |