| 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_TASK_MANAGER_OBSERVER_H_ | 5 #ifndef CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_OBSERVER_H_ |
| 6 #define CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_OBSERVER_H_ | 6 #define CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_OBSERVER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/time/time.h" | 13 #include "base/time/time.h" |
| 14 #include "build/build_config.h" | 14 #include "build/build_config.h" |
| 15 | 15 |
| 16 namespace task_manager { | 16 namespace task_manager { |
| 17 | 17 |
| 18 class TaskManagerInterface; | 18 class TaskManagerInterface; |
| 19 | 19 |
| 20 using TaskId = int64_t; | 20 using TaskId = int64_t; |
| 21 using TaskIdList = std::vector<TaskId>; | 21 using TaskIdList = std::vector<TaskId>; |
| 22 | 22 |
| 23 // Defines a list of types of resources that an observer needs to be refreshed | 23 // Defines a list of types of resources that an observer needs to be refreshed |
| 24 // on every task manager refresh cycle. | 24 // on every task manager refresh cycle. |
| 25 enum RefreshType { | 25 enum RefreshType { |
| 26 REFRESH_TYPE_NONE = 0, | 26 REFRESH_TYPE_NONE = 0, |
| 27 REFRESH_TYPE_CPU = 1, | 27 REFRESH_TYPE_CPU = 1, |
| 28 REFRESH_TYPE_MEMORY = 1 << 1, | 28 REFRESH_TYPE_PHYSICAL_MEMORY = 1 << 1, |
| 29 REFRESH_TYPE_GPU_MEMORY = 1 << 2, | 29 REFRESH_TYPE_MEMORY_DETAILS = 1 << 2, |
| 30 REFRESH_TYPE_V8_MEMORY = 1 << 3, | 30 REFRESH_TYPE_GPU_MEMORY = 1 << 3, |
| 31 REFRESH_TYPE_SQLITE_MEMORY = 1 << 4, | 31 REFRESH_TYPE_V8_MEMORY = 1 << 4, |
| 32 REFRESH_TYPE_WEBCACHE_STATS = 1 << 5, | 32 REFRESH_TYPE_SQLITE_MEMORY = 1 << 5, |
| 33 REFRESH_TYPE_NETWORK_USAGE = 1 << 6, | 33 REFRESH_TYPE_WEBCACHE_STATS = 1 << 6, |
| 34 REFRESH_TYPE_NACL = 1 << 7, | 34 REFRESH_TYPE_NETWORK_USAGE = 1 << 7, |
| 35 REFRESH_TYPE_IDLE_WAKEUPS = 1 << 8, | 35 REFRESH_TYPE_NACL = 1 << 8, |
| 36 REFRESH_TYPE_HANDLES = 1 << 9, | 36 REFRESH_TYPE_IDLE_WAKEUPS = 1 << 9, |
| 37 REFRESH_TYPE_HANDLES = 1 << 10, |
| 37 | 38 |
| 38 // Whether an observer is interested in knowing if a process is foregrounded | 39 // Whether an observer is interested in knowing if a process is foregrounded |
| 39 // or backgrounded. | 40 // or backgrounded. |
| 40 REFRESH_TYPE_PRIORITY = 1 << 10, | 41 REFRESH_TYPE_PRIORITY = 1 << 11, |
| 41 | 42 |
| 42 #if defined(OS_LINUX) | 43 #if defined(OS_LINUX) |
| 43 // For observers interested in getting the number of open file descriptors of | 44 // For observers interested in getting the number of open file descriptors of |
| 44 // processes. | 45 // processes. |
| 45 REFRESH_TYPE_FD_COUNT = 1 << 11, | 46 REFRESH_TYPE_FD_COUNT = 1 << 12, |
| 46 #endif // defined(OS_LINUX) | 47 #endif // defined(OS_LINUX) |
| 48 |
| 49 REFRESH_TYPE_MEMORY = REFRESH_TYPE_PHYSICAL_MEMORY | |
| 50 REFRESH_TYPE_MEMORY_DETAILS, |
| 47 }; | 51 }; |
| 48 | 52 |
| 49 // Defines the interface for observers of the task manager. | 53 // Defines the interface for observers of the task manager. |
| 50 class TaskManagerObserver { | 54 class TaskManagerObserver { |
| 51 public: | 55 public: |
| 52 static bool IsResourceRefreshEnabled(RefreshType refresh_type, | 56 static bool IsResourceRefreshEnabled(RefreshType refresh_type, |
| 53 int refresh_flags); | 57 int refresh_flags); |
| 54 | 58 |
| 55 // Constructs a TaskManagerObserver given the minimum |refresh_time| that it | 59 // Constructs a TaskManagerObserver given the minimum |refresh_time| that it |
| 56 // it requires the task manager to be refreshing the values at, along with the | 60 // it requires the task manager to be refreshing the values at, along with the |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 // calculated on each refresh. | 139 // calculated on each refresh. |
| 136 int64_t desired_resources_flags_; | 140 int64_t desired_resources_flags_; |
| 137 | 141 |
| 138 DISALLOW_COPY_AND_ASSIGN(TaskManagerObserver); | 142 DISALLOW_COPY_AND_ASSIGN(TaskManagerObserver); |
| 139 }; | 143 }; |
| 140 | 144 |
| 141 } // namespace task_manager | 145 } // namespace task_manager |
| 142 | 146 |
| 143 | 147 |
| 144 #endif // CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_OBSERVER_H_ | 148 #endif // CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_OBSERVER_H_ |
| OLD | NEW |