Chromium Code Reviews| 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_PHYSICAL_MEMORY = 1 << 1, | 28 REFRESH_TYPE_START_TIME = 1 << 1, |
|
brucedawson
2016/12/19 21:51:06
Why did you insert these at the beginning? Wouldn'
chengx
2016/12/20 00:51:12
Done.
| |
| 29 REFRESH_TYPE_MEMORY_DETAILS = 1 << 2, | 29 REFRESH_TYPE_CPU_TIME = 1 << 2, |
| 30 REFRESH_TYPE_GPU_MEMORY = 1 << 3, | 30 REFRESH_TYPE_PHYSICAL_MEMORY = 1 << 3, |
| 31 REFRESH_TYPE_V8_MEMORY = 1 << 4, | 31 REFRESH_TYPE_MEMORY_DETAILS = 1 << 4, |
| 32 REFRESH_TYPE_SQLITE_MEMORY = 1 << 5, | 32 REFRESH_TYPE_GPU_MEMORY = 1 << 5, |
| 33 REFRESH_TYPE_WEBCACHE_STATS = 1 << 6, | 33 REFRESH_TYPE_V8_MEMORY = 1 << 6, |
| 34 REFRESH_TYPE_NETWORK_USAGE = 1 << 7, | 34 REFRESH_TYPE_SQLITE_MEMORY = 1 << 7, |
| 35 REFRESH_TYPE_NACL = 1 << 8, | 35 REFRESH_TYPE_WEBCACHE_STATS = 1 << 8, |
| 36 REFRESH_TYPE_IDLE_WAKEUPS = 1 << 9, | 36 REFRESH_TYPE_NETWORK_USAGE = 1 << 9, |
| 37 REFRESH_TYPE_HANDLES = 1 << 10, | 37 REFRESH_TYPE_NACL = 1 << 10, |
| 38 REFRESH_TYPE_IDLE_WAKEUPS = 1 << 11, | |
| 39 REFRESH_TYPE_HANDLES = 1 << 12, | |
| 38 | 40 |
| 39 // Whether an observer is interested in knowing if a process is foregrounded | 41 // Whether an observer is interested in knowing if a process is foregrounded |
| 40 // or backgrounded. | 42 // or backgrounded. |
| 41 REFRESH_TYPE_PRIORITY = 1 << 11, | 43 REFRESH_TYPE_PRIORITY = 1 << 13, |
| 42 | 44 |
| 43 #if defined(OS_LINUX) | 45 #if defined(OS_LINUX) |
| 44 // For observers interested in getting the number of open file descriptors of | 46 // For observers interested in getting the number of open file descriptors of |
| 45 // processes. | 47 // processes. |
| 46 REFRESH_TYPE_FD_COUNT = 1 << 12, | 48 REFRESH_TYPE_FD_COUNT = 1 << 14, |
| 47 #endif // defined(OS_LINUX) | 49 #endif // defined(OS_LINUX) |
| 48 | 50 |
| 49 REFRESH_TYPE_MEMORY = REFRESH_TYPE_PHYSICAL_MEMORY | | 51 REFRESH_TYPE_MEMORY = REFRESH_TYPE_PHYSICAL_MEMORY | |
| 50 REFRESH_TYPE_MEMORY_DETAILS, | 52 REFRESH_TYPE_MEMORY_DETAILS, |
| 51 }; | 53 }; |
| 52 | 54 |
| 53 // Defines the interface for observers of the task manager. | 55 // Defines the interface for observers of the task manager. |
| 54 class TaskManagerObserver { | 56 class TaskManagerObserver { |
| 55 public: | 57 public: |
| 56 static bool IsResourceRefreshEnabled(RefreshType refresh_type, | 58 static bool IsResourceRefreshEnabled(RefreshType refresh_type, |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 139 // calculated on each refresh. | 141 // calculated on each refresh. |
| 140 int64_t desired_resources_flags_; | 142 int64_t desired_resources_flags_; |
| 141 | 143 |
| 142 DISALLOW_COPY_AND_ASSIGN(TaskManagerObserver); | 144 DISALLOW_COPY_AND_ASSIGN(TaskManagerObserver); |
| 143 }; | 145 }; |
| 144 | 146 |
| 145 } // namespace task_manager | 147 } // namespace task_manager |
| 146 | 148 |
| 147 | 149 |
| 148 #endif // CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_OBSERVER_H_ | 150 #endif // CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_OBSERVER_H_ |
| OLD | NEW |