| 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 bool pending_v8_memory_allocated_update_; | 90 bool pending_v8_memory_allocated_update_; |
| 91 | 91 |
| 92 DISALLOW_COPY_AND_ASSIGN(TaskManagerRendererResource); | 92 DISALLOW_COPY_AND_ASSIGN(TaskManagerRendererResource); |
| 93 }; | 93 }; |
| 94 | 94 |
| 95 class TaskManagerTabContentsResource : public TaskManagerRendererResource { | 95 class TaskManagerTabContentsResource : public TaskManagerRendererResource { |
| 96 public: | 96 public: |
| 97 explicit TaskManagerTabContentsResource(TabContentsWrapper* tab_contents); | 97 explicit TaskManagerTabContentsResource(TabContentsWrapper* tab_contents); |
| 98 virtual ~TaskManagerTabContentsResource(); | 98 virtual ~TaskManagerTabContentsResource(); |
| 99 | 99 |
| 100 // Called when the underlying tab_contents has been committed, and is thus no |
| 101 // longer an Instant preview. |
| 102 void InstantCommitted(); |
| 103 |
| 100 // TaskManager::Resource methods: | 104 // TaskManager::Resource methods: |
| 101 virtual Type GetType() const OVERRIDE; | 105 virtual Type GetType() const OVERRIDE; |
| 102 virtual string16 GetTitle() const OVERRIDE; | 106 virtual string16 GetTitle() const OVERRIDE; |
| 103 virtual string16 GetProfileName() const OVERRIDE; | 107 virtual string16 GetProfileName() const OVERRIDE; |
| 104 virtual SkBitmap GetIcon() const OVERRIDE; | 108 virtual SkBitmap GetIcon() const OVERRIDE; |
| 105 virtual TabContentsWrapper* GetTabContents() const OVERRIDE; | 109 virtual TabContentsWrapper* GetTabContents() const OVERRIDE; |
| 106 virtual const Extension* GetExtension() const OVERRIDE; | 110 virtual const Extension* GetExtension() const OVERRIDE; |
| 107 | 111 |
| 108 private: | 112 private: |
| 109 bool IsPrerendering() const; | 113 bool IsPrerendering() const; |
| 110 | 114 |
| 111 // Returns true if contains content rendered by an extension. | 115 // Returns true if contains content rendered by an extension. |
| 112 bool HostsExtension() const; | 116 bool HostsExtension() const; |
| 113 | 117 |
| 114 static SkBitmap* prerender_icon_; | 118 static SkBitmap* prerender_icon_; |
| 115 TabContentsWrapper* tab_contents_; | 119 TabContentsWrapper* tab_contents_; |
| 120 bool is_instant_preview_; |
| 116 | 121 |
| 117 DISALLOW_COPY_AND_ASSIGN(TaskManagerTabContentsResource); | 122 DISALLOW_COPY_AND_ASSIGN(TaskManagerTabContentsResource); |
| 118 }; | 123 }; |
| 119 | 124 |
| 120 class TaskManagerTabContentsResourceProvider | 125 class TaskManagerTabContentsResourceProvider |
| 121 : public TaskManager::ResourceProvider, | 126 : public TaskManager::ResourceProvider, |
| 122 public content::NotificationObserver { | 127 public content::NotificationObserver { |
| 123 public: | 128 public: |
| 124 explicit TaskManagerTabContentsResourceProvider(TaskManager* task_manager); | 129 explicit TaskManagerTabContentsResourceProvider(TaskManager* task_manager); |
| 125 | 130 |
| 126 virtual TaskManager::Resource* GetResource(int origin_pid, | 131 virtual TaskManager::Resource* GetResource(int origin_pid, |
| 127 int render_process_host_id, | 132 int render_process_host_id, |
| 128 int routing_id) OVERRIDE; | 133 int routing_id) OVERRIDE; |
| 129 virtual void StartUpdating() OVERRIDE; | 134 virtual void StartUpdating() OVERRIDE; |
| 130 virtual void StopUpdating() OVERRIDE; | 135 virtual void StopUpdating() OVERRIDE; |
| 131 | 136 |
| 132 // content::NotificationObserver method: | 137 // content::NotificationObserver method: |
| 133 virtual void Observe(int type, | 138 virtual void Observe(int type, |
| 134 const content::NotificationSource& source, | 139 const content::NotificationSource& source, |
| 135 const content::NotificationDetails& details) OVERRIDE; | 140 const content::NotificationDetails& details) OVERRIDE; |
| 136 | 141 |
| 137 private: | 142 private: |
| 138 virtual ~TaskManagerTabContentsResourceProvider(); | 143 virtual ~TaskManagerTabContentsResourceProvider(); |
| 139 | 144 |
| 140 void Add(TabContentsWrapper* tab_contents); | 145 void Add(TabContentsWrapper* tab_contents); |
| 141 void Remove(TabContentsWrapper* tab_contents); | 146 void Remove(TabContentsWrapper* tab_contents); |
| 147 void Update(TabContentsWrapper* tab_contents); |
| 142 | 148 |
| 143 void AddToTaskManager(TabContentsWrapper* tab_contents); | 149 void AddToTaskManager(TabContentsWrapper* tab_contents); |
| 144 | 150 |
| 145 // Whether we are currently reporting to the task manager. Used to ignore | 151 // Whether we are currently reporting to the task manager. Used to ignore |
| 146 // notifications sent after StopUpdating(). | 152 // notifications sent after StopUpdating(). |
| 147 bool updating_; | 153 bool updating_; |
| 148 | 154 |
| 149 TaskManager* task_manager_; | 155 TaskManager* task_manager_; |
| 150 | 156 |
| 151 // Maps the actual resources (the TabContentsWrappers) to the Task Manager | 157 // Maps the actual resources (the TabContentsWrappers) to the Task Manager |
| (...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 520 | 526 |
| 521 void AddToTaskManager(ChildProcessInfo child_process_info); | 527 void AddToTaskManager(ChildProcessInfo child_process_info); |
| 522 | 528 |
| 523 TaskManager* task_manager_; | 529 TaskManager* task_manager_; |
| 524 TaskManagerBrowserProcessResource resource_; | 530 TaskManagerBrowserProcessResource resource_; |
| 525 | 531 |
| 526 DISALLOW_COPY_AND_ASSIGN(TaskManagerBrowserProcessResourceProvider); | 532 DISALLOW_COPY_AND_ASSIGN(TaskManagerBrowserProcessResourceProvider); |
| 527 }; | 533 }; |
| 528 | 534 |
| 529 #endif // CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_RESOURCE_PROVIDERS_H_ | 535 #endif // CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_RESOURCE_PROVIDERS_H_ |
| OLD | NEW |