| 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> |
| 11 | 11 |
| 12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
| 14 #include "base/process_util.h" | 14 #include "base/process_util.h" |
| 15 #include "chrome/browser/task_manager/task_manager.h" | 15 #include "chrome/browser/task_manager/task_manager.h" |
| 16 #include "content/public/browser/child_process_data.h" | 16 #include "content/public/browser/child_process_data.h" |
| 17 #include "content/public/browser/notification_observer.h" | 17 #include "content/public/browser/notification_observer.h" |
| 18 #include "content/public/browser/notification_registrar.h" | 18 #include "content/public/browser/notification_registrar.h" |
| 19 #include "content/public/common/process_type.h" | 19 #include "content/public/common/process_type.h" |
| 20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCache.h" | 20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCache.h" |
| 21 | 21 |
| 22 class BackgroundContents; | 22 class BackgroundContents; |
| 23 class BalloonHost; | 23 class BalloonHost; |
| 24 class Extension; | 24 class Extension; |
| 25 class ExtensionHost; | |
| 26 class TabContentsWrapper; | 25 class TabContentsWrapper; |
| 27 | 26 |
| 28 namespace content { | 27 namespace content { |
| 29 class RenderViewHost; | 28 class RenderViewHost; |
| 30 } | 29 } |
| 31 | 30 |
| 32 // These file contains the resource providers used in the task manager. | 31 // These file contains the resource providers used in the task manager. |
| 33 | 32 |
| 34 // Base class for various types of render process resources that provides common | 33 // Base class for various types of render process resources that provides common |
| 35 // functionality like stats tracking. | 34 // functionality like stats tracking. |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 PidResourceMap pid_to_resources_; | 336 PidResourceMap pid_to_resources_; |
| 338 | 337 |
| 339 // A scoped container for notification registries. | 338 // A scoped container for notification registries. |
| 340 content::NotificationRegistrar registrar_; | 339 content::NotificationRegistrar registrar_; |
| 341 | 340 |
| 342 DISALLOW_COPY_AND_ASSIGN(TaskManagerChildProcessResourceProvider); | 341 DISALLOW_COPY_AND_ASSIGN(TaskManagerChildProcessResourceProvider); |
| 343 }; | 342 }; |
| 344 | 343 |
| 345 class TaskManagerExtensionProcessResource : public TaskManager::Resource { | 344 class TaskManagerExtensionProcessResource : public TaskManager::Resource { |
| 346 public: | 345 public: |
| 347 explicit TaskManagerExtensionProcessResource(ExtensionHost* extension_host); | 346 explicit TaskManagerExtensionProcessResource( |
| 347 content::RenderViewHost* render_view_host); |
| 348 virtual ~TaskManagerExtensionProcessResource(); | 348 virtual ~TaskManagerExtensionProcessResource(); |
| 349 | 349 |
| 350 // TaskManager::Resource methods: | 350 // TaskManager::Resource methods: |
| 351 virtual string16 GetTitle() const OVERRIDE; | 351 virtual string16 GetTitle() const OVERRIDE; |
| 352 virtual string16 GetProfileName() const OVERRIDE; | 352 virtual string16 GetProfileName() const OVERRIDE; |
| 353 virtual SkBitmap GetIcon() const OVERRIDE; | 353 virtual SkBitmap GetIcon() const OVERRIDE; |
| 354 virtual base::ProcessHandle GetProcess() const OVERRIDE; | 354 virtual base::ProcessHandle GetProcess() const OVERRIDE; |
| 355 virtual int GetUniqueChildProcessId() const OVERRIDE; | 355 virtual int GetUniqueChildProcessId() const OVERRIDE; |
| 356 virtual Type GetType() const OVERRIDE; | 356 virtual Type GetType() const OVERRIDE; |
| 357 virtual bool CanInspect() const OVERRIDE; | 357 virtual bool CanInspect() const OVERRIDE; |
| 358 virtual void Inspect() const OVERRIDE; | 358 virtual void Inspect() const OVERRIDE; |
| 359 virtual bool SupportNetworkUsage() const OVERRIDE; | 359 virtual bool SupportNetworkUsage() const OVERRIDE; |
| 360 virtual void SetSupportNetworkUsage() OVERRIDE; | 360 virtual void SetSupportNetworkUsage() OVERRIDE; |
| 361 virtual const Extension* GetExtension() const OVERRIDE; | 361 virtual const Extension* GetExtension() const OVERRIDE; |
| 362 | 362 |
| 363 // Returns the pid of the extension process. | 363 // Returns the pid of the extension process. |
| 364 int process_id() const { return pid_; } | 364 int process_id() const { return pid_; } |
| 365 | 365 |
| 366 // Returns true if the associated extension has a background page. | 366 // Returns true if the associated extension has a background page. |
| 367 virtual bool IsBackground() const OVERRIDE; | 367 virtual bool IsBackground() const OVERRIDE; |
| 368 | 368 |
| 369 private: | 369 private: |
| 370 // The icon painted for the extension process. | 370 // The icon painted for the extension process. |
| 371 static SkBitmap* default_icon_; | 371 static SkBitmap* default_icon_; |
| 372 | 372 |
| 373 ExtensionHost* extension_host_; | 373 content::RenderViewHost* render_view_host_; |
| 374 | 374 |
| 375 // Cached data about the extension. | 375 // Cached data about the extension. |
| 376 base::ProcessHandle process_handle_; | 376 base::ProcessHandle process_handle_; |
| 377 int pid_; | 377 int pid_; |
| 378 int unique_process_id_; | 378 int unique_process_id_; |
| 379 string16 title_; | 379 string16 title_; |
| 380 | 380 |
| 381 DISALLOW_COPY_AND_ASSIGN(TaskManagerExtensionProcessResource); | 381 DISALLOW_COPY_AND_ASSIGN(TaskManagerExtensionProcessResource); |
| 382 }; | 382 }; |
| 383 | 383 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 395 virtual void StopUpdating() OVERRIDE; | 395 virtual void StopUpdating() OVERRIDE; |
| 396 | 396 |
| 397 // content::NotificationObserver method: | 397 // content::NotificationObserver method: |
| 398 virtual void Observe(int type, | 398 virtual void Observe(int type, |
| 399 const content::NotificationSource& source, | 399 const content::NotificationSource& source, |
| 400 const content::NotificationDetails& details) OVERRIDE; | 400 const content::NotificationDetails& details) OVERRIDE; |
| 401 | 401 |
| 402 private: | 402 private: |
| 403 virtual ~TaskManagerExtensionProcessResourceProvider(); | 403 virtual ~TaskManagerExtensionProcessResourceProvider(); |
| 404 | 404 |
| 405 void AddToTaskManager(ExtensionHost* extension_host); | 405 void AddToTaskManager(content::RenderViewHost* render_view_host); |
| 406 void RemoveFromTaskManager(ExtensionHost* extension_host); | 406 void RemoveFromTaskManager(content::RenderViewHost* render_view_host); |
| 407 | 407 |
| 408 TaskManager* task_manager_; | 408 TaskManager* task_manager_; |
| 409 | 409 |
| 410 // Maps the actual resources (ExtensionHost*) to the Task Manager resources. | 410 // Maps the actual resources (content::RenderViewHost*) to the Task Manager |
| 411 std::map<ExtensionHost*, TaskManagerExtensionProcessResource*> resources_; | 411 // resources. |
| 412 std::map<content::RenderViewHost*, |
| 413 TaskManagerExtensionProcessResource*> resources_; |
| 412 | 414 |
| 413 // Maps the pids to the resources (used for quick access to the resource on | 415 // Maps the pids to the resources (used for quick access to the resource on |
| 414 // byte read notifications). | 416 // byte read notifications). |
| 415 std::map<int, TaskManagerExtensionProcessResource*> pid_to_resources_; | 417 std::map<int, TaskManagerExtensionProcessResource*> pid_to_resources_; |
| 416 | 418 |
| 417 // A scoped container for notification registries. | 419 // A scoped container for notification registries. |
| 418 content::NotificationRegistrar registrar_; | 420 content::NotificationRegistrar registrar_; |
| 419 | 421 |
| 420 bool updating_; | 422 bool updating_; |
| 421 | 423 |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 545 private: | 547 private: |
| 546 virtual ~TaskManagerBrowserProcessResourceProvider(); | 548 virtual ~TaskManagerBrowserProcessResourceProvider(); |
| 547 | 549 |
| 548 TaskManager* task_manager_; | 550 TaskManager* task_manager_; |
| 549 TaskManagerBrowserProcessResource resource_; | 551 TaskManagerBrowserProcessResource resource_; |
| 550 | 552 |
| 551 DISALLOW_COPY_AND_ASSIGN(TaskManagerBrowserProcessResourceProvider); | 553 DISALLOW_COPY_AND_ASSIGN(TaskManagerBrowserProcessResourceProvider); |
| 552 }; | 554 }; |
| 553 | 555 |
| 554 #endif // CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_RESOURCE_PROVIDERS_H_ | 556 #endif // CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_RESOURCE_PROVIDERS_H_ |
| OLD | NEW |