Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(188)

Side by Side Diff: chrome/browser/task_manager/task_manager_resource_providers.h

Issue 10533070: TabContentsWrapper -> TabContents, part 31. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 TabContents; 24 class TabContents;
25 typedef TabContents TabContentsWrapper;
26 25
27 namespace content { 26 namespace content {
28 class RenderViewHost; 27 class RenderViewHost;
29 } 28 }
30 29
31 namespace extensions { 30 namespace extensions {
32 class Extension; 31 class Extension;
33 } 32 }
34 33
35 // These file contains the resource providers used in the task manager. 34 // These file contains the resource providers used in the task manager.
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 // We do a similar dance to gather the V8 memory usage in a process. 95 // We do a similar dance to gather the V8 memory usage in a process.
97 size_t v8_memory_allocated_; 96 size_t v8_memory_allocated_;
98 size_t v8_memory_used_; 97 size_t v8_memory_used_;
99 bool pending_v8_memory_allocated_update_; 98 bool pending_v8_memory_allocated_update_;
100 99
101 DISALLOW_COPY_AND_ASSIGN(TaskManagerRendererResource); 100 DISALLOW_COPY_AND_ASSIGN(TaskManagerRendererResource);
102 }; 101 };
103 102
104 class TaskManagerTabContentsResource : public TaskManagerRendererResource { 103 class TaskManagerTabContentsResource : public TaskManagerRendererResource {
105 public: 104 public:
106 explicit TaskManagerTabContentsResource(TabContentsWrapper* tab_contents); 105 explicit TaskManagerTabContentsResource(TabContents* tab_contents);
107 virtual ~TaskManagerTabContentsResource(); 106 virtual ~TaskManagerTabContentsResource();
108 107
109 // Called when the underlying tab_contents has been committed, and is thus no 108 // Called when the underlying tab_contents has been committed, and is thus no
110 // longer an Instant preview. 109 // longer an Instant preview.
111 void InstantCommitted(); 110 void InstantCommitted();
112 111
113 // TaskManager::Resource methods: 112 // TaskManager::Resource methods:
114 virtual Type GetType() const OVERRIDE; 113 virtual Type GetType() const OVERRIDE;
115 virtual string16 GetTitle() const OVERRIDE; 114 virtual string16 GetTitle() const OVERRIDE;
116 virtual string16 GetProfileName() const OVERRIDE; 115 virtual string16 GetProfileName() const OVERRIDE;
117 virtual gfx::ImageSkia GetIcon() const OVERRIDE; 116 virtual gfx::ImageSkia GetIcon() const OVERRIDE;
118 virtual TabContentsWrapper* GetTabContents() const OVERRIDE; 117 virtual TabContents* GetTabContents() const OVERRIDE;
119 virtual const extensions::Extension* GetExtension() const OVERRIDE; 118 virtual const extensions::Extension* GetExtension() const OVERRIDE;
120 119
121 private: 120 private:
122 bool IsPrerendering() const; 121 bool IsPrerendering() const;
123 122
124 // Returns true if contains content rendered by an extension. 123 // Returns true if contains content rendered by an extension.
125 bool HostsExtension() const; 124 bool HostsExtension() const;
126 125
127 static gfx::ImageSkia* prerender_icon_; 126 static gfx::ImageSkia* prerender_icon_;
128 TabContentsWrapper* tab_contents_; 127 TabContents* tab_contents_;
129 bool is_instant_preview_; 128 bool is_instant_preview_;
130 129
131 DISALLOW_COPY_AND_ASSIGN(TaskManagerTabContentsResource); 130 DISALLOW_COPY_AND_ASSIGN(TaskManagerTabContentsResource);
132 }; 131 };
133 132
134 class TaskManagerTabContentsResourceProvider 133 class TaskManagerTabContentsResourceProvider
135 : public TaskManager::ResourceProvider, 134 : public TaskManager::ResourceProvider,
136 public content::NotificationObserver { 135 public content::NotificationObserver {
137 public: 136 public:
138 explicit TaskManagerTabContentsResourceProvider(TaskManager* task_manager); 137 explicit TaskManagerTabContentsResourceProvider(TaskManager* task_manager);
139 138
140 virtual TaskManager::Resource* GetResource(int origin_pid, 139 virtual TaskManager::Resource* GetResource(int origin_pid,
141 int render_process_host_id, 140 int render_process_host_id,
142 int routing_id) OVERRIDE; 141 int routing_id) OVERRIDE;
143 virtual void StartUpdating() OVERRIDE; 142 virtual void StartUpdating() OVERRIDE;
144 virtual void StopUpdating() OVERRIDE; 143 virtual void StopUpdating() OVERRIDE;
145 144
146 // content::NotificationObserver method: 145 // content::NotificationObserver method:
147 virtual void Observe(int type, 146 virtual void Observe(int type,
148 const content::NotificationSource& source, 147 const content::NotificationSource& source,
149 const content::NotificationDetails& details) OVERRIDE; 148 const content::NotificationDetails& details) OVERRIDE;
150 149
151 private: 150 private:
152 virtual ~TaskManagerTabContentsResourceProvider(); 151 virtual ~TaskManagerTabContentsResourceProvider();
153 152
154 void Add(TabContentsWrapper* tab_contents); 153 void Add(TabContents* tab_contents);
155 void Remove(TabContentsWrapper* tab_contents); 154 void Remove(TabContents* tab_contents);
156 void Update(TabContentsWrapper* tab_contents); 155 void Update(TabContents* tab_contents);
157 156
158 void AddToTaskManager(TabContentsWrapper* tab_contents); 157 void AddToTaskManager(TabContents* tab_contents);
159 158
160 // Whether we are currently reporting to the task manager. Used to ignore 159 // Whether we are currently reporting to the task manager. Used to ignore
161 // notifications sent after StopUpdating(). 160 // notifications sent after StopUpdating().
162 bool updating_; 161 bool updating_;
163 162
164 TaskManager* task_manager_; 163 TaskManager* task_manager_;
165 164
166 // Maps the actual resources (the TabContentsWrappers) to the Task Manager 165 // Maps the actual resources (the TabContentses) to the Task Manager
167 // resources. 166 // resources.
168 std::map<TabContentsWrapper*, TaskManagerTabContentsResource*> resources_; 167 std::map<TabContents*, TaskManagerTabContentsResource*> resources_;
169 168
170 // A scoped container for notification registries. 169 // A scoped container for notification registries.
171 content::NotificationRegistrar registrar_; 170 content::NotificationRegistrar registrar_;
172 171
173 DISALLOW_COPY_AND_ASSIGN(TaskManagerTabContentsResourceProvider); 172 DISALLOW_COPY_AND_ASSIGN(TaskManagerTabContentsResourceProvider);
174 }; 173 };
175 174
176 class TaskManagerBackgroundContentsResource 175 class TaskManagerBackgroundContentsResource
177 : public TaskManagerRendererResource { 176 : public TaskManagerRendererResource {
178 public: 177 public:
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 private: 551 private:
553 virtual ~TaskManagerBrowserProcessResourceProvider(); 552 virtual ~TaskManagerBrowserProcessResourceProvider();
554 553
555 TaskManager* task_manager_; 554 TaskManager* task_manager_;
556 TaskManagerBrowserProcessResource resource_; 555 TaskManagerBrowserProcessResource resource_;
557 556
558 DISALLOW_COPY_AND_ASSIGN(TaskManagerBrowserProcessResourceProvider); 557 DISALLOW_COPY_AND_ASSIGN(TaskManagerBrowserProcessResourceProvider);
559 }; 558 };
560 559
561 #endif // CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_RESOURCE_PROVIDERS_H_ 560 #endif // CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_RESOURCE_PROVIDERS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698