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

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

Issue 2964543002: TaskManager: use an unordered_map for tracking network usage (Closed)
Patch Set: fixed nits from lgtm Created 3 years, 5 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
« no previous file with comments | « no previous file | chrome/browser/task_manager/sampling/task_manager_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 content::WebContents* web_contents) const override; 92 content::WebContents* web_contents) const override;
93 93
94 // task_manager::TaskProviderObserver: 94 // task_manager::TaskProviderObserver:
95 void TaskAdded(Task* task) override; 95 void TaskAdded(Task* task) override;
96 void TaskRemoved(Task* task) override; 96 void TaskRemoved(Task* task) override;
97 void TaskUnresponsive(Task* task) override; 97 void TaskUnresponsive(Task* task) override;
98 98
99 // The notification method on the UI thread when multiple bytes are 99 // The notification method on the UI thread when multiple bytes are
100 // transferred from URLRequests. This will be called by the 100 // transferred from URLRequests. This will be called by the
101 // |io_thread_helper_| 101 // |io_thread_helper_|
102 static void OnMultipleBytesTransferredUI( 102 static void OnMultipleBytesTransferredUI(BytesTransferredMap params);
103 std::vector<BytesTransferredParam>* params);
104 103
105 private: 104 private:
106 friend struct base::LazyInstanceTraitsBase<TaskManagerImpl>; 105 friend struct base::LazyInstanceTraitsBase<TaskManagerImpl>;
107 106
108 TaskManagerImpl(); 107 TaskManagerImpl();
109 108
110 void OnVideoMemoryUsageStatsUpdate( 109 void OnVideoMemoryUsageStatsUpdate(
111 const gpu::VideoMemoryUsageStats& gpu_memory_stats); 110 const gpu::VideoMemoryUsageStats& gpu_memory_stats);
112 111
113 // task_manager::TaskManagerInterface: 112 // task_manager::TaskManagerInterface:
114 void Refresh() override; 113 void Refresh() override;
115 void StartUpdating() override; 114 void StartUpdating() override;
116 void StopUpdating() override; 115 void StopUpdating() override;
117 116
118 // Lookup a task by its pid, child_id and possibly route_id. 117 // Lookup a task by its pid, child_id and possibly route_id.
119 Task* GetTaskByPidOrRoute(int pid, int child_id, int route_id) const; 118 Task* GetTaskByPidOrRoute(int pid, int child_id, int route_id) const;
120 119
121 // Based on |param| the appropriate task will be updated by its network usage. 120 // Based on |param| the appropriate task will be updated by its network usage.
122 // Returns true if it was able to match |param| to an existing task, returns 121 // Returns true if it was able to match |param| to an existing task, returns
123 // false otherwise, at which point the caller must explicitly match these 122 // false otherwise, at which point the caller must explicitly match these
124 // bytes to the browser process by calling this method again with 123 // bytes to the browser process by calling this method again with
125 // |param.origin_pid = 0| and |param.child_id = param.route_id = -1|. 124 // |param.origin_pid = 0| and |param.child_id = param.route_id = -1|.
126 bool UpdateTasksWithBytesTransferred(const BytesTransferredParam& param); 125 bool UpdateTasksWithBytesTransferred(const BytesTransferredKey& key,
126 const BytesTransferredParam& param);
127 127
128 TaskGroup* GetTaskGroupByTaskId(TaskId task_id) const; 128 TaskGroup* GetTaskGroupByTaskId(TaskId task_id) const;
129 Task* GetTaskByTaskId(TaskId task_id) const; 129 Task* GetTaskByTaskId(TaskId task_id) const;
130 130
131 // 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
132 // background thread has completed. 132 // background thread has completed.
133 void OnTaskGroupBackgroundCalculationsDone(); 133 void OnTaskGroupBackgroundCalculationsDone();
134 134
135 const base::Closure on_background_data_ready_callback_; 135 const base::Closure on_background_data_ready_callback_;
136 136
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 // running. 170 // running.
171 bool is_running_; 171 bool is_running_;
172 172
173 base::WeakPtrFactory<TaskManagerImpl> weak_ptr_factory_; 173 base::WeakPtrFactory<TaskManagerImpl> weak_ptr_factory_;
174 DISALLOW_COPY_AND_ASSIGN(TaskManagerImpl); 174 DISALLOW_COPY_AND_ASSIGN(TaskManagerImpl);
175 }; 175 };
176 176
177 } // namespace task_manager 177 } // namespace task_manager
178 178
179 #endif // CHROME_BROWSER_TASK_MANAGER_SAMPLING_TASK_MANAGER_IMPL_H_ 179 #endif // CHROME_BROWSER_TASK_MANAGER_SAMPLING_TASK_MANAGER_IMPL_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/task_manager/sampling/task_manager_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698