| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_management/sampling/task_manager_impl.h" | 5 #include "chrome/browser/task_management/sampling/task_manager_impl.h" |
| 6 | 6 |
| 7 #include "base/stl_util.h" | 7 #include "base/stl_util.h" |
| 8 #include "chrome/browser/task_management/providers/browser_process_task_provider
.h" | 8 #include "chrome/browser/task_management/providers/browser_process_task_provider
.h" |
| 9 #include "chrome/browser/task_management/providers/child_process_task_provider.h
" | 9 #include "chrome/browser/task_management/providers/child_process_task_provider.h
" |
| 10 #include "chrome/browser/task_management/providers/web_contents/web_contents_tas
k_provider.h" | 10 #include "chrome/browser/task_management/providers/web_contents/web_contents_tas
k_provider.h" |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 } | 85 } |
| 86 | 86 |
| 87 int TaskManagerImpl::GetIdleWakeupsPerSecond(TaskId task_id) const { | 87 int TaskManagerImpl::GetIdleWakeupsPerSecond(TaskId task_id) const { |
| 88 return GetTaskGroupByTaskId(task_id)->idle_wakeups_per_second(); | 88 return GetTaskGroupByTaskId(task_id)->idle_wakeups_per_second(); |
| 89 } | 89 } |
| 90 | 90 |
| 91 int TaskManagerImpl::GetNaClDebugStubPort(TaskId task_id) const { | 91 int TaskManagerImpl::GetNaClDebugStubPort(TaskId task_id) const { |
| 92 #if !defined(DISABLE_NACL) | 92 #if !defined(DISABLE_NACL) |
| 93 return GetTaskGroupByTaskId(task_id)->nacl_debug_stub_port(); | 93 return GetTaskGroupByTaskId(task_id)->nacl_debug_stub_port(); |
| 94 #else | 94 #else |
| 95 return -1; | 95 return -2; |
| 96 #endif // !defined(DISABLE_NACL) | 96 #endif // !defined(DISABLE_NACL) |
| 97 } | 97 } |
| 98 | 98 |
| 99 void TaskManagerImpl::GetGDIHandles(TaskId task_id, | 99 void TaskManagerImpl::GetGDIHandles(TaskId task_id, |
| 100 int64* current, | 100 int64* current, |
| 101 int64* peak) const { | 101 int64* peak) const { |
| 102 #if defined(OS_WIN) | 102 #if defined(OS_WIN) |
| 103 const TaskGroup* task_group = GetTaskGroupByTaskId(task_id); | 103 const TaskGroup* task_group = GetTaskGroupByTaskId(task_id); |
| 104 *current = task_group->gdi_current_handles(); | 104 *current = task_group->gdi_current_handles(); |
| 105 *peak = task_group->gdi_peak_handles(); | 105 *peak = task_group->gdi_peak_handles(); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 } | 144 } |
| 145 | 145 |
| 146 Task::Type TaskManagerImpl::GetType(TaskId task_id) const { | 146 Task::Type TaskManagerImpl::GetType(TaskId task_id) const { |
| 147 return GetTaskByTaskId(task_id)->GetType(); | 147 return GetTaskByTaskId(task_id)->GetType(); |
| 148 } | 148 } |
| 149 | 149 |
| 150 int64 TaskManagerImpl::GetNetworkUsage(TaskId task_id) const { | 150 int64 TaskManagerImpl::GetNetworkUsage(TaskId task_id) const { |
| 151 return GetTaskByTaskId(task_id)->network_usage(); | 151 return GetTaskByTaskId(task_id)->network_usage(); |
| 152 } | 152 } |
| 153 | 153 |
| 154 int64 TaskManagerImpl::GetProcessTotalNetworkUsage(TaskId task_id) const { |
| 155 return GetTaskGroupByTaskId(task_id)->per_process_network_usage(); |
| 156 } |
| 157 |
| 154 int64 TaskManagerImpl::GetSqliteMemoryUsed(TaskId task_id) const { | 158 int64 TaskManagerImpl::GetSqliteMemoryUsed(TaskId task_id) const { |
| 155 return GetTaskByTaskId(task_id)->GetSqliteMemoryUsed(); | 159 return GetTaskByTaskId(task_id)->GetSqliteMemoryUsed(); |
| 156 } | 160 } |
| 157 | 161 |
| 158 bool TaskManagerImpl::GetV8Memory(TaskId task_id, | 162 bool TaskManagerImpl::GetV8Memory(TaskId task_id, |
| 159 int64* allocated, | 163 int64* allocated, |
| 160 int64* used) const { | 164 int64* used) const { |
| 161 const Task* task = GetTaskByTaskId(task_id); | 165 const Task* task = GetTaskByTaskId(task_id); |
| 162 if (!task->ReportsV8Memory()) | 166 if (!task->ReportsV8Memory()) |
| 163 return false; | 167 return false; |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 DCHECK(ContainsKey(task_groups_by_task_id_, task_id)); | 351 DCHECK(ContainsKey(task_groups_by_task_id_, task_id)); |
| 348 | 352 |
| 349 return task_groups_by_task_id_.at(task_id); | 353 return task_groups_by_task_id_.at(task_id); |
| 350 } | 354 } |
| 351 | 355 |
| 352 Task* TaskManagerImpl::GetTaskByTaskId(TaskId task_id) const { | 356 Task* TaskManagerImpl::GetTaskByTaskId(TaskId task_id) const { |
| 353 return GetTaskGroupByTaskId(task_id)->GetTaskById(task_id); | 357 return GetTaskGroupByTaskId(task_id)->GetTaskById(task_id); |
| 354 } | 358 } |
| 355 | 359 |
| 356 } // namespace task_management | 360 } // namespace task_management |
| OLD | NEW |