Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(107)

Side by Side Diff: chrome/browser/task_management/sampling/task_manager_impl.h

Issue 1584473004: Migrate ProcessesEventRouter to the new task manager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nope, browser process is not expected in onCreate(). Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_SAMPLING_TASK_MANAGER_IMPL_H_ 5 #ifndef CHROME_BROWSER_TASK_MANAGEMENT_SAMPLING_TASK_MANAGER_IMPL_H_
6 #define CHROME_BROWSER_TASK_MANAGEMENT_SAMPLING_TASK_MANAGER_IMPL_H_ 6 #define CHROME_BROWSER_TASK_MANAGEMENT_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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 int64_t* peak) const override; 52 int64_t* peak) const override;
53 int GetOpenFdCount(TaskId task_id) const override; 53 int GetOpenFdCount(TaskId task_id) const override;
54 bool IsTaskOnBackgroundedProcess(TaskId task_id) const override; 54 bool IsTaskOnBackgroundedProcess(TaskId task_id) const override;
55 const base::string16& GetTitle(TaskId task_id) const override; 55 const base::string16& GetTitle(TaskId task_id) const override;
56 const std::string& GetTaskNameForRappor(TaskId task_id) const override; 56 const std::string& GetTaskNameForRappor(TaskId task_id) const override;
57 base::string16 GetProfileName(TaskId task_id) const override; 57 base::string16 GetProfileName(TaskId task_id) const override;
58 const gfx::ImageSkia& GetIcon(TaskId task_id) const override; 58 const gfx::ImageSkia& GetIcon(TaskId task_id) const override;
59 const base::ProcessHandle& GetProcessHandle(TaskId task_id) const override; 59 const base::ProcessHandle& GetProcessHandle(TaskId task_id) const override;
60 const base::ProcessId& GetProcessId(TaskId task_id) const override; 60 const base::ProcessId& GetProcessId(TaskId task_id) const override;
61 Task::Type GetType(TaskId task_id) const override; 61 Task::Type GetType(TaskId task_id) const override;
62 int GetTabId(TaskId task_id) const override;
63 int GetChildProcessUniqueId(TaskId task_id) const override;
64 void GetTerminationStatus(TaskId task_id,
65 base::TerminationStatus* out_status,
66 int* out_error_code) const override;
62 int64_t GetNetworkUsage(TaskId task_id) const override; 67 int64_t GetNetworkUsage(TaskId task_id) const override;
63 int64_t GetProcessTotalNetworkUsage(TaskId task_id) const override; 68 int64_t GetProcessTotalNetworkUsage(TaskId task_id) const override;
64 int64_t GetSqliteMemoryUsed(TaskId task_id) const override; 69 int64_t GetSqliteMemoryUsed(TaskId task_id) const override;
65 bool GetV8Memory(TaskId task_id, 70 bool GetV8Memory(TaskId task_id,
66 int64_t* allocated, 71 int64_t* allocated,
67 int64_t* used) const override; 72 int64_t* used) const override;
68 bool GetWebCacheStats( 73 bool GetWebCacheStats(
69 TaskId task_id, 74 TaskId task_id,
70 blink::WebCache::ResourceTypeStats* stats) const override; 75 blink::WebCache::ResourceTypeStats* stats) const override;
71 const TaskIdList& GetTaskIdsList() const override; 76 const TaskIdList& GetTaskIdsList() const override;
77 TaskIdList GetIdsOfTasksSharingSameProcess(TaskId task_id) const override;
72 size_t GetNumberOfTasksOnSameProcess(TaskId task_id) const override; 78 size_t GetNumberOfTasksOnSameProcess(TaskId task_id) const override;
73 79
74 // task_management::TaskProviderObserver: 80 // task_management::TaskProviderObserver:
75 void TaskAdded(Task* task) override; 81 void TaskAdded(Task* task) override;
76 void TaskRemoved(Task* task) override; 82 void TaskRemoved(Task* task) override;
83 void TaskUnresponsive(Task* task) override;
77 84
78 // content::GpuDataManagerObserver: 85 // content::GpuDataManagerObserver:
79 void OnVideoMemoryUsageStatsUpdate( 86 void OnVideoMemoryUsageStatsUpdate(
80 const content::GPUVideoMemoryUsageStats& gpu_memory_stats) override; 87 const content::GPUVideoMemoryUsageStats& gpu_memory_stats) override;
81 88
82 // The notification method on the UI thread when multiple bytes are read 89 // The notification method on the UI thread when multiple bytes are read
83 // from URLRequests. This will be called by the |io_thread_helper_| 90 // from URLRequests. This will be called by the |io_thread_helper_|
84 static void OnMultipleBytesReadUI(std::vector<BytesReadParam>* params); 91 static void OnMultipleBytesReadUI(std::vector<BytesReadParam>* params);
85 92
86 private: 93 private:
87 friend struct base::DefaultLazyInstanceTraits<TaskManagerImpl>; 94 friend struct base::DefaultLazyInstanceTraits<TaskManagerImpl>;
88 95
89 TaskManagerImpl(); 96 TaskManagerImpl();
90 97
91 // task_management::TaskManagerInterface: 98 // task_management::TaskManagerInterface:
92 void Refresh() override; 99 void Refresh() override;
93 void StartUpdating() override; 100 void StartUpdating() override;
94 void StopUpdating() override; 101 void StopUpdating() override;
95 102
96 // Based on |param| the appropriate task will be updated by its network usage. 103 // Based on |param| the appropriate task will be updated by its network usage.
97 // Returns true if it was able to match |param| to an existing task, returns 104 // Returns true if it was able to match |param| to an existing task, returns
98 // false otherwise, at which point the caller must explicitly match these 105 // false otherwise, at which point the caller must explicitly match these
99 // bytes to the browser process by calling this method again with 106 // bytes to the browser process by calling this method again with
100 // |param.origin_pid = 0| and |param.child_id = param.route_id = -1|. 107 // |param.origin_pid = 0| and |param.child_id = param.route_id = -1|.
101 bool UpdateTasksWithBytesRead(const BytesReadParam& param); 108 bool UpdateTasksWithBytesRead(const BytesReadParam& param);
102 109
103 TaskGroup* GetTaskGroupByTaskId(TaskId task_id) const; 110 TaskGroup* GetTaskGroupByTaskId(TaskId task_id) const;
104 Task* GetTaskByTaskId(TaskId task_id) const; 111 Task* GetTaskByTaskId(TaskId task_id) const;
105 112
113 // Called back by a TaskGroup when the resource calculations done on the
114 // background thread has completed.
115 void OnTaskGroupBackgroundCalculationsDone();
116
117 const base::Closure on_background_data_ready_callback_;
118
106 // Map TaskGroups by the IDs of the processes they represent. 119 // Map TaskGroups by the IDs of the processes they represent.
107 // Keys and values are unique (no duplicates). 120 // Keys and values are unique (no duplicates).
108 std::map<base::ProcessId, TaskGroup*> task_groups_by_proc_id_; 121 std::map<base::ProcessId, TaskGroup*> task_groups_by_proc_id_;
109 122
110 // Map each task by its ID to the TaskGroup on which it resides. 123 // Map each task by its ID to the TaskGroup on which it resides.
111 // Keys are unique but values will have duplicates (i.e. multiple tasks 124 // Keys are unique but values will have duplicates (i.e. multiple tasks
112 // running on the same process represented by a single TaskGroup). 125 // running on the same process represented by a single TaskGroup).
113 std::map<TaskId, TaskGroup*> task_groups_by_task_id_; 126 std::map<TaskId, TaskGroup*> task_groups_by_task_id_;
114 127
115 // A cached sorted list of the task IDs. 128 // A cached sorted list of the task IDs.
(...skipping 19 matching lines...) Expand all
135 // This will be set to true while there are observers and the task manager is 148 // This will be set to true while there are observers and the task manager is
136 // running. 149 // running.
137 bool is_running_; 150 bool is_running_;
138 151
139 DISALLOW_COPY_AND_ASSIGN(TaskManagerImpl); 152 DISALLOW_COPY_AND_ASSIGN(TaskManagerImpl);
140 }; 153 };
141 154
142 } // namespace task_management 155 } // namespace task_management
143 156
144 #endif // CHROME_BROWSER_TASK_MANAGEMENT_SAMPLING_TASK_MANAGER_IMPL_H_ 157 #endif // CHROME_BROWSER_TASK_MANAGEMENT_SAMPLING_TASK_MANAGER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698