OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 23 matching lines...) Expand all Loading... |
34 // Base class for various types of render process resources that provides common | 34 // Base class for various types of render process resources that provides common |
35 // functionality like stats tracking. | 35 // functionality like stats tracking. |
36 class TaskManagerRendererResource : public TaskManager::Resource { | 36 class TaskManagerRendererResource : public TaskManager::Resource { |
37 public: | 37 public: |
38 TaskManagerRendererResource(base::ProcessHandle process, | 38 TaskManagerRendererResource(base::ProcessHandle process, |
39 content::RenderViewHost* render_view_host); | 39 content::RenderViewHost* render_view_host); |
40 virtual ~TaskManagerRendererResource(); | 40 virtual ~TaskManagerRendererResource(); |
41 | 41 |
42 // TaskManager::Resource methods: | 42 // TaskManager::Resource methods: |
43 virtual base::ProcessHandle GetProcess() const OVERRIDE; | 43 virtual base::ProcessHandle GetProcess() const OVERRIDE; |
| 44 virtual int GetUniqueChildProcessId() const OVERRIDE; |
44 virtual Type GetType() const OVERRIDE; | 45 virtual Type GetType() const OVERRIDE; |
45 virtual int GetRoutingID() const OVERRIDE; | 46 virtual int GetRoutingID() const OVERRIDE; |
46 | 47 |
47 virtual bool ReportsCacheStats() const OVERRIDE; | 48 virtual bool ReportsCacheStats() const OVERRIDE; |
48 virtual WebKit::WebCache::ResourceTypeStats GetWebCoreCacheStats() const | 49 virtual WebKit::WebCache::ResourceTypeStats GetWebCoreCacheStats() const |
49 OVERRIDE; | 50 OVERRIDE; |
50 virtual bool ReportsFPS() const OVERRIDE; | 51 virtual bool ReportsFPS() const OVERRIDE; |
51 virtual float GetFPS() const OVERRIDE; | 52 virtual float GetFPS() const OVERRIDE; |
52 virtual bool ReportsV8MemoryStats() const OVERRIDE; | 53 virtual bool ReportsV8MemoryStats() const OVERRIDE; |
53 virtual size_t GetV8MemoryAllocated() const OVERRIDE; | 54 virtual size_t GetV8MemoryAllocated() const OVERRIDE; |
(...skipping 13 matching lines...) Expand all Loading... |
67 const WebKit::WebCache::ResourceTypeStats& stats) OVERRIDE; | 68 const WebKit::WebCache::ResourceTypeStats& stats) OVERRIDE; |
68 | 69 |
69 virtual void NotifyFPS(float fps) OVERRIDE; | 70 virtual void NotifyFPS(float fps) OVERRIDE; |
70 | 71 |
71 virtual void NotifyV8HeapStats(size_t v8_memory_allocated, | 72 virtual void NotifyV8HeapStats(size_t v8_memory_allocated, |
72 size_t v8_memory_used) OVERRIDE; | 73 size_t v8_memory_used) OVERRIDE; |
73 | 74 |
74 private: | 75 private: |
75 base::ProcessHandle process_; | 76 base::ProcessHandle process_; |
76 int pid_; | 77 int pid_; |
| 78 int unique_process_id_; |
77 | 79 |
78 // RenderViewHost we use to fetch stats. | 80 // RenderViewHost we use to fetch stats. |
79 content::RenderViewHost* render_view_host_; | 81 content::RenderViewHost* render_view_host_; |
80 // The stats_ field holds information about resource usage in the renderer | 82 // The stats_ field holds information about resource usage in the renderer |
81 // process and so it is updated asynchronously by the Refresh() call. | 83 // process and so it is updated asynchronously by the Refresh() call. |
82 WebKit::WebCache::ResourceTypeStats stats_; | 84 WebKit::WebCache::ResourceTypeStats stats_; |
83 // This flag is true if we are waiting for the renderer to report its stats. | 85 // This flag is true if we are waiting for the renderer to report its stats. |
84 bool pending_stats_update_; | 86 bool pending_stats_update_; |
85 | 87 |
86 // The fps_ field holds the renderer frames per second. | 88 // The fps_ field holds the renderer frames per second. |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 // A scoped container for notification registries. | 240 // A scoped container for notification registries. |
239 content::NotificationRegistrar registrar_; | 241 content::NotificationRegistrar registrar_; |
240 | 242 |
241 DISALLOW_COPY_AND_ASSIGN(TaskManagerBackgroundContentsResourceProvider); | 243 DISALLOW_COPY_AND_ASSIGN(TaskManagerBackgroundContentsResourceProvider); |
242 }; | 244 }; |
243 | 245 |
244 class TaskManagerChildProcessResource : public TaskManager::Resource { | 246 class TaskManagerChildProcessResource : public TaskManager::Resource { |
245 public: | 247 public: |
246 TaskManagerChildProcessResource(content::ProcessType type, | 248 TaskManagerChildProcessResource(content::ProcessType type, |
247 const string16& name, | 249 const string16& name, |
248 base::ProcessHandle handle); | 250 base::ProcessHandle handle, |
| 251 int unique_process_id); |
249 virtual ~TaskManagerChildProcessResource(); | 252 virtual ~TaskManagerChildProcessResource(); |
250 | 253 |
251 // TaskManager::Resource methods: | 254 // TaskManager::Resource methods: |
252 virtual string16 GetTitle() const OVERRIDE; | 255 virtual string16 GetTitle() const OVERRIDE; |
253 virtual string16 GetProfileName() const OVERRIDE; | 256 virtual string16 GetProfileName() const OVERRIDE; |
254 virtual SkBitmap GetIcon() const OVERRIDE; | 257 virtual SkBitmap GetIcon() const OVERRIDE; |
255 virtual base::ProcessHandle GetProcess() const OVERRIDE; | 258 virtual base::ProcessHandle GetProcess() const OVERRIDE; |
| 259 virtual int GetUniqueChildProcessId() const OVERRIDE; |
256 virtual Type GetType() const OVERRIDE; | 260 virtual Type GetType() const OVERRIDE; |
257 virtual bool SupportNetworkUsage() const OVERRIDE; | 261 virtual bool SupportNetworkUsage() const OVERRIDE; |
258 virtual void SetSupportNetworkUsage() OVERRIDE; | 262 virtual void SetSupportNetworkUsage() OVERRIDE; |
259 | 263 |
260 // Returns the pid of the child process. | 264 // Returns the pid of the child process. |
261 int process_id() const { return pid_; } | 265 int process_id() const { return pid_; } |
262 | 266 |
263 private: | 267 private: |
264 // Returns a localized title for the child process. For example, a plugin | 268 // Returns a localized title for the child process. For example, a plugin |
265 // process would be "Plug-in: Flash" when name is "Flash". | 269 // process would be "Plug-in: Flash" when name is "Flash". |
266 string16 GetLocalizedTitle() const; | 270 string16 GetLocalizedTitle() const; |
267 | 271 |
268 content::ProcessType type_; | 272 content::ProcessType type_; |
269 string16 name_; | 273 string16 name_; |
270 base::ProcessHandle handle_; | 274 base::ProcessHandle handle_; |
271 int pid_; | 275 int pid_; |
| 276 int unique_process_id_; |
272 mutable string16 title_; | 277 mutable string16 title_; |
273 bool network_usage_support_; | 278 bool network_usage_support_; |
274 | 279 |
275 // The icon painted for the child processs. | 280 // The icon painted for the child processs. |
276 // TODO(jcampan): we should have plugin specific icons for well-known | 281 // TODO(jcampan): we should have plugin specific icons for well-known |
277 // plugins. | 282 // plugins. |
278 static SkBitmap* default_icon_; | 283 static SkBitmap* default_icon_; |
279 | 284 |
280 DISALLOW_COPY_AND_ASSIGN(TaskManagerChildProcessResource); | 285 DISALLOW_COPY_AND_ASSIGN(TaskManagerChildProcessResource); |
281 }; | 286 }; |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 class TaskManagerExtensionProcessResource : public TaskManager::Resource { | 345 class TaskManagerExtensionProcessResource : public TaskManager::Resource { |
341 public: | 346 public: |
342 explicit TaskManagerExtensionProcessResource(ExtensionHost* extension_host); | 347 explicit TaskManagerExtensionProcessResource(ExtensionHost* extension_host); |
343 virtual ~TaskManagerExtensionProcessResource(); | 348 virtual ~TaskManagerExtensionProcessResource(); |
344 | 349 |
345 // TaskManager::Resource methods: | 350 // TaskManager::Resource methods: |
346 virtual string16 GetTitle() const OVERRIDE; | 351 virtual string16 GetTitle() const OVERRIDE; |
347 virtual string16 GetProfileName() const OVERRIDE; | 352 virtual string16 GetProfileName() const OVERRIDE; |
348 virtual SkBitmap GetIcon() const OVERRIDE; | 353 virtual SkBitmap GetIcon() const OVERRIDE; |
349 virtual base::ProcessHandle GetProcess() const OVERRIDE; | 354 virtual base::ProcessHandle GetProcess() const OVERRIDE; |
| 355 virtual int GetUniqueChildProcessId() const OVERRIDE; |
350 virtual Type GetType() const OVERRIDE; | 356 virtual Type GetType() const OVERRIDE; |
351 virtual bool CanInspect() const OVERRIDE; | 357 virtual bool CanInspect() const OVERRIDE; |
352 virtual void Inspect() const OVERRIDE; | 358 virtual void Inspect() const OVERRIDE; |
353 virtual bool SupportNetworkUsage() const OVERRIDE; | 359 virtual bool SupportNetworkUsage() const OVERRIDE; |
354 virtual void SetSupportNetworkUsage() OVERRIDE; | 360 virtual void SetSupportNetworkUsage() OVERRIDE; |
355 virtual const Extension* GetExtension() const OVERRIDE; | 361 virtual const Extension* GetExtension() const OVERRIDE; |
356 | 362 |
357 // Returns the pid of the extension process. | 363 // Returns the pid of the extension process. |
358 int process_id() const { return pid_; } | 364 int process_id() const { return pid_; } |
359 | 365 |
360 // Returns true if the associated extension has a background page. | 366 // Returns true if the associated extension has a background page. |
361 virtual bool IsBackground() const OVERRIDE; | 367 virtual bool IsBackground() const OVERRIDE; |
362 | 368 |
363 private: | 369 private: |
364 // The icon painted for the extension process. | 370 // The icon painted for the extension process. |
365 static SkBitmap* default_icon_; | 371 static SkBitmap* default_icon_; |
366 | 372 |
367 ExtensionHost* extension_host_; | 373 ExtensionHost* extension_host_; |
368 | 374 |
369 // Cached data about the extension. | 375 // Cached data about the extension. |
370 base::ProcessHandle process_handle_; | 376 base::ProcessHandle process_handle_; |
371 int pid_; | 377 int pid_; |
| 378 int unique_process_id_; |
372 string16 title_; | 379 string16 title_; |
373 | 380 |
374 DISALLOW_COPY_AND_ASSIGN(TaskManagerExtensionProcessResource); | 381 DISALLOW_COPY_AND_ASSIGN(TaskManagerExtensionProcessResource); |
375 }; | 382 }; |
376 | 383 |
377 class TaskManagerExtensionProcessResourceProvider | 384 class TaskManagerExtensionProcessResourceProvider |
378 : public TaskManager::ResourceProvider, | 385 : public TaskManager::ResourceProvider, |
379 public content::NotificationObserver { | 386 public content::NotificationObserver { |
380 public: | 387 public: |
381 explicit TaskManagerExtensionProcessResourceProvider( | 388 explicit TaskManagerExtensionProcessResourceProvider( |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 class TaskManagerNotificationResource : public TaskManager::Resource { | 425 class TaskManagerNotificationResource : public TaskManager::Resource { |
419 public: | 426 public: |
420 explicit TaskManagerNotificationResource(BalloonHost* balloon_host); | 427 explicit TaskManagerNotificationResource(BalloonHost* balloon_host); |
421 virtual ~TaskManagerNotificationResource(); | 428 virtual ~TaskManagerNotificationResource(); |
422 | 429 |
423 // TaskManager::Resource interface | 430 // TaskManager::Resource interface |
424 virtual string16 GetTitle() const OVERRIDE; | 431 virtual string16 GetTitle() const OVERRIDE; |
425 virtual string16 GetProfileName() const OVERRIDE; | 432 virtual string16 GetProfileName() const OVERRIDE; |
426 virtual SkBitmap GetIcon() const OVERRIDE; | 433 virtual SkBitmap GetIcon() const OVERRIDE; |
427 virtual base::ProcessHandle GetProcess() const OVERRIDE; | 434 virtual base::ProcessHandle GetProcess() const OVERRIDE; |
| 435 virtual int GetUniqueChildProcessId() const OVERRIDE; |
428 virtual Type GetType() const OVERRIDE; | 436 virtual Type GetType() const OVERRIDE; |
429 virtual bool CanInspect() const OVERRIDE; | 437 virtual bool CanInspect() const OVERRIDE; |
430 virtual void Inspect() const OVERRIDE; | 438 virtual void Inspect() const OVERRIDE; |
431 virtual bool SupportNetworkUsage() const OVERRIDE; | 439 virtual bool SupportNetworkUsage() const OVERRIDE; |
432 virtual void SetSupportNetworkUsage() OVERRIDE { } | 440 virtual void SetSupportNetworkUsage() OVERRIDE { } |
433 | 441 |
434 private: | 442 private: |
435 // The icon painted for notifications. . | 443 // The icon painted for notifications. . |
436 static SkBitmap* default_icon_; | 444 static SkBitmap* default_icon_; |
437 | 445 |
438 // Non-owned pointer to the balloon host. | 446 // Non-owned pointer to the balloon host. |
439 BalloonHost* balloon_host_; | 447 BalloonHost* balloon_host_; |
440 | 448 |
441 // Cached data about the balloon host. | 449 // Cached data about the balloon host. |
442 base::ProcessHandle process_handle_; | 450 base::ProcessHandle process_handle_; |
443 int pid_; | 451 int pid_; |
| 452 int unique_process_id_; |
444 string16 title_; | 453 string16 title_; |
445 | 454 |
446 DISALLOW_COPY_AND_ASSIGN(TaskManagerNotificationResource); | 455 DISALLOW_COPY_AND_ASSIGN(TaskManagerNotificationResource); |
447 }; | 456 }; |
448 | 457 |
449 class TaskManagerNotificationResourceProvider | 458 class TaskManagerNotificationResourceProvider |
450 : public TaskManager::ResourceProvider, | 459 : public TaskManager::ResourceProvider, |
451 public content::NotificationObserver { | 460 public content::NotificationObserver { |
452 public: | 461 public: |
453 static TaskManagerNotificationResourceProvider* Create( | 462 static TaskManagerNotificationResourceProvider* Create( |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 class TaskManagerBrowserProcessResource : public TaskManager::Resource { | 497 class TaskManagerBrowserProcessResource : public TaskManager::Resource { |
489 public: | 498 public: |
490 TaskManagerBrowserProcessResource(); | 499 TaskManagerBrowserProcessResource(); |
491 virtual ~TaskManagerBrowserProcessResource(); | 500 virtual ~TaskManagerBrowserProcessResource(); |
492 | 501 |
493 // TaskManager::Resource methods: | 502 // TaskManager::Resource methods: |
494 virtual string16 GetTitle() const OVERRIDE; | 503 virtual string16 GetTitle() const OVERRIDE; |
495 virtual string16 GetProfileName() const OVERRIDE; | 504 virtual string16 GetProfileName() const OVERRIDE; |
496 virtual SkBitmap GetIcon() const OVERRIDE; | 505 virtual SkBitmap GetIcon() const OVERRIDE; |
497 virtual base::ProcessHandle GetProcess() const OVERRIDE; | 506 virtual base::ProcessHandle GetProcess() const OVERRIDE; |
| 507 virtual int GetUniqueChildProcessId() const OVERRIDE; |
498 virtual Type GetType() const OVERRIDE; | 508 virtual Type GetType() const OVERRIDE; |
499 | 509 |
500 virtual bool SupportNetworkUsage() const OVERRIDE; | 510 virtual bool SupportNetworkUsage() const OVERRIDE; |
501 virtual void SetSupportNetworkUsage() OVERRIDE; | 511 virtual void SetSupportNetworkUsage() OVERRIDE; |
502 | 512 |
503 virtual bool ReportsSqliteMemoryUsed() const OVERRIDE; | 513 virtual bool ReportsSqliteMemoryUsed() const OVERRIDE; |
504 virtual size_t SqliteMemoryUsedBytes() const OVERRIDE; | 514 virtual size_t SqliteMemoryUsedBytes() const OVERRIDE; |
505 | 515 |
506 virtual bool ReportsV8MemoryStats() const OVERRIDE; | 516 virtual bool ReportsV8MemoryStats() const OVERRIDE; |
507 virtual size_t GetV8MemoryAllocated() const OVERRIDE; | 517 virtual size_t GetV8MemoryAllocated() const OVERRIDE; |
(...skipping 27 matching lines...) Expand all Loading... |
535 private: | 545 private: |
536 virtual ~TaskManagerBrowserProcessResourceProvider(); | 546 virtual ~TaskManagerBrowserProcessResourceProvider(); |
537 | 547 |
538 TaskManager* task_manager_; | 548 TaskManager* task_manager_; |
539 TaskManagerBrowserProcessResource resource_; | 549 TaskManagerBrowserProcessResource resource_; |
540 | 550 |
541 DISALLOW_COPY_AND_ASSIGN(TaskManagerBrowserProcessResourceProvider); | 551 DISALLOW_COPY_AND_ASSIGN(TaskManagerBrowserProcessResourceProvider); |
542 }; | 552 }; |
543 | 553 |
544 #endif // CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_RESOURCE_PROVIDERS_H_ | 554 #endif // CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_RESOURCE_PROVIDERS_H_ |
OLD | NEW |