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 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/process_util.h" | 13 #include "base/process_util.h" |
14 #include "chrome/browser/task_manager/task_manager.h" | 14 #include "chrome/browser/task_manager/task_manager.h" |
| 15 #include "content/public/browser/browser_child_process_observer.h" |
15 #include "content/public/browser/child_process_data.h" | 16 #include "content/public/browser/child_process_data.h" |
16 #include "content/public/browser/notification_observer.h" | 17 #include "content/public/browser/notification_observer.h" |
17 #include "content/public/browser/notification_registrar.h" | 18 #include "content/public/browser/notification_registrar.h" |
18 #include "content/public/common/process_type.h" | 19 #include "content/public/common/process_type.h" |
19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCache.h" | 20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCache.h" |
20 | 21 |
21 class BackgroundContents; | 22 class BackgroundContents; |
22 class BalloonHost; | 23 class BalloonHost; |
23 class Panel; | 24 class Panel; |
24 class Profile; | 25 class Profile; |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 // The icon painted for the child processs. | 353 // The icon painted for the child processs. |
353 // TODO(jcampan): we should have plugin specific icons for well-known | 354 // TODO(jcampan): we should have plugin specific icons for well-known |
354 // plugins. | 355 // plugins. |
355 static gfx::ImageSkia* default_icon_; | 356 static gfx::ImageSkia* default_icon_; |
356 | 357 |
357 DISALLOW_COPY_AND_ASSIGN(TaskManagerChildProcessResource); | 358 DISALLOW_COPY_AND_ASSIGN(TaskManagerChildProcessResource); |
358 }; | 359 }; |
359 | 360 |
360 class TaskManagerChildProcessResourceProvider | 361 class TaskManagerChildProcessResourceProvider |
361 : public TaskManager::ResourceProvider, | 362 : public TaskManager::ResourceProvider, |
362 public content::NotificationObserver { | 363 public content::BrowserChildProcessObserver { |
363 public: | 364 public: |
364 explicit TaskManagerChildProcessResourceProvider(TaskManager* task_manager); | 365 explicit TaskManagerChildProcessResourceProvider(TaskManager* task_manager); |
365 | 366 |
366 virtual TaskManager::Resource* GetResource(int origin_pid, | 367 virtual TaskManager::Resource* GetResource(int origin_pid, |
367 int render_process_host_id, | 368 int render_process_host_id, |
368 int routing_id) OVERRIDE; | 369 int routing_id) OVERRIDE; |
369 virtual void StartUpdating() OVERRIDE; | 370 virtual void StartUpdating() OVERRIDE; |
370 virtual void StopUpdating() OVERRIDE; | 371 virtual void StopUpdating() OVERRIDE; |
371 | 372 |
372 // content::NotificationObserver method: | 373 // content::BrowserChildProcessObserver methods: |
373 virtual void Observe(int type, | 374 virtual void BrowserChildProcessHostConnected( |
374 const content::NotificationSource& source, | 375 const content::ChildProcessData& data) OVERRIDE; |
375 const content::NotificationDetails& details) OVERRIDE; | 376 virtual void BrowserChildProcessHostDisconnected( |
| 377 const content::ChildProcessData& data) OVERRIDE; |
376 | 378 |
377 private: | 379 private: |
378 virtual ~TaskManagerChildProcessResourceProvider(); | 380 virtual ~TaskManagerChildProcessResourceProvider(); |
379 | 381 |
380 // Retrieves information about the running ChildProcessHosts (performed in the | 382 // Retrieves information about the running ChildProcessHosts (performed in the |
381 // IO thread). | 383 // IO thread). |
382 virtual void RetrieveChildProcessData(); | 384 virtual void RetrieveChildProcessData(); |
383 | 385 |
384 // Notifies the UI thread that the ChildProcessHosts information have been | 386 // Notifies the UI thread that the ChildProcessHosts information have been |
385 // retrieved. | 387 // retrieved. |
386 virtual void ChildProcessDataRetreived( | 388 virtual void ChildProcessDataRetreived( |
387 const std::vector<content::ChildProcessData>& child_processes); | 389 const std::vector<content::ChildProcessData>& child_processes); |
388 | 390 |
389 void Add(const content::ChildProcessData& child_process_data); | |
390 void Remove(const content::ChildProcessData& child_process_data); | |
391 | |
392 void AddToTaskManager(const content::ChildProcessData& child_process_data); | 391 void AddToTaskManager(const content::ChildProcessData& child_process_data); |
393 | 392 |
394 TaskManager* task_manager_; | 393 TaskManager* task_manager_; |
395 | 394 |
396 // Whether we are currently reporting to the task manager. Used to ignore | 395 // Whether we are currently reporting to the task manager. Used to ignore |
397 // notifications sent after StopUpdating(). | 396 // notifications sent after StopUpdating(). |
398 bool updating_; | 397 bool updating_; |
399 | 398 |
400 // Maps the actual resources (the ChildProcessData) to the Task Manager | 399 // Maps the actual resources (the ChildProcessData) to the Task Manager |
401 // resources. | 400 // resources. |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
676 TaskManagerGuestResource*> GuestResourceMap; | 675 TaskManagerGuestResource*> GuestResourceMap; |
677 GuestResourceMap resources_; | 676 GuestResourceMap resources_; |
678 | 677 |
679 // A scoped container for notification registries. | 678 // A scoped container for notification registries. |
680 content::NotificationRegistrar registrar_; | 679 content::NotificationRegistrar registrar_; |
681 | 680 |
682 DISALLOW_COPY_AND_ASSIGN(TaskManagerGuestResourceProvider); | 681 DISALLOW_COPY_AND_ASSIGN(TaskManagerGuestResourceProvider); |
683 }; | 682 }; |
684 | 683 |
685 #endif // CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_RESOURCE_PROVIDERS_H_ | 684 #endif // CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_RESOURCE_PROVIDERS_H_ |
OLD | NEW |