OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_TASK_MANAGER_RESOURCE_PROVIDERS_H_ | 5 #ifndef CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_RESOURCE_PROVIDERS_H_ |
6 #define CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_RESOURCE_PROVIDERS_H_ | 6 #define CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_RESOURCE_PROVIDERS_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <vector> | 10 #include <vector> |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 virtual float GetFPS() const OVERRIDE; | 47 virtual float GetFPS() const OVERRIDE; |
48 virtual bool ReportsV8MemoryStats() const OVERRIDE; | 48 virtual bool ReportsV8MemoryStats() const OVERRIDE; |
49 virtual size_t GetV8MemoryAllocated() const OVERRIDE; | 49 virtual size_t GetV8MemoryAllocated() const OVERRIDE; |
50 virtual size_t GetV8MemoryUsed() const OVERRIDE; | 50 virtual size_t GetV8MemoryUsed() const OVERRIDE; |
51 | 51 |
52 // RenderResources are always inspectable. | 52 // RenderResources are always inspectable. |
53 virtual bool CanInspect() const OVERRIDE; | 53 virtual bool CanInspect() const OVERRIDE; |
54 virtual void Inspect() const OVERRIDE; | 54 virtual void Inspect() const OVERRIDE; |
55 | 55 |
56 // RenderResources always provide the network usage. | 56 // RenderResources always provide the network usage. |
57 virtual bool SupportNetworkUsage() const; | 57 virtual bool SupportNetworkUsage() const OVERRIDE; |
58 virtual void SetSupportNetworkUsage() { } | 58 virtual void SetSupportNetworkUsage() OVERRIDE { } |
59 | 59 |
60 virtual void Refresh(); | 60 virtual void Refresh() OVERRIDE; |
61 | 61 |
62 virtual void NotifyResourceTypeStats( | 62 virtual void NotifyResourceTypeStats( |
63 const WebKit::WebCache::ResourceTypeStats& stats); | 63 const WebKit::WebCache::ResourceTypeStats& stats) OVERRIDE; |
64 | 64 |
65 virtual void NotifyFPS(float fps); | 65 virtual void NotifyFPS(float fps) OVERRIDE; |
66 | 66 |
67 virtual void NotifyV8HeapStats(size_t v8_memory_allocated, | 67 virtual void NotifyV8HeapStats(size_t v8_memory_allocated, |
68 size_t v8_memory_used); | 68 size_t v8_memory_used) OVERRIDE; |
69 | 69 |
70 private: | 70 private: |
71 base::ProcessHandle process_; | 71 base::ProcessHandle process_; |
72 int pid_; | 72 int pid_; |
73 | 73 |
74 // RenderViewHost we use to fetch stats. | 74 // RenderViewHost we use to fetch stats. |
75 RenderViewHost* render_view_host_; | 75 RenderViewHost* render_view_host_; |
76 // The stats_ field holds information about resource usage in the renderer | 76 // The stats_ field holds information about resource usage in the renderer |
77 // process and so it is updated asynchronously by the Refresh() call. | 77 // process and so it is updated asynchronously by the Refresh() call. |
78 WebKit::WebCache::ResourceTypeStats stats_; | 78 WebKit::WebCache::ResourceTypeStats stats_; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 }; | 118 }; |
119 | 119 |
120 class TaskManagerTabContentsResourceProvider | 120 class TaskManagerTabContentsResourceProvider |
121 : public TaskManager::ResourceProvider, | 121 : public TaskManager::ResourceProvider, |
122 public content::NotificationObserver { | 122 public content::NotificationObserver { |
123 public: | 123 public: |
124 explicit TaskManagerTabContentsResourceProvider(TaskManager* task_manager); | 124 explicit TaskManagerTabContentsResourceProvider(TaskManager* task_manager); |
125 | 125 |
126 virtual TaskManager::Resource* GetResource(int origin_pid, | 126 virtual TaskManager::Resource* GetResource(int origin_pid, |
127 int render_process_host_id, | 127 int render_process_host_id, |
128 int routing_id); | 128 int routing_id) OVERRIDE; |
129 virtual void StartUpdating(); | 129 virtual void StartUpdating() OVERRIDE; |
130 virtual void StopUpdating(); | 130 virtual void StopUpdating() OVERRIDE; |
131 | 131 |
132 // content::NotificationObserver method: | 132 // content::NotificationObserver method: |
133 virtual void Observe(int type, | 133 virtual void Observe(int type, |
134 const content::NotificationSource& source, | 134 const content::NotificationSource& source, |
135 const content::NotificationDetails& details); | 135 const content::NotificationDetails& details) OVERRIDE; |
136 | 136 |
137 private: | 137 private: |
138 virtual ~TaskManagerTabContentsResourceProvider(); | 138 virtual ~TaskManagerTabContentsResourceProvider(); |
139 | 139 |
140 void Add(TabContentsWrapper* tab_contents); | 140 void Add(TabContentsWrapper* tab_contents); |
141 void Remove(TabContentsWrapper* tab_contents); | 141 void Remove(TabContentsWrapper* tab_contents); |
142 | 142 |
143 void AddToTaskManager(TabContentsWrapper* tab_contents); | 143 void AddToTaskManager(TabContentsWrapper* tab_contents); |
144 | 144 |
145 // Whether we are currently reporting to the task manager. Used to ignore | 145 // Whether we are currently reporting to the task manager. Used to ignore |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 | 188 |
189 class TaskManagerBackgroundContentsResourceProvider | 189 class TaskManagerBackgroundContentsResourceProvider |
190 : public TaskManager::ResourceProvider, | 190 : public TaskManager::ResourceProvider, |
191 public content::NotificationObserver { | 191 public content::NotificationObserver { |
192 public: | 192 public: |
193 explicit TaskManagerBackgroundContentsResourceProvider( | 193 explicit TaskManagerBackgroundContentsResourceProvider( |
194 TaskManager* task_manager); | 194 TaskManager* task_manager); |
195 | 195 |
196 virtual TaskManager::Resource* GetResource(int origin_pid, | 196 virtual TaskManager::Resource* GetResource(int origin_pid, |
197 int render_process_host_id, | 197 int render_process_host_id, |
198 int routing_id); | 198 int routing_id) OVERRIDE; |
199 virtual void StartUpdating(); | 199 virtual void StartUpdating() OVERRIDE; |
200 virtual void StopUpdating(); | 200 virtual void StopUpdating() OVERRIDE; |
201 | 201 |
202 // content::NotificationObserver method: | 202 // content::NotificationObserver method: |
203 virtual void Observe(int type, | 203 virtual void Observe(int type, |
204 const content::NotificationSource& source, | 204 const content::NotificationSource& source, |
205 const content::NotificationDetails& details); | 205 const content::NotificationDetails& details) OVERRIDE; |
206 | 206 |
207 private: | 207 private: |
208 virtual ~TaskManagerBackgroundContentsResourceProvider(); | 208 virtual ~TaskManagerBackgroundContentsResourceProvider(); |
209 | 209 |
210 void Add(BackgroundContents* background_contents, const string16& title); | 210 void Add(BackgroundContents* background_contents, const string16& title); |
211 void Remove(BackgroundContents* background_contents); | 211 void Remove(BackgroundContents* background_contents); |
212 | 212 |
213 void AddToTaskManager(BackgroundContents* background_contents, | 213 void AddToTaskManager(BackgroundContents* background_contents, |
214 const string16& title); | 214 const string16& title); |
215 | 215 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 }; | 267 }; |
268 | 268 |
269 class TaskManagerChildProcessResourceProvider | 269 class TaskManagerChildProcessResourceProvider |
270 : public TaskManager::ResourceProvider, | 270 : public TaskManager::ResourceProvider, |
271 public content::NotificationObserver { | 271 public content::NotificationObserver { |
272 public: | 272 public: |
273 explicit TaskManagerChildProcessResourceProvider(TaskManager* task_manager); | 273 explicit TaskManagerChildProcessResourceProvider(TaskManager* task_manager); |
274 | 274 |
275 virtual TaskManager::Resource* GetResource(int origin_pid, | 275 virtual TaskManager::Resource* GetResource(int origin_pid, |
276 int render_process_host_id, | 276 int render_process_host_id, |
277 int routing_id); | 277 int routing_id) OVERRIDE; |
278 virtual void StartUpdating(); | 278 virtual void StartUpdating() OVERRIDE; |
279 virtual void StopUpdating(); | 279 virtual void StopUpdating() OVERRIDE; |
280 | 280 |
281 // content::NotificationObserver method: | 281 // content::NotificationObserver method: |
282 virtual void Observe(int type, | 282 virtual void Observe(int type, |
283 const content::NotificationSource& source, | 283 const content::NotificationSource& source, |
284 const content::NotificationDetails& details); | 284 const content::NotificationDetails& details) OVERRIDE; |
285 | 285 |
286 // Retrieves the current ChildProcessInfo (performed in the IO thread). | 286 // Retrieves the current ChildProcessInfo (performed in the IO thread). |
287 virtual void RetrieveChildProcessInfo(); | 287 virtual void RetrieveChildProcessInfo(); |
288 | 288 |
289 // Notifies the UI thread that the ChildProcessInfo have been retrieved. | 289 // Notifies the UI thread that the ChildProcessInfo have been retrieved. |
290 virtual void ChildProcessInfoRetreived(); | 290 virtual void ChildProcessInfoRetreived(); |
291 | 291 |
292 // Whether we are currently reporting to the task manager. Used to ignore | 292 // Whether we are currently reporting to the task manager. Used to ignore |
293 // notifications sent after StopUpdating(). | 293 // notifications sent after StopUpdating(). |
294 bool updating_; | 294 bool updating_; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 virtual bool CanInspect() const OVERRIDE; | 334 virtual bool CanInspect() const OVERRIDE; |
335 virtual void Inspect() const OVERRIDE; | 335 virtual void Inspect() const OVERRIDE; |
336 virtual bool SupportNetworkUsage() const OVERRIDE; | 336 virtual bool SupportNetworkUsage() const OVERRIDE; |
337 virtual void SetSupportNetworkUsage() OVERRIDE; | 337 virtual void SetSupportNetworkUsage() OVERRIDE; |
338 virtual const Extension* GetExtension() const OVERRIDE; | 338 virtual const Extension* GetExtension() const OVERRIDE; |
339 | 339 |
340 // Returns the pid of the extension process. | 340 // Returns the pid of the extension process. |
341 int process_id() const { return pid_; } | 341 int process_id() const { return pid_; } |
342 | 342 |
343 // Returns true if the associated extension has a background page. | 343 // Returns true if the associated extension has a background page. |
344 virtual bool IsBackground() const; | 344 virtual bool IsBackground() const OVERRIDE; |
345 | 345 |
346 private: | 346 private: |
347 // The icon painted for the extension process. | 347 // The icon painted for the extension process. |
348 static SkBitmap* default_icon_; | 348 static SkBitmap* default_icon_; |
349 | 349 |
350 ExtensionHost* extension_host_; | 350 ExtensionHost* extension_host_; |
351 | 351 |
352 // Cached data about the extension. | 352 // Cached data about the extension. |
353 base::ProcessHandle process_handle_; | 353 base::ProcessHandle process_handle_; |
354 int pid_; | 354 int pid_; |
355 string16 title_; | 355 string16 title_; |
356 | 356 |
357 DISALLOW_COPY_AND_ASSIGN(TaskManagerExtensionProcessResource); | 357 DISALLOW_COPY_AND_ASSIGN(TaskManagerExtensionProcessResource); |
358 }; | 358 }; |
359 | 359 |
360 class TaskManagerExtensionProcessResourceProvider | 360 class TaskManagerExtensionProcessResourceProvider |
361 : public TaskManager::ResourceProvider, | 361 : public TaskManager::ResourceProvider, |
362 public content::NotificationObserver { | 362 public content::NotificationObserver { |
363 public: | 363 public: |
364 explicit TaskManagerExtensionProcessResourceProvider( | 364 explicit TaskManagerExtensionProcessResourceProvider( |
365 TaskManager* task_manager); | 365 TaskManager* task_manager); |
366 | 366 |
367 virtual TaskManager::Resource* GetResource(int origin_pid, | 367 virtual TaskManager::Resource* GetResource(int origin_pid, |
368 int render_process_host_id, | 368 int render_process_host_id, |
369 int routing_id); | 369 int routing_id) OVERRIDE; |
370 virtual void StartUpdating(); | 370 virtual void StartUpdating() OVERRIDE; |
371 virtual void StopUpdating(); | 371 virtual void StopUpdating() OVERRIDE; |
372 | 372 |
373 // content::NotificationObserver method: | 373 // content::NotificationObserver method: |
374 virtual void Observe(int type, | 374 virtual void Observe(int type, |
375 const content::NotificationSource& source, | 375 const content::NotificationSource& source, |
376 const content::NotificationDetails& details); | 376 const content::NotificationDetails& details) OVERRIDE; |
377 | 377 |
378 private: | 378 private: |
379 virtual ~TaskManagerExtensionProcessResourceProvider(); | 379 virtual ~TaskManagerExtensionProcessResourceProvider(); |
380 | 380 |
381 void AddToTaskManager(ExtensionHost* extension_host); | 381 void AddToTaskManager(ExtensionHost* extension_host); |
382 void RemoveFromTaskManager(ExtensionHost* extension_host); | 382 void RemoveFromTaskManager(ExtensionHost* extension_host); |
383 | 383 |
384 TaskManager* task_manager_; | 384 TaskManager* task_manager_; |
385 | 385 |
386 // Maps the actual resources (ExtensionHost*) to the Task Manager resources. | 386 // Maps the actual resources (ExtensionHost*) to the Task Manager resources. |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
432 class TaskManagerNotificationResourceProvider | 432 class TaskManagerNotificationResourceProvider |
433 : public TaskManager::ResourceProvider, | 433 : public TaskManager::ResourceProvider, |
434 public content::NotificationObserver { | 434 public content::NotificationObserver { |
435 public: | 435 public: |
436 static TaskManagerNotificationResourceProvider* Create( | 436 static TaskManagerNotificationResourceProvider* Create( |
437 TaskManager* task_manager); | 437 TaskManager* task_manager); |
438 | 438 |
439 // TaskManager::ResourceProvider interface | 439 // TaskManager::ResourceProvider interface |
440 virtual TaskManager::Resource* GetResource(int origin_pid, | 440 virtual TaskManager::Resource* GetResource(int origin_pid, |
441 int render_process_host_id, | 441 int render_process_host_id, |
442 int routing_id); | 442 int routing_id) OVERRIDE; |
443 virtual void StartUpdating(); | 443 virtual void StartUpdating() OVERRIDE; |
444 virtual void StopUpdating(); | 444 virtual void StopUpdating() OVERRIDE; |
445 | 445 |
446 // content::NotificationObserver interface | 446 // content::NotificationObserver interface |
447 virtual void Observe(int type, | 447 virtual void Observe(int type, |
448 const content::NotificationSource& source, | 448 const content::NotificationSource& source, |
449 const content::NotificationDetails& details); | 449 const content::NotificationDetails& details) OVERRIDE; |
450 | 450 |
451 private: | 451 private: |
452 explicit TaskManagerNotificationResourceProvider(TaskManager* task_manager); | 452 explicit TaskManagerNotificationResourceProvider(TaskManager* task_manager); |
453 virtual ~TaskManagerNotificationResourceProvider(); | 453 virtual ~TaskManagerNotificationResourceProvider(); |
454 | 454 |
455 void AddToTaskManager(BalloonHost* balloon_host); | 455 void AddToTaskManager(BalloonHost* balloon_host); |
456 void RemoveFromTaskManager(BalloonHost* balloon_host); | 456 void RemoveFromTaskManager(BalloonHost* balloon_host); |
457 | 457 |
458 TaskManager* task_manager_; | 458 TaskManager* task_manager_; |
459 | 459 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 }; | 500 }; |
501 | 501 |
502 class TaskManagerBrowserProcessResourceProvider | 502 class TaskManagerBrowserProcessResourceProvider |
503 : public TaskManager::ResourceProvider { | 503 : public TaskManager::ResourceProvider { |
504 public: | 504 public: |
505 explicit TaskManagerBrowserProcessResourceProvider( | 505 explicit TaskManagerBrowserProcessResourceProvider( |
506 TaskManager* task_manager); | 506 TaskManager* task_manager); |
507 | 507 |
508 virtual TaskManager::Resource* GetResource(int origin_pid, | 508 virtual TaskManager::Resource* GetResource(int origin_pid, |
509 int render_process_host_id, | 509 int render_process_host_id, |
510 int routing_id); | 510 int routing_id) OVERRIDE; |
511 virtual void StartUpdating(); | 511 virtual void StartUpdating() OVERRIDE; |
512 virtual void StopUpdating(); | 512 virtual void StopUpdating() OVERRIDE; |
513 | 513 |
514 // Whether we are currently reporting to the task manager. Used to ignore | 514 // Whether we are currently reporting to the task manager. Used to ignore |
515 // notifications sent after StopUpdating(). | 515 // notifications sent after StopUpdating(). |
516 bool updating_; | 516 bool updating_; |
517 | 517 |
518 private: | 518 private: |
519 virtual ~TaskManagerBrowserProcessResourceProvider(); | 519 virtual ~TaskManagerBrowserProcessResourceProvider(); |
520 | 520 |
521 void AddToTaskManager(ChildProcessInfo child_process_info); | 521 void AddToTaskManager(ChildProcessInfo child_process_info); |
522 | 522 |
523 TaskManager* task_manager_; | 523 TaskManager* task_manager_; |
524 TaskManagerBrowserProcessResource resource_; | 524 TaskManagerBrowserProcessResource resource_; |
525 | 525 |
526 DISALLOW_COPY_AND_ASSIGN(TaskManagerBrowserProcessResourceProvider); | 526 DISALLOW_COPY_AND_ASSIGN(TaskManagerBrowserProcessResourceProvider); |
527 }; | 527 }; |
528 | 528 |
529 #endif // CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_RESOURCE_PROVIDERS_H_ | 529 #endif // CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_RESOURCE_PROVIDERS_H_ |
OLD | NEW |