| 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_SAMPLING_TASK_MANAGER_IMPL_H_ | 5 #ifndef CHROME_BROWSER_TASK_MANAGER_SAMPLING_TASK_MANAGER_IMPL_H_ |
| 6 #define CHROME_BROWSER_TASK_MANAGER_SAMPLING_TASK_MANAGER_IMPL_H_ | 6 #define CHROME_BROWSER_TASK_MANAGER_SAMPLING_TASK_MANAGER_IMPL_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 const gfx::ImageSkia& GetIcon(TaskId task_id) const override; | 67 const gfx::ImageSkia& GetIcon(TaskId task_id) const override; |
| 68 const base::ProcessHandle& GetProcessHandle(TaskId task_id) const override; | 68 const base::ProcessHandle& GetProcessHandle(TaskId task_id) const override; |
| 69 const base::ProcessId& GetProcessId(TaskId task_id) const override; | 69 const base::ProcessId& GetProcessId(TaskId task_id) const override; |
| 70 Task::Type GetType(TaskId task_id) const override; | 70 Task::Type GetType(TaskId task_id) const override; |
| 71 int GetTabId(TaskId task_id) const override; | 71 int GetTabId(TaskId task_id) const override; |
| 72 int GetChildProcessUniqueId(TaskId task_id) const override; | 72 int GetChildProcessUniqueId(TaskId task_id) const override; |
| 73 void GetTerminationStatus(TaskId task_id, | 73 void GetTerminationStatus(TaskId task_id, |
| 74 base::TerminationStatus* out_status, | 74 base::TerminationStatus* out_status, |
| 75 int* out_error_code) const override; | 75 int* out_error_code) const override; |
| 76 int64_t GetNetworkUsage(TaskId task_id) const override; | 76 int64_t GetNetworkUsage(TaskId task_id) const override; |
| 77 int64_t GetCumulativeNetworkUsage(TaskId task_id) const override; |
| 77 int64_t GetProcessTotalNetworkUsage(TaskId task_id) const override; | 78 int64_t GetProcessTotalNetworkUsage(TaskId task_id) const override; |
| 79 int64_t GetCumulativeProcessTotalNetworkUsage(TaskId task_id) const override; |
| 78 int64_t GetSqliteMemoryUsed(TaskId task_id) const override; | 80 int64_t GetSqliteMemoryUsed(TaskId task_id) const override; |
| 79 bool GetV8Memory(TaskId task_id, | 81 bool GetV8Memory(TaskId task_id, |
| 80 int64_t* allocated, | 82 int64_t* allocated, |
| 81 int64_t* used) const override; | 83 int64_t* used) const override; |
| 82 bool GetWebCacheStats( | 84 bool GetWebCacheStats( |
| 83 TaskId task_id, | 85 TaskId task_id, |
| 84 blink::WebCache::ResourceTypeStats* stats) const override; | 86 blink::WebCache::ResourceTypeStats* stats) const override; |
| 85 int GetKeepaliveCount(TaskId task_id) const override; | 87 int GetKeepaliveCount(TaskId task_id) const override; |
| 86 const TaskIdList& GetTaskIdsList() const override; | 88 const TaskIdList& GetTaskIdsList() const override; |
| 87 TaskIdList GetIdsOfTasksSharingSameProcess(TaskId task_id) const override; | 89 TaskIdList GetIdsOfTasksSharingSameProcess(TaskId task_id) const override; |
| 88 size_t GetNumberOfTasksOnSameProcess(TaskId task_id) const override; | 90 size_t GetNumberOfTasksOnSameProcess(TaskId task_id) const override; |
| 89 TaskId GetTaskIdForWebContents( | 91 TaskId GetTaskIdForWebContents( |
| 90 content::WebContents* web_contents) const override; | 92 content::WebContents* web_contents) const override; |
| 91 | 93 |
| 92 // task_manager::TaskProviderObserver: | 94 // task_manager::TaskProviderObserver: |
| 93 void TaskAdded(Task* task) override; | 95 void TaskAdded(Task* task) override; |
| 94 void TaskRemoved(Task* task) override; | 96 void TaskRemoved(Task* task) override; |
| 95 void TaskUnresponsive(Task* task) override; | 97 void TaskUnresponsive(Task* task) override; |
| 96 | 98 |
| 97 // The notification method on the UI thread when multiple bytes are read | 99 // The notification method on the UI thread when multiple bytes are |
| 98 // from URLRequests. This will be called by the |io_thread_helper_| | 100 // transferred from URLRequests. This will be called by the |
| 99 static void OnMultipleBytesReadUI(std::vector<BytesReadParam>* params); | 101 // |io_thread_helper_| |
| 102 static void OnMultipleBytesTransferredUI( |
| 103 std::vector<BytesTransferredParam>* params); |
| 100 | 104 |
| 101 private: | 105 private: |
| 102 friend struct base::LazyInstanceTraitsBase<TaskManagerImpl>; | 106 friend struct base::LazyInstanceTraitsBase<TaskManagerImpl>; |
| 103 | 107 |
| 104 TaskManagerImpl(); | 108 TaskManagerImpl(); |
| 105 | 109 |
| 106 void OnVideoMemoryUsageStatsUpdate( | 110 void OnVideoMemoryUsageStatsUpdate( |
| 107 const gpu::VideoMemoryUsageStats& gpu_memory_stats); | 111 const gpu::VideoMemoryUsageStats& gpu_memory_stats); |
| 108 | 112 |
| 109 // task_manager::TaskManagerInterface: | 113 // task_manager::TaskManagerInterface: |
| 110 void Refresh() override; | 114 void Refresh() override; |
| 111 void StartUpdating() override; | 115 void StartUpdating() override; |
| 112 void StopUpdating() override; | 116 void StopUpdating() override; |
| 113 | 117 |
| 114 // Lookup a task by its pid, child_id and possibly route_id. | 118 // Lookup a task by its pid, child_id and possibly route_id. |
| 115 Task* GetTaskByPidOrRoute(int pid, int child_id, int route_id) const; | 119 Task* GetTaskByPidOrRoute(int pid, int child_id, int route_id) const; |
| 116 | 120 |
| 117 // Based on |param| the appropriate task will be updated by its network usage. | 121 // Based on |param| the appropriate task will be updated by its network usage. |
| 118 // Returns true if it was able to match |param| to an existing task, returns | 122 // Returns true if it was able to match |param| to an existing task, returns |
| 119 // false otherwise, at which point the caller must explicitly match these | 123 // false otherwise, at which point the caller must explicitly match these |
| 120 // bytes to the browser process by calling this method again with | 124 // bytes to the browser process by calling this method again with |
| 121 // |param.origin_pid = 0| and |param.child_id = param.route_id = -1|. | 125 // |param.origin_pid = 0| and |param.child_id = param.route_id = -1|. |
| 122 bool UpdateTasksWithBytesRead(const BytesReadParam& param); | 126 bool UpdateTasksWithBytesTransferred(const BytesTransferredParam& param); |
| 123 | 127 |
| 124 TaskGroup* GetTaskGroupByTaskId(TaskId task_id) const; | 128 TaskGroup* GetTaskGroupByTaskId(TaskId task_id) const; |
| 125 Task* GetTaskByTaskId(TaskId task_id) const; | 129 Task* GetTaskByTaskId(TaskId task_id) const; |
| 126 | 130 |
| 127 // Called back by a TaskGroup when the resource calculations done on the | 131 // Called back by a TaskGroup when the resource calculations done on the |
| 128 // background thread has completed. | 132 // background thread has completed. |
| 129 void OnTaskGroupBackgroundCalculationsDone(); | 133 void OnTaskGroupBackgroundCalculationsDone(); |
| 130 | 134 |
| 131 const base::Closure on_background_data_ready_callback_; | 135 const base::Closure on_background_data_ready_callback_; |
| 132 | 136 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 // running. | 170 // running. |
| 167 bool is_running_; | 171 bool is_running_; |
| 168 | 172 |
| 169 base::WeakPtrFactory<TaskManagerImpl> weak_ptr_factory_; | 173 base::WeakPtrFactory<TaskManagerImpl> weak_ptr_factory_; |
| 170 DISALLOW_COPY_AND_ASSIGN(TaskManagerImpl); | 174 DISALLOW_COPY_AND_ASSIGN(TaskManagerImpl); |
| 171 }; | 175 }; |
| 172 | 176 |
| 173 } // namespace task_manager | 177 } // namespace task_manager |
| 174 | 178 |
| 175 #endif // CHROME_BROWSER_TASK_MANAGER_SAMPLING_TASK_MANAGER_IMPL_H_ | 179 #endif // CHROME_BROWSER_TASK_MANAGER_SAMPLING_TASK_MANAGER_IMPL_H_ |
| OLD | NEW |