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

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

Powered by Google App Engine
This is Rietveld 408576698