| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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 BASE_PROCESS_PROCESS_H_ | 5 #ifndef BASE_PROCESS_PROCESS_H_ |
| 6 #define BASE_PROCESS_PROCESS_H_ | 6 #define BASE_PROCESS_PROCESS_H_ |
| 7 | 7 |
| 8 #include "base/base_export.h" | 8 #include "base/base_export.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/process/process_handle.h" | 10 #include "base/process/process_handle.h" |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 bool IsProcessBackgrounded(PortProvider* port_provider) const; | 132 bool IsProcessBackgrounded(PortProvider* port_provider) const; |
| 133 | 133 |
| 134 // Set the process as backgrounded. If value is | 134 // Set the process as backgrounded. If value is |
| 135 // true, the priority of the associated task will be set to | 135 // true, the priority of the associated task will be set to |
| 136 // TASK_BACKGROUND_APPLICATION. If value is false, the | 136 // TASK_BACKGROUND_APPLICATION. If value is false, the |
| 137 // priority of the process will be set to TASK_FOREGROUND_APPLICATION. | 137 // priority of the process will be set to TASK_FOREGROUND_APPLICATION. |
| 138 // | 138 // |
| 139 // Returns true if the priority was changed, false otherwise. If | 139 // Returns true if the priority was changed, false otherwise. If |
| 140 // |port_provider| is null, this is a no-op and it returns false. | 140 // |port_provider| is null, this is a no-op and it returns false. |
| 141 bool SetProcessBackgrounded(PortProvider* port_provider, bool value); | 141 bool SetProcessBackgrounded(PortProvider* port_provider, bool value); |
| 142 |
| 143 // Returns |true| if helper processes should participate in AppNap. |
| 144 static bool IsAppNapEnabled(); |
| 142 #else | 145 #else |
| 143 // A process is backgrounded when it's priority is lower than normal. | 146 // A process is backgrounded when it's priority is lower than normal. |
| 144 // Return true if this process is backgrounded, false otherwise. | 147 // Return true if this process is backgrounded, false otherwise. |
| 145 bool IsProcessBackgrounded() const; | 148 bool IsProcessBackgrounded() const; |
| 146 | 149 |
| 147 // Set a process as backgrounded. If value is true, the priority of the | 150 // Set a process as backgrounded. If value is true, the priority of the |
| 148 // process will be lowered. If value is false, the priority of the process | 151 // process will be lowered. If value is false, the priority of the process |
| 149 // will be made "normal" - equivalent to default process priority. | 152 // will be made "normal" - equivalent to default process priority. |
| 150 // Returns true if the priority was changed, false otherwise. | 153 // Returns true if the priority was changed, false otherwise. |
| 151 bool SetProcessBackgrounded(bool value); | 154 bool SetProcessBackgrounded(bool value); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 179 // Exposed for testing. | 182 // Exposed for testing. |
| 180 // Given the contents of the /proc/<pid>/cgroup file, determine whether the | 183 // Given the contents of the /proc/<pid>/cgroup file, determine whether the |
| 181 // process is backgrounded or not. | 184 // process is backgrounded or not. |
| 182 BASE_EXPORT bool IsProcessBackgroundedCGroup( | 185 BASE_EXPORT bool IsProcessBackgroundedCGroup( |
| 183 const StringPiece& cgroup_contents); | 186 const StringPiece& cgroup_contents); |
| 184 #endif // defined(OS_CHROMEOS) | 187 #endif // defined(OS_CHROMEOS) |
| 185 | 188 |
| 186 } // namespace base | 189 } // namespace base |
| 187 | 190 |
| 188 #endif // BASE_PROCESS_PROCESS_H_ | 191 #endif // BASE_PROCESS_PROCESS_H_ |
| OLD | NEW |