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 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 int pid_; | 409 int pid_; |
410 string16 title_; | 410 string16 title_; |
411 | 411 |
412 DISALLOW_COPY_AND_ASSIGN(TaskManagerNotificationResource); | 412 DISALLOW_COPY_AND_ASSIGN(TaskManagerNotificationResource); |
413 }; | 413 }; |
414 | 414 |
415 class TaskManagerNotificationResourceProvider | 415 class TaskManagerNotificationResourceProvider |
416 : public TaskManager::ResourceProvider, | 416 : public TaskManager::ResourceProvider, |
417 public NotificationObserver { | 417 public NotificationObserver { |
418 public: | 418 public: |
419 explicit TaskManagerNotificationResourceProvider(TaskManager* task_manager); | 419 static TaskManagerNotificationResourceProvider* Create( |
| 420 TaskManager* task_manager); |
420 | 421 |
421 // TaskManager::ResourceProvider interface | 422 // TaskManager::ResourceProvider interface |
422 virtual TaskManager::Resource* GetResource(int origin_pid, | 423 virtual TaskManager::Resource* GetResource(int origin_pid, |
423 int render_process_host_id, | 424 int render_process_host_id, |
424 int routing_id); | 425 int routing_id); |
425 virtual void StartUpdating(); | 426 virtual void StartUpdating(); |
426 virtual void StopUpdating(); | 427 virtual void StopUpdating(); |
427 | 428 |
428 // NotificationObserver interface | 429 // NotificationObserver interface |
429 virtual void Observe(NotificationType type, | 430 virtual void Observe(NotificationType type, |
430 const NotificationSource& source, | 431 const NotificationSource& source, |
431 const NotificationDetails& details); | 432 const NotificationDetails& details); |
432 | 433 |
433 private: | 434 private: |
| 435 explicit TaskManagerNotificationResourceProvider(TaskManager* task_manager); |
434 virtual ~TaskManagerNotificationResourceProvider(); | 436 virtual ~TaskManagerNotificationResourceProvider(); |
435 | 437 |
436 void AddToTaskManager(BalloonHost* balloon_host); | 438 void AddToTaskManager(BalloonHost* balloon_host); |
437 void RemoveFromTaskManager(BalloonHost* balloon_host); | 439 void RemoveFromTaskManager(BalloonHost* balloon_host); |
438 | 440 |
439 TaskManager* task_manager_; | 441 TaskManager* task_manager_; |
440 | 442 |
441 // Maps the actual resources (BalloonHost*) to the Task Manager resources. | 443 // Maps the actual resources (BalloonHost*) to the Task Manager resources. |
442 std::map<BalloonHost*, TaskManagerNotificationResource*> resources_; | 444 std::map<BalloonHost*, TaskManagerNotificationResource*> resources_; |
443 | 445 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 | 502 |
501 void AddToTaskManager(ChildProcessInfo child_process_info); | 503 void AddToTaskManager(ChildProcessInfo child_process_info); |
502 | 504 |
503 TaskManager* task_manager_; | 505 TaskManager* task_manager_; |
504 TaskManagerBrowserProcessResource resource_; | 506 TaskManagerBrowserProcessResource resource_; |
505 | 507 |
506 DISALLOW_COPY_AND_ASSIGN(TaskManagerBrowserProcessResourceProvider); | 508 DISALLOW_COPY_AND_ASSIGN(TaskManagerBrowserProcessResourceProvider); |
507 }; | 509 }; |
508 | 510 |
509 #endif // CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_RESOURCE_PROVIDERS_H_ | 511 #endif // CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_RESOURCE_PROVIDERS_H_ |
OLD | NEW |