| 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_TASK_MANAGER_INTERFACE_H_ | 5 #ifndef CHROME_BROWSER_TASK_MANAGEMENT_TASK_MANAGER_INTERFACE_H_ |
| 6 #define CHROME_BROWSER_TASK_MANAGEMENT_TASK_MANAGER_INTERFACE_H_ | 6 #define CHROME_BROWSER_TASK_MANAGEMENT_TASK_MANAGER_INTERFACE_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| 11 #include <memory> | 11 #include <memory> |
| 12 #include <utility> | 12 #include <utility> |
| 13 | 13 |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "base/observer_list.h" | 15 #include "base/observer_list.h" |
| 16 #include "base/process/kill.h" | 16 #include "base/process/kill.h" |
| 17 #include "base/process/process_handle.h" | 17 #include "base/process/process_handle.h" |
| 18 #include "base/time/time.h" | 18 #include "base/time/time.h" |
| 19 #include "base/timer/timer.h" | 19 #include "base/timer/timer.h" |
| 20 #include "chrome/browser/task_management/providers/task.h" | 20 #include "chrome/browser/task_management/providers/task.h" |
| 21 #include "chrome/browser/task_management/task_manager_observer.h" | 21 #include "chrome/browser/task_management/task_manager_observer.h" |
| 22 #include "third_party/WebKit/public/web/WebCache.h" | 22 #include "third_party/WebKit/public/web/WebCache.h" |
| 23 #include "ui/gfx/image/image_skia.h" | 23 #include "ui/gfx/image/image_skia.h" |
| 24 | 24 |
| 25 class PrefRegistrySimple; |
| 26 |
| 25 namespace net { | 27 namespace net { |
| 26 class URLRequest; | 28 class URLRequest; |
| 27 } // namespace net | 29 } // namespace net |
| 28 | 30 |
| 29 namespace task_management { | 31 namespace task_management { |
| 30 | 32 |
| 31 // Defines the interface for any implementation of the task manager. | 33 // Defines the interface for any implementation of the task manager. |
| 32 // Concrete implementations have no control over the refresh rate nor the | 34 // Concrete implementations have no control over the refresh rate nor the |
| 33 // enabled calculations of the usage of the various resources. | 35 // enabled calculations of the usage of the various resources. |
| 34 class TaskManagerInterface { | 36 class TaskManagerInterface { |
| 35 public: | 37 public: |
| 38 // Registers the task manager related prefs. |
| 39 static void RegisterPrefs(PrefRegistrySimple* registry); |
| 40 |
| 41 // Returns true if the user is allowed to end processes. |
| 42 static bool IsEndProcessEnabled(); |
| 43 |
| 44 #if defined(OS_MACOSX) |
| 45 // On Mac OS, the old task manager is still being used on cocoa. |
| 46 static bool IsNewTaskManagerEnabled(); |
| 47 #endif // defined(OS_MACOSX) |
| 48 |
| 36 // Gets the existing instance of the task manager if any, otherwise it will | 49 // Gets the existing instance of the task manager if any, otherwise it will |
| 37 // create it first. Must be called on the UI thread. | 50 // create it first. Must be called on the UI thread. |
| 38 static TaskManagerInterface* GetTaskManager(); | 51 static TaskManagerInterface* GetTaskManager(); |
| 39 | 52 |
| 40 // This notification will be received on the IO thread from | 53 // This notification will be received on the IO thread from |
| 41 // ChromeNetworkDelegate to update the task manager with network usage. | 54 // ChromeNetworkDelegate to update the task manager with network usage. |
| 42 static void OnRawBytesRead(const net::URLRequest& request, | 55 static void OnRawBytesRead(const net::URLRequest& request, |
| 43 int64_t bytes_read); | 56 int64_t bytes_read); |
| 44 | 57 |
| 45 void AddObserver(TaskManagerObserver* observer); | 58 void AddObserver(TaskManagerObserver* observer); |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 | 260 |
| 248 // The flags containing the enabled resources types calculations. | 261 // The flags containing the enabled resources types calculations. |
| 249 int64_t enabled_resources_flags_; | 262 int64_t enabled_resources_flags_; |
| 250 | 263 |
| 251 DISALLOW_COPY_AND_ASSIGN(TaskManagerInterface); | 264 DISALLOW_COPY_AND_ASSIGN(TaskManagerInterface); |
| 252 }; | 265 }; |
| 253 | 266 |
| 254 } // namespace task_management | 267 } // namespace task_management |
| 255 | 268 |
| 256 #endif // CHROME_BROWSER_TASK_MANAGEMENT_TASK_MANAGER_INTERFACE_H_ | 269 #endif // CHROME_BROWSER_TASK_MANAGEMENT_TASK_MANAGER_INTERFACE_H_ |
| OLD | NEW |