| 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 <stdint.h> |
| 9 |
| 8 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/observer_list.h" | 11 #include "base/observer_list.h" |
| 10 #include "base/process/process_handle.h" | 12 #include "base/process/process_handle.h" |
| 11 #include "base/time/time.h" | 13 #include "base/time/time.h" |
| 12 #include "base/timer/timer.h" | 14 #include "base/timer/timer.h" |
| 13 #include "chrome/browser/task_management/providers/task.h" | 15 #include "chrome/browser/task_management/providers/task.h" |
| 14 #include "chrome/browser/task_management/task_manager_observer.h" | 16 #include "chrome/browser/task_management/task_manager_observer.h" |
| 15 #include "third_party/WebKit/public/web/WebCache.h" | 17 #include "third_party/WebKit/public/web/WebCache.h" |
| 16 #include "ui/gfx/image/image_skia.h" | 18 #include "ui/gfx/image/image_skia.h" |
| 17 | 19 |
| 18 namespace net { | 20 namespace net { |
| 19 class URLRequest; | 21 class URLRequest; |
| 20 } // namespace net | 22 } // namespace net |
| 21 | 23 |
| 22 namespace task_management { | 24 namespace task_management { |
| 23 | 25 |
| 24 // Defines the interface for any implementation of the task manager. | 26 // Defines the interface for any implementation of the task manager. |
| 25 // Concrete implementations have no control over the refresh rate nor the | 27 // Concrete implementations have no control over the refresh rate nor the |
| 26 // enabled calculations of the usage of the various resources. | 28 // enabled calculations of the usage of the various resources. |
| 27 class TaskManagerInterface { | 29 class TaskManagerInterface { |
| 28 public: | 30 public: |
| 29 // Gets the existing instance of the task manager if any, otherwise it will | 31 // Gets the existing instance of the task manager if any, otherwise it will |
| 30 // create it first. Must be called on the UI thread. | 32 // create it first. Must be called on the UI thread. |
| 31 static TaskManagerInterface* GetTaskManager(); | 33 static TaskManagerInterface* GetTaskManager(); |
| 32 | 34 |
| 33 // This notification will be received on the IO thread from | 35 // This notification will be received on the IO thread from |
| 34 // ChromeNetworkDelegate to update the task manager with network usage. | 36 // ChromeNetworkDelegate to update the task manager with network usage. |
| 35 static void OnRawBytesRead(const net::URLRequest& request, int bytes_read); | 37 static void OnRawBytesRead(const net::URLRequest& request, |
| 38 int64_t bytes_read); |
| 36 | 39 |
| 37 void AddObserver(TaskManagerObserver* observer); | 40 void AddObserver(TaskManagerObserver* observer); |
| 38 void RemoveObserver(TaskManagerObserver* observer); | 41 void RemoveObserver(TaskManagerObserver* observer); |
| 39 | 42 |
| 40 // Activates the task with |task_id| by bringing its container to the front if | 43 // Activates the task with |task_id| by bringing its container to the front if |
| 41 // possible. | 44 // possible. |
| 42 virtual void ActivateTask(TaskId task_id) = 0; | 45 virtual void ActivateTask(TaskId task_id) = 0; |
| 43 | 46 |
| 44 // returns the CPU usage in percent for the process on which the task with | 47 // returns the CPU usage in percent for the process on which the task with |
| 45 // |task_id| is running during the current refresh cycle. | 48 // |task_id| is running during the current refresh cycle. |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 | 187 |
| 185 // The flags containing the enabled resources types calculations. | 188 // The flags containing the enabled resources types calculations. |
| 186 int64 enabled_resources_flags_; | 189 int64 enabled_resources_flags_; |
| 187 | 190 |
| 188 DISALLOW_COPY_AND_ASSIGN(TaskManagerInterface); | 191 DISALLOW_COPY_AND_ASSIGN(TaskManagerInterface); |
| 189 }; | 192 }; |
| 190 | 193 |
| 191 } // namespace task_management | 194 } // namespace task_management |
| 192 | 195 |
| 193 #endif // CHROME_BROWSER_TASK_MANAGEMENT_TASK_MANAGER_INTERFACE_H_ | 196 #endif // CHROME_BROWSER_TASK_MANAGEMENT_TASK_MANAGER_INTERFACE_H_ |
| OLD | NEW |