| 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_MANAGER_SAMPLING_TASK_MANAGER_IMPL_H_ | 5 #ifndef CHROME_BROWSER_TASK_MANAGER_SAMPLING_TASK_MANAGER_IMPL_H_ |
| 6 #define CHROME_BROWSER_TASK_MANAGER_SAMPLING_TASK_MANAGER_IMPL_H_ | 6 #define CHROME_BROWSER_TASK_MANAGER_SAMPLING_TASK_MANAGER_IMPL_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| 11 #include <map> | 11 #include <map> |
| 12 #include <memory> | 12 #include <memory> |
| 13 #include <string> | 13 #include <string> |
| 14 #include <vector> | 14 #include <vector> |
| 15 | 15 |
| 16 #include "base/lazy_instance.h" | 16 #include "base/lazy_instance.h" |
| 17 #include "base/macros.h" | 17 #include "base/macros.h" |
| 18 #include "base/memory/scoped_vector.h" | 18 #include "base/memory/scoped_vector.h" |
| 19 #include "base/sequenced_task_runner.h" | 19 #include "base/sequenced_task_runner.h" |
| 20 #include "base/time/time.h" |
| 20 #include "chrome/browser/task_manager/providers/task_provider.h" | 21 #include "chrome/browser/task_manager/providers/task_provider.h" |
| 21 #include "chrome/browser/task_manager/providers/task_provider_observer.h" | 22 #include "chrome/browser/task_manager/providers/task_provider_observer.h" |
| 22 #include "chrome/browser/task_manager/sampling/task_group.h" | 23 #include "chrome/browser/task_manager/sampling/task_group.h" |
| 23 #include "chrome/browser/task_manager/sampling/task_manager_io_thread_helper.h" | 24 #include "chrome/browser/task_manager/sampling/task_manager_io_thread_helper.h" |
| 24 #include "chrome/browser/task_manager/task_manager_interface.h" | 25 #include "chrome/browser/task_manager/task_manager_interface.h" |
| 25 #include "content/public/browser/gpu_data_manager_observer.h" | 26 #include "content/public/browser/gpu_data_manager_observer.h" |
| 26 #include "gpu/ipc/common/memory_stats.h" | 27 #include "gpu/ipc/common/memory_stats.h" |
| 27 | 28 |
| 28 namespace task_manager { | 29 namespace task_manager { |
| 29 | 30 |
| 30 class SharedSampler; | 31 class SharedSampler; |
| 31 | 32 |
| 32 // Defines a concrete implementation of the TaskManagerInterface. | 33 // Defines a concrete implementation of the TaskManagerInterface. |
| 33 class TaskManagerImpl : | 34 class TaskManagerImpl : |
| 34 public TaskManagerInterface, | 35 public TaskManagerInterface, |
| 35 public TaskProviderObserver, | 36 public TaskProviderObserver, |
| 36 content::GpuDataManagerObserver { | 37 content::GpuDataManagerObserver { |
| 37 public: | 38 public: |
| 38 ~TaskManagerImpl() override; | 39 ~TaskManagerImpl() override; |
| 39 | 40 |
| 40 static TaskManagerImpl* GetInstance(); | 41 static TaskManagerImpl* GetInstance(); |
| 41 | 42 |
| 42 // task_manager::TaskManagerInterface: | 43 // task_manager::TaskManagerInterface: |
| 43 void ActivateTask(TaskId task_id) override; | 44 void ActivateTask(TaskId task_id) override; |
| 44 bool IsTaskKillable(TaskId task_id) override; | 45 bool IsTaskKillable(TaskId task_id) override; |
| 45 void KillTask(TaskId task_id) override; | 46 void KillTask(TaskId task_id) override; |
| 46 double GetCpuUsage(TaskId task_id) const override; | 47 double GetCpuUsage(TaskId task_id) const override; |
| 48 base::Time GetStartTime(TaskId task_id) const override; |
| 49 base::TimeDelta GetCpuTime(TaskId task_id) const override; |
| 47 int64_t GetPhysicalMemoryUsage(TaskId task_id) const override; | 50 int64_t GetPhysicalMemoryUsage(TaskId task_id) const override; |
| 48 int64_t GetPrivateMemoryUsage(TaskId task_id) const override; | 51 int64_t GetPrivateMemoryUsage(TaskId task_id) const override; |
| 49 int64_t GetSharedMemoryUsage(TaskId task_id) const override; | 52 int64_t GetSharedMemoryUsage(TaskId task_id) const override; |
| 50 int64_t GetSwappedMemoryUsage(TaskId task_id) const override; | 53 int64_t GetSwappedMemoryUsage(TaskId task_id) const override; |
| 51 int64_t GetGpuMemoryUsage(TaskId task_id, | 54 int64_t GetGpuMemoryUsage(TaskId task_id, |
| 52 bool* has_duplicates) const override; | 55 bool* has_duplicates) const override; |
| 53 base::MemoryState GetMemoryState(TaskId task_id) const override; | 56 base::MemoryState GetMemoryState(TaskId task_id) const override; |
| 54 int GetIdleWakeupsPerSecond(TaskId task_id) const override; | 57 int GetIdleWakeupsPerSecond(TaskId task_id) const override; |
| 55 int GetNaClDebugStubPort(TaskId task_id) const override; | 58 int GetNaClDebugStubPort(TaskId task_id) const override; |
| 56 void GetGDIHandles(TaskId task_id, | 59 void GetGDIHandles(TaskId task_id, |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 // This will be set to true while there are observers and the task manager is | 168 // This will be set to true while there are observers and the task manager is |
| 166 // running. | 169 // running. |
| 167 bool is_running_; | 170 bool is_running_; |
| 168 | 171 |
| 169 DISALLOW_COPY_AND_ASSIGN(TaskManagerImpl); | 172 DISALLOW_COPY_AND_ASSIGN(TaskManagerImpl); |
| 170 }; | 173 }; |
| 171 | 174 |
| 172 } // namespace task_manager | 175 } // namespace task_manager |
| 173 | 176 |
| 174 #endif // CHROME_BROWSER_TASK_MANAGER_SAMPLING_TASK_MANAGER_IMPL_H_ | 177 #endif // CHROME_BROWSER_TASK_MANAGER_SAMPLING_TASK_MANAGER_IMPL_H_ |
| OLD | NEW |