| 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 #ifndef CHROME_BROWSER_TASK_MANAGEMENT_SAMPLING_TASK_MANAGER_IMPL_H_ | 5 #ifndef CHROME_BROWSER_TASK_MANAGEMENT_SAMPLING_TASK_MANAGER_IMPL_H_ |
| 6 #define CHROME_BROWSER_TASK_MANAGEMENT_SAMPLING_TASK_MANAGER_IMPL_H_ | 6 #define CHROME_BROWSER_TASK_MANAGEMENT_SAMPLING_TASK_MANAGER_IMPL_H_ |
| 7 | 7 |
| 8 #include <stddef.h> |
| 9 #include <stdint.h> |
| 10 |
| 8 #include <map> | 11 #include <map> |
| 9 | 12 |
| 10 #include "base/lazy_instance.h" | 13 #include "base/lazy_instance.h" |
| 14 #include "base/macros.h" |
| 11 #include "base/memory/scoped_vector.h" | 15 #include "base/memory/scoped_vector.h" |
| 12 #include "base/sequenced_task_runner.h" | 16 #include "base/sequenced_task_runner.h" |
| 13 #include "chrome/browser/task_management/providers/task_provider.h" | 17 #include "chrome/browser/task_management/providers/task_provider.h" |
| 14 #include "chrome/browser/task_management/providers/task_provider_observer.h" | 18 #include "chrome/browser/task_management/providers/task_provider_observer.h" |
| 15 #include "chrome/browser/task_management/sampling/task_group.h" | 19 #include "chrome/browser/task_management/sampling/task_group.h" |
| 16 #include "chrome/browser/task_management/sampling/task_manager_io_thread_helper.
h" | 20 #include "chrome/browser/task_management/sampling/task_manager_io_thread_helper.
h" |
| 17 #include "chrome/browser/task_management/task_manager_interface.h" | 21 #include "chrome/browser/task_management/task_manager_interface.h" |
| 18 #include "content/public/browser/gpu_data_manager_observer.h" | 22 #include "content/public/browser/gpu_data_manager_observer.h" |
| 19 | 23 |
| 20 namespace task_management { | 24 namespace task_management { |
| 21 | 25 |
| 22 // Defines a concrete implementation of the TaskManagerInterface. | 26 // Defines a concrete implementation of the TaskManagerInterface. |
| 23 class TaskManagerImpl : | 27 class TaskManagerImpl : |
| 24 public TaskManagerInterface, | 28 public TaskManagerInterface, |
| 25 public TaskProviderObserver, | 29 public TaskProviderObserver, |
| 26 content::GpuDataManagerObserver { | 30 content::GpuDataManagerObserver { |
| 27 public: | 31 public: |
| 28 ~TaskManagerImpl() override; | 32 ~TaskManagerImpl() override; |
| 29 | 33 |
| 30 static TaskManagerImpl* GetInstance(); | 34 static TaskManagerImpl* GetInstance(); |
| 31 | 35 |
| 32 // task_management::TaskManagerInterface: | 36 // task_management::TaskManagerInterface: |
| 33 void ActivateTask(TaskId task_id) override; | 37 void ActivateTask(TaskId task_id) override; |
| 34 double GetCpuUsage(TaskId task_id) const override; | 38 double GetCpuUsage(TaskId task_id) const override; |
| 35 int64 GetPhysicalMemoryUsage(TaskId task_id) const override; | 39 int64_t GetPhysicalMemoryUsage(TaskId task_id) const override; |
| 36 int64 GetPrivateMemoryUsage(TaskId task_id) const override; | 40 int64_t GetPrivateMemoryUsage(TaskId task_id) const override; |
| 37 int64 GetSharedMemoryUsage(TaskId task_id) const override; | 41 int64_t GetSharedMemoryUsage(TaskId task_id) const override; |
| 38 int64 GetGpuMemoryUsage(TaskId task_id, bool* has_duplicates) const override; | 42 int64_t GetGpuMemoryUsage(TaskId task_id, |
| 43 bool* has_duplicates) const override; |
| 39 int GetIdleWakeupsPerSecond(TaskId task_id) const override; | 44 int GetIdleWakeupsPerSecond(TaskId task_id) const override; |
| 40 int GetNaClDebugStubPort(TaskId task_id) const override; | 45 int GetNaClDebugStubPort(TaskId task_id) const override; |
| 41 void GetGDIHandles(TaskId task_id, | 46 void GetGDIHandles(TaskId task_id, |
| 42 int64* current, | 47 int64_t* current, |
| 43 int64* peak) const override; | 48 int64_t* peak) const override; |
| 44 void GetUSERHandles(TaskId task_id, | 49 void GetUSERHandles(TaskId task_id, |
| 45 int64* current, | 50 int64_t* current, |
| 46 int64* peak) const override; | 51 int64_t* peak) const override; |
| 47 int GetOpenFdCount(TaskId task_id) const override; | 52 int GetOpenFdCount(TaskId task_id) const override; |
| 48 bool IsTaskOnBackgroundedProcess(TaskId task_id) const override; | 53 bool IsTaskOnBackgroundedProcess(TaskId task_id) const override; |
| 49 const base::string16& GetTitle(TaskId task_id) const override; | 54 const base::string16& GetTitle(TaskId task_id) const override; |
| 50 const std::string& GetTaskNameForRappor(TaskId task_id) const override; | 55 const std::string& GetTaskNameForRappor(TaskId task_id) const override; |
| 51 base::string16 GetProfileName(TaskId task_id) const override; | 56 base::string16 GetProfileName(TaskId task_id) const override; |
| 52 const gfx::ImageSkia& GetIcon(TaskId task_id) const override; | 57 const gfx::ImageSkia& GetIcon(TaskId task_id) const override; |
| 53 const base::ProcessHandle& GetProcessHandle(TaskId task_id) const override; | 58 const base::ProcessHandle& GetProcessHandle(TaskId task_id) const override; |
| 54 const base::ProcessId& GetProcessId(TaskId task_id) const override; | 59 const base::ProcessId& GetProcessId(TaskId task_id) const override; |
| 55 Task::Type GetType(TaskId task_id) const override; | 60 Task::Type GetType(TaskId task_id) const override; |
| 56 int64 GetNetworkUsage(TaskId task_id) const override; | 61 int64_t GetNetworkUsage(TaskId task_id) const override; |
| 57 int64 GetProcessTotalNetworkUsage(TaskId task_id) const override; | 62 int64_t GetProcessTotalNetworkUsage(TaskId task_id) const override; |
| 58 int64 GetSqliteMemoryUsed(TaskId task_id) const override; | 63 int64_t GetSqliteMemoryUsed(TaskId task_id) const override; |
| 59 bool GetV8Memory(TaskId task_id, | 64 bool GetV8Memory(TaskId task_id, |
| 60 int64* allocated, | 65 int64_t* allocated, |
| 61 int64* used) const override; | 66 int64_t* used) const override; |
| 62 bool GetWebCacheStats( | 67 bool GetWebCacheStats( |
| 63 TaskId task_id, | 68 TaskId task_id, |
| 64 blink::WebCache::ResourceTypeStats* stats) const override; | 69 blink::WebCache::ResourceTypeStats* stats) const override; |
| 65 const TaskIdList& GetTaskIdsList() const override; | 70 const TaskIdList& GetTaskIdsList() const override; |
| 66 size_t GetNumberOfTasksOnSameProcess(TaskId task_id) const override; | 71 size_t GetNumberOfTasksOnSameProcess(TaskId task_id) const override; |
| 67 | 72 |
| 68 // task_management::TaskProviderObserver: | 73 // task_management::TaskProviderObserver: |
| 69 void TaskAdded(Task* task) override; | 74 void TaskAdded(Task* task) override; |
| 70 void TaskRemoved(Task* task) override; | 75 void TaskRemoved(Task* task) override; |
| 71 | 76 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 // This will be set to true while there are observers and the task manager is | 134 // This will be set to true while there are observers and the task manager is |
| 130 // running. | 135 // running. |
| 131 bool is_running_; | 136 bool is_running_; |
| 132 | 137 |
| 133 DISALLOW_COPY_AND_ASSIGN(TaskManagerImpl); | 138 DISALLOW_COPY_AND_ASSIGN(TaskManagerImpl); |
| 134 }; | 139 }; |
| 135 | 140 |
| 136 } // namespace task_management | 141 } // namespace task_management |
| 137 | 142 |
| 138 #endif // CHROME_BROWSER_TASK_MANAGEMENT_SAMPLING_TASK_MANAGER_IMPL_H_ | 143 #endif // CHROME_BROWSER_TASK_MANAGEMENT_SAMPLING_TASK_MANAGER_IMPL_H_ |
| OLD | NEW |