| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 | 8 |
| 9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
| 10 #include "app/resource_bundle.h" | 10 #include "app/resource_bundle.h" |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 size_t v8_memory_allocated, size_t v8_memory_used) { | 127 size_t v8_memory_allocated, size_t v8_memory_used) { |
| 128 v8_memory_allocated_ = v8_memory_allocated; | 128 v8_memory_allocated_ = v8_memory_allocated; |
| 129 v8_memory_used_ = v8_memory_used; | 129 v8_memory_used_ = v8_memory_used; |
| 130 pending_v8_memory_allocated_update_ = false; | 130 pending_v8_memory_allocated_update_ = false; |
| 131 } | 131 } |
| 132 | 132 |
| 133 base::ProcessHandle TaskManagerRendererResource::GetProcess() const { | 133 base::ProcessHandle TaskManagerRendererResource::GetProcess() const { |
| 134 return process_; | 134 return process_; |
| 135 } | 135 } |
| 136 | 136 |
| 137 TaskManager::Resource::Type TaskManagerRendererResource::GetType() const { |
| 138 return RENDERER; |
| 139 } |
| 140 |
| 141 bool TaskManagerRendererResource::ReportsCacheStats() const { |
| 142 return true; |
| 143 } |
| 144 |
| 145 bool TaskManagerRendererResource::ReportsV8MemoryStats() const { |
| 146 return true; |
| 147 } |
| 148 |
| 149 bool TaskManagerRendererResource::SupportNetworkUsage() const { |
| 150 return true; |
| 151 } |
| 152 |
| 137 //////////////////////////////////////////////////////////////////////////////// | 153 //////////////////////////////////////////////////////////////////////////////// |
| 138 // TaskManagerTabContentsResource class | 154 // TaskManagerTabContentsResource class |
| 139 //////////////////////////////////////////////////////////////////////////////// | 155 //////////////////////////////////////////////////////////////////////////////// |
| 140 | 156 |
| 141 TaskManagerTabContentsResource::TaskManagerTabContentsResource( | 157 TaskManagerTabContentsResource::TaskManagerTabContentsResource( |
| 142 TabContents* tab_contents) | 158 TabContents* tab_contents) |
| 143 : TaskManagerRendererResource( | 159 : TaskManagerRendererResource( |
| 144 tab_contents->GetRenderProcessHost()->GetHandle(), | 160 tab_contents->GetRenderProcessHost()->GetHandle(), |
| 145 tab_contents->render_view_host()), | 161 tab_contents->render_view_host()), |
| 146 tab_contents_(tab_contents) { | 162 tab_contents_(tab_contents) { |
| (...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 881 } | 897 } |
| 882 | 898 |
| 883 SkBitmap TaskManagerExtensionProcessResource::GetIcon() const { | 899 SkBitmap TaskManagerExtensionProcessResource::GetIcon() const { |
| 884 return *default_icon_; | 900 return *default_icon_; |
| 885 } | 901 } |
| 886 | 902 |
| 887 base::ProcessHandle TaskManagerExtensionProcessResource::GetProcess() const { | 903 base::ProcessHandle TaskManagerExtensionProcessResource::GetProcess() const { |
| 888 return process_handle_; | 904 return process_handle_; |
| 889 } | 905 } |
| 890 | 906 |
| 907 TaskManager::Resource::Type |
| 908 TaskManagerExtensionProcessResource::GetType() const { |
| 909 return EXTENSION; |
| 910 } |
| 911 |
| 912 bool TaskManagerExtensionProcessResource::SupportNetworkUsage() const { |
| 913 return true; |
| 914 } |
| 915 |
| 916 void TaskManagerExtensionProcessResource::SetSupportNetworkUsage() { |
| 917 NOTREACHED(); |
| 918 } |
| 919 |
| 891 const Extension* TaskManagerExtensionProcessResource::GetExtension() const { | 920 const Extension* TaskManagerExtensionProcessResource::GetExtension() const { |
| 892 return extension_host_->extension(); | 921 return extension_host_->extension(); |
| 893 } | 922 } |
| 894 | 923 |
| 895 bool TaskManagerExtensionProcessResource::IsBackground() const { | 924 bool TaskManagerExtensionProcessResource::IsBackground() const { |
| 896 return extension_host_->GetRenderViewType() == | 925 return extension_host_->GetRenderViewType() == |
| 897 ViewType::EXTENSION_BACKGROUND_PAGE; | 926 ViewType::EXTENSION_BACKGROUND_PAGE; |
| 898 } | 927 } |
| 899 | 928 |
| 900 //////////////////////////////////////////////////////////////////////////////// | 929 //////////////////////////////////////////////////////////////////////////////// |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1055 process_handle_ = balloon_host_->render_view_host()->process()->GetHandle(); | 1084 process_handle_ = balloon_host_->render_view_host()->process()->GetHandle(); |
| 1056 pid_ = base::GetProcId(process_handle_); | 1085 pid_ = base::GetProcId(process_handle_); |
| 1057 title_ = UTF16ToWide(l10n_util::GetStringFUTF16( | 1086 title_ = UTF16ToWide(l10n_util::GetStringFUTF16( |
| 1058 IDS_TASK_MANAGER_NOTIFICATION_PREFIX, | 1087 IDS_TASK_MANAGER_NOTIFICATION_PREFIX, |
| 1059 balloon_host_->GetSource())); | 1088 balloon_host_->GetSource())); |
| 1060 } | 1089 } |
| 1061 | 1090 |
| 1062 TaskManagerNotificationResource::~TaskManagerNotificationResource() { | 1091 TaskManagerNotificationResource::~TaskManagerNotificationResource() { |
| 1063 } | 1092 } |
| 1064 | 1093 |
| 1094 std::wstring TaskManagerNotificationResource::GetTitle() const { |
| 1095 return title_; |
| 1096 } |
| 1097 |
| 1065 SkBitmap TaskManagerNotificationResource::GetIcon() const { | 1098 SkBitmap TaskManagerNotificationResource::GetIcon() const { |
| 1066 return *default_icon_; | 1099 return *default_icon_; |
| 1067 } | 1100 } |
| 1068 | 1101 |
| 1069 base::ProcessHandle TaskManagerNotificationResource::GetProcess() const { | 1102 base::ProcessHandle TaskManagerNotificationResource::GetProcess() const { |
| 1070 return process_handle_; | 1103 return process_handle_; |
| 1071 } | 1104 } |
| 1072 | 1105 |
| 1106 TaskManager::Resource::Type TaskManagerNotificationResource::GetType() const { |
| 1107 return NOTIFICATION; |
| 1108 } |
| 1109 |
| 1110 bool TaskManagerNotificationResource::SupportNetworkUsage() const { |
| 1111 return false; |
| 1112 } |
| 1113 |
| 1073 //////////////////////////////////////////////////////////////////////////////// | 1114 //////////////////////////////////////////////////////////////////////////////// |
| 1074 // TaskManagerNotificationResourceProvider class | 1115 // TaskManagerNotificationResourceProvider class |
| 1075 //////////////////////////////////////////////////////////////////////////////// | 1116 //////////////////////////////////////////////////////////////////////////////// |
| 1076 | 1117 |
| 1077 TaskManagerNotificationResourceProvider:: | 1118 TaskManagerNotificationResourceProvider:: |
| 1078 TaskManagerNotificationResourceProvider(TaskManager* task_manager) | 1119 TaskManagerNotificationResourceProvider(TaskManager* task_manager) |
| 1079 : task_manager_(task_manager), | 1120 : task_manager_(task_manager), |
| 1080 updating_(false) { | 1121 updating_(false) { |
| 1081 } | 1122 } |
| 1082 | 1123 |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1232 } | 1273 } |
| 1233 | 1274 |
| 1234 size_t TaskManagerBrowserProcessResource::SqliteMemoryUsedBytes() const { | 1275 size_t TaskManagerBrowserProcessResource::SqliteMemoryUsedBytes() const { |
| 1235 return static_cast<size_t>(sqlite3_memory_used()); | 1276 return static_cast<size_t>(sqlite3_memory_used()); |
| 1236 } | 1277 } |
| 1237 | 1278 |
| 1238 base::ProcessHandle TaskManagerBrowserProcessResource::GetProcess() const { | 1279 base::ProcessHandle TaskManagerBrowserProcessResource::GetProcess() const { |
| 1239 return base::GetCurrentProcessHandle(); // process_; | 1280 return base::GetCurrentProcessHandle(); // process_; |
| 1240 } | 1281 } |
| 1241 | 1282 |
| 1283 TaskManager::Resource::Type TaskManagerBrowserProcessResource::GetType() const { |
| 1284 return BROWSER; |
| 1285 } |
| 1286 |
| 1287 bool TaskManagerBrowserProcessResource::SupportNetworkUsage() const { |
| 1288 return true; |
| 1289 } |
| 1290 |
| 1291 void TaskManagerBrowserProcessResource::SetSupportNetworkUsage() { |
| 1292 NOTREACHED(); |
| 1293 } |
| 1294 |
| 1295 bool TaskManagerBrowserProcessResource::ReportsSqliteMemoryUsed() const { |
| 1296 return true; |
| 1297 } |
| 1298 |
| 1242 //////////////////////////////////////////////////////////////////////////////// | 1299 //////////////////////////////////////////////////////////////////////////////// |
| 1243 // TaskManagerBrowserProcessResourceProvider class | 1300 // TaskManagerBrowserProcessResourceProvider class |
| 1244 //////////////////////////////////////////////////////////////////////////////// | 1301 //////////////////////////////////////////////////////////////////////////////// |
| 1245 | 1302 |
| 1246 TaskManagerBrowserProcessResourceProvider:: | 1303 TaskManagerBrowserProcessResourceProvider:: |
| 1247 TaskManagerBrowserProcessResourceProvider(TaskManager* task_manager) | 1304 TaskManagerBrowserProcessResourceProvider(TaskManager* task_manager) |
| 1248 : updating_(false), | 1305 : updating_(false), |
| 1249 task_manager_(task_manager) { | 1306 task_manager_(task_manager) { |
| 1250 } | 1307 } |
| 1251 | 1308 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1263 | 1320 |
| 1264 return &resource_; | 1321 return &resource_; |
| 1265 } | 1322 } |
| 1266 | 1323 |
| 1267 void TaskManagerBrowserProcessResourceProvider::StartUpdating() { | 1324 void TaskManagerBrowserProcessResourceProvider::StartUpdating() { |
| 1268 task_manager_->AddResource(&resource_); | 1325 task_manager_->AddResource(&resource_); |
| 1269 } | 1326 } |
| 1270 | 1327 |
| 1271 void TaskManagerBrowserProcessResourceProvider::StopUpdating() { | 1328 void TaskManagerBrowserProcessResourceProvider::StopUpdating() { |
| 1272 } | 1329 } |
| OLD | NEW |