Commit 813300cd authored by nick@chromium.org's avatar nick@chromium.org

TaskManager: Remove some unused/unnecessary methods.

What's removed:
 - The idea of unique_id's (these were for the now-gone webUI taskmanager).
 - The GetResourceExtension() method, which the tests no longer need.
 - The IsBackground getter, which is not used.

BUG=348836

Review URL: https://codereview.chromium.org/186153002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@255217 0039d316-1c4b-4281-b951-d872f2087c98
parent 1fdef0f9
...@@ -48,7 +48,6 @@ class BackgroundContentsResource : public RendererResource { ...@@ -48,7 +48,6 @@ class BackgroundContentsResource : public RendererResource {
virtual base::string16 GetTitle() const OVERRIDE; virtual base::string16 GetTitle() const OVERRIDE;
virtual base::string16 GetProfileName() const OVERRIDE; virtual base::string16 GetProfileName() const OVERRIDE;
virtual gfx::ImageSkia GetIcon() const OVERRIDE; virtual gfx::ImageSkia GetIcon() const OVERRIDE;
virtual bool IsBackground() const OVERRIDE;
const base::string16& application_name() const { return application_name_; } const base::string16& application_name() const { return application_name_; }
private: private:
...@@ -115,10 +114,6 @@ gfx::ImageSkia BackgroundContentsResource::GetIcon() const { ...@@ -115,10 +114,6 @@ gfx::ImageSkia BackgroundContentsResource::GetIcon() const {
return *default_icon_; return *default_icon_;
} }
bool BackgroundContentsResource::IsBackground() const {
return true;
}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// BackgroundContentsResourceProvider class // BackgroundContentsResourceProvider class
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
......
...@@ -53,15 +53,16 @@ class ExtensionProcessResource : public Resource { ...@@ -53,15 +53,16 @@ class ExtensionProcessResource : public Resource {
virtual void Inspect() const OVERRIDE; virtual void Inspect() const OVERRIDE;
virtual bool SupportNetworkUsage() const OVERRIDE; virtual bool SupportNetworkUsage() const OVERRIDE;
virtual void SetSupportNetworkUsage() OVERRIDE; virtual void SetSupportNetworkUsage() OVERRIDE;
virtual const extensions::Extension* GetExtension() const OVERRIDE;
// Returns the pid of the extension process. // Returns the pid of the extension process.
int process_id() const { return pid_; } int process_id() const { return pid_; }
private:
const extensions::Extension* GetExtension() const;
// Returns true if the associated extension has a background page. // Returns true if the associated extension has a background page.
virtual bool IsBackground() const OVERRIDE; bool IsBackground() const;
private:
// The icon painted for the extension process. // The icon painted for the extension process.
static gfx::ImageSkia* default_icon_; static gfx::ImageSkia* default_icon_;
......
...@@ -43,7 +43,6 @@ class GuestResource : public RendererResource { ...@@ -43,7 +43,6 @@ class GuestResource : public RendererResource {
virtual base::string16 GetProfileName() const OVERRIDE; virtual base::string16 GetProfileName() const OVERRIDE;
virtual gfx::ImageSkia GetIcon() const OVERRIDE; virtual gfx::ImageSkia GetIcon() const OVERRIDE;
virtual content::WebContents* GetWebContents() const OVERRIDE; virtual content::WebContents* GetWebContents() const OVERRIDE;
virtual const extensions::Extension* GetExtension() const OVERRIDE;
private: private:
DISALLOW_COPY_AND_ASSIGN(GuestResource); DISALLOW_COPY_AND_ASSIGN(GuestResource);
...@@ -95,10 +94,6 @@ WebContents* GuestResource::GetWebContents() const { ...@@ -95,10 +94,6 @@ WebContents* GuestResource::GetWebContents() const {
return WebContents::FromRenderViewHost(render_view_host()); return WebContents::FromRenderViewHost(render_view_host());
} }
const Extension* GuestResource::GetExtension() const {
return NULL;
}
GuestResourceProvider::GuestResourceProvider(TaskManager* task_manager) GuestResourceProvider::GuestResourceProvider(TaskManager* task_manager)
: updating_(false), : updating_(false),
task_manager_(task_manager) { task_manager_(task_manager) {
......
...@@ -41,7 +41,6 @@ class PanelResource : public RendererResource { ...@@ -41,7 +41,6 @@ class PanelResource : public RendererResource {
virtual base::string16 GetProfileName() const OVERRIDE; virtual base::string16 GetProfileName() const OVERRIDE;
virtual gfx::ImageSkia GetIcon() const OVERRIDE; virtual gfx::ImageSkia GetIcon() const OVERRIDE;
virtual content::WebContents* GetWebContents() const OVERRIDE; virtual content::WebContents* GetWebContents() const OVERRIDE;
virtual const extensions::Extension* GetExtension() const OVERRIDE;
private: private:
Panel* panel_; Panel* panel_;
...@@ -57,11 +56,12 @@ PanelResource::PanelResource(Panel* panel) ...@@ -57,11 +56,12 @@ PanelResource::PanelResource(Panel* panel)
panel->GetWebContents()->GetRenderProcessHost()->GetHandle(), panel->GetWebContents()->GetRenderProcessHost()->GetHandle(),
panel->GetWebContents()->GetRenderViewHost()), panel->GetWebContents()->GetRenderViewHost()),
panel_(panel) { panel_(panel) {
ExtensionService* service = panel_->profile()->GetExtensionService();
message_prefix_id_ = util::GetMessagePrefixID( message_prefix_id_ = util::GetMessagePrefixID(
GetExtension()->is_app(), service->extensions()->GetByID(panel_->extension_id())->is_app(),
true, // is_extension true, // is_extension
panel->profile()->IsOffTheRecord(), panel_->profile()->IsOffTheRecord(),
false, // is_prerender false, // is_prerender
false); // is_background false); // is_background
} }
...@@ -100,12 +100,6 @@ WebContents* PanelResource::GetWebContents() const { ...@@ -100,12 +100,6 @@ WebContents* PanelResource::GetWebContents() const {
return panel_->GetWebContents(); return panel_->GetWebContents();
} }
const Extension* PanelResource::GetExtension() const {
ExtensionService* extension_service =
panel_->profile()->GetExtensionService();
return extension_service->extensions()->GetByID(panel_->extension_id());
}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// PanelResourceProvider class // PanelResourceProvider class
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
......
...@@ -44,10 +44,6 @@ size_t Resource::SqliteMemoryUsedBytes() const { ...@@ -44,10 +44,6 @@ size_t Resource::SqliteMemoryUsedBytes() const {
return 0; return 0;
} }
const extensions::Extension* Resource::GetExtension() const {
return NULL;
}
bool Resource::ReportsV8MemoryStats() const { bool Resource::ReportsV8MemoryStats() const {
return false; return false;
} }
...@@ -72,8 +68,4 @@ content::WebContents* Resource::GetWebContents() const { ...@@ -72,8 +68,4 @@ content::WebContents* Resource::GetWebContents() const {
return NULL; return NULL;
} }
bool Resource::IsBackground() const {
return false;
}
} // namespace task_manager } // namespace task_manager
...@@ -73,9 +73,6 @@ class Resource { ...@@ -73,9 +73,6 @@ class Resource {
virtual bool ReportsSqliteMemoryUsed() const; virtual bool ReportsSqliteMemoryUsed() const;
virtual size_t SqliteMemoryUsedBytes() const; virtual size_t SqliteMemoryUsedBytes() const;
// Return extension associated with the resource, or NULL if not applicable.
virtual const extensions::Extension* GetExtension() const;
virtual bool ReportsV8MemoryStats() const; virtual bool ReportsV8MemoryStats() const;
virtual size_t GetV8MemoryAllocated() const; virtual size_t GetV8MemoryAllocated() const;
virtual size_t GetV8MemoryUsed() const; virtual size_t GetV8MemoryUsed() const;
...@@ -114,10 +111,6 @@ class Resource { ...@@ -114,10 +111,6 @@ class Resource {
virtual void NotifyV8HeapStats(size_t v8_memory_allocated, virtual void NotifyV8HeapStats(size_t v8_memory_allocated,
size_t v8_memory_used) {} size_t v8_memory_used) {}
// Returns true if this resource is not visible to the user because it lives
// in the background (e.g. extension background page, background contents).
virtual bool IsBackground() const;
static const char* GetResourceTypeAsString(const Type type) { static const char* GetResourceTypeAsString(const Type type) {
switch (type) { switch (type) {
TASKMANAGER_RESOURCE_TYPE_LIST(TASKMANAGER_RESOURCE_TYPE_LIST_AS_STRING) TASKMANAGER_RESOURCE_TYPE_LIST(TASKMANAGER_RESOURCE_TYPE_LIST_AS_STRING)
...@@ -125,17 +118,10 @@ class Resource { ...@@ -125,17 +118,10 @@ class Resource {
} }
} }
// Returns resource identifier that is unique within single task manager
// session (between StartUpdating and StopUpdating).
int get_unique_id() { return unique_id_; }
protected: protected:
Resource() : unique_id_(0) {} Resource() {}
private: private:
friend class ::TaskManagerModel;
int unique_id_;
DISALLOW_COPY_AND_ASSIGN(Resource); DISALLOW_COPY_AND_ASSIGN(Resource);
}; };
......
...@@ -79,7 +79,6 @@ class TabContentsResource : public RendererResource { ...@@ -79,7 +79,6 @@ class TabContentsResource : public RendererResource {
virtual base::string16 GetProfileName() const OVERRIDE; virtual base::string16 GetProfileName() const OVERRIDE;
virtual gfx::ImageSkia GetIcon() const OVERRIDE; virtual gfx::ImageSkia GetIcon() const OVERRIDE;
virtual content::WebContents* GetWebContents() const OVERRIDE; virtual content::WebContents* GetWebContents() const OVERRIDE;
virtual const extensions::Extension* GetExtension() const OVERRIDE;
private: private:
// Returns true if contains content rendered by an extension. // Returns true if contains content rendered by an extension.
...@@ -155,16 +154,6 @@ WebContents* TabContentsResource::GetWebContents() const { ...@@ -155,16 +154,6 @@ WebContents* TabContentsResource::GetWebContents() const {
return web_contents_; return web_contents_;
} }
const Extension* TabContentsResource::GetExtension() const {
if (HostsExtension()) {
ExtensionService* extension_service = profile_->GetExtensionService();
return extension_service->extensions()->GetByID(
web_contents_->GetURL().host());
}
return NULL;
}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// TabContentsResourceProvider class // TabContentsResourceProvider class
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
......
...@@ -243,8 +243,7 @@ TaskManagerModel::TaskManagerModel(TaskManager* task_manager) ...@@ -243,8 +243,7 @@ TaskManagerModel::TaskManagerModel(TaskManager* task_manager)
update_requests_(0), update_requests_(0),
listen_requests_(0), listen_requests_(0),
update_state_(IDLE), update_state_(IDLE),
goat_salt_(base::RandUint64()), goat_salt_(base::RandUint64()) {
last_unique_id_(0) {
AddResourceProvider( AddResourceProvider(
new task_manager::BrowserProcessResourceProvider(task_manager)); new task_manager::BrowserProcessResourceProvider(task_manager));
AddResourceProvider( AddResourceProvider(
...@@ -318,19 +317,6 @@ base::ProcessHandle TaskManagerModel::GetProcess(int index) const { ...@@ -318,19 +317,6 @@ base::ProcessHandle TaskManagerModel::GetProcess(int index) const {
return GetResource(index)->GetProcess(); return GetResource(index)->GetProcess();
} }
int TaskManagerModel::GetResourceUniqueId(int index) const {
return GetResource(index)->get_unique_id();
}
int TaskManagerModel::GetResourceIndexByUniqueId(const int unique_id) const {
for (int resource_index = 0; resource_index < ResourceCount();
++resource_index) {
if (GetResourceUniqueId(resource_index) == unique_id)
return resource_index;
}
return -1;
}
base::string16 TaskManagerModel::GetResourceById(int index, int col_id) const { base::string16 TaskManagerModel::GetResourceById(int index, int col_id) const {
if (IsSharedByGroup(col_id) && !IsResourceFirstInGroup(index)) if (IsSharedByGroup(col_id) && !IsResourceFirstInGroup(index))
return base::string16(); return base::string16();
...@@ -766,10 +752,6 @@ bool TaskManagerModel::IsResourceLastInGroup(int index) const { ...@@ -766,10 +752,6 @@ bool TaskManagerModel::IsResourceLastInGroup(int index) const {
return (group->back() == resource); return (group->back() == resource);
} }
bool TaskManagerModel::IsBackgroundResource(int index) const {
return GetResource(index)->IsBackground();
}
gfx::ImageSkia TaskManagerModel::GetResourceIcon(int index) const { gfx::ImageSkia TaskManagerModel::GetResourceIcon(int index) const {
gfx::ImageSkia icon = GetResource(index)->GetIcon(); gfx::ImageSkia icon = GetResource(index)->GetIcon();
if (!icon.isNull()) if (!icon.isNull())
...@@ -978,14 +960,7 @@ WebContents* TaskManagerModel::GetResourceWebContents(int index) const { ...@@ -978,14 +960,7 @@ WebContents* TaskManagerModel::GetResourceWebContents(int index) const {
return GetResource(index)->GetWebContents(); return GetResource(index)->GetWebContents();
} }
const extensions::Extension* TaskManagerModel::GetResourceExtension(
int index) const {
return GetResource(index)->GetExtension();
}
void TaskManagerModel::AddResource(Resource* resource) { void TaskManagerModel::AddResource(Resource* resource) {
resource->unique_id_ = ++last_unique_id_;
base::ProcessHandle process = resource->GetProcess(); base::ProcessHandle process = resource->GetProcess();
ResourceList* group_entries = NULL; ResourceList* group_entries = NULL;
...@@ -1179,7 +1154,6 @@ void TaskManagerModel::Clear() { ...@@ -1179,7 +1154,6 @@ void TaskManagerModel::Clear() {
FOR_EACH_OBSERVER(TaskManagerModelObserver, observer_list_, FOR_EACH_OBSERVER(TaskManagerModelObserver, observer_list_,
OnItemsRemoved(0, size)); OnItemsRemoved(0, size));
} }
last_unique_id_ = 0;
} }
void TaskManagerModel::ModelChanged() { void TaskManagerModel::ModelChanged() {
......
...@@ -159,10 +159,6 @@ class TaskManagerModel : public base::RefCountedThreadSafe<TaskManagerModel> { ...@@ -159,10 +159,6 @@ class TaskManagerModel : public base::RefCountedThreadSafe<TaskManagerModel> {
int GetIdleWakeupsPerSecond(int index) const; int GetIdleWakeupsPerSecond(int index) const;
base::ProcessId GetProcessId(int index) const; base::ProcessId GetProcessId(int index) const;
base::ProcessHandle GetProcess(int index) const; base::ProcessHandle GetProcess(int index) const;
int GetResourceUniqueId(int index) const;
// Returns the index of resource that has the given |unique_id|. Returns -1 if
// no resouce has the |unique_id|.
int GetResourceIndexByUniqueId(const int unique_id) const;
// Catchall method that calls off to the appropriate GetResourceXXX method // Catchall method that calls off to the appropriate GetResourceXXX method
// based on |col_id|. |col_id| is an IDS_ value used to identify the column. // based on |col_id|. |col_id| is an IDS_ value used to identify the column.
...@@ -254,10 +250,6 @@ class TaskManagerModel : public base::RefCountedThreadSafe<TaskManagerModel> { ...@@ -254,10 +250,6 @@ class TaskManagerModel : public base::RefCountedThreadSafe<TaskManagerModel> {
bool IsResourceFirstInGroup(int index) const; bool IsResourceFirstInGroup(int index) const;
bool IsResourceLastInGroup(int index) const; bool IsResourceLastInGroup(int index) const;
// Returns true if the resource runs in the background (not visible to the
// user, e.g. extension background pages and BackgroundContents).
bool IsBackgroundResource(int index) const;
// Returns icon to be used for resource (for example a favicon). // Returns icon to be used for resource (for example a favicon).
gfx::ImageSkia GetResourceIcon(int index) const; gfx::ImageSkia GetResourceIcon(int index) const;
...@@ -287,9 +279,6 @@ class TaskManagerModel : public base::RefCountedThreadSafe<TaskManagerModel> { ...@@ -287,9 +279,6 @@ class TaskManagerModel : public base::RefCountedThreadSafe<TaskManagerModel> {
// Returns WebContents of given resource or NULL if not applicable. // Returns WebContents of given resource or NULL if not applicable.
content::WebContents* GetResourceWebContents(int index) const; content::WebContents* GetResourceWebContents(int index) const;
// Returns Extension of given resource or NULL if not applicable.
const extensions::Extension* GetResourceExtension(int index) const;
void AddResource(task_manager::Resource* resource); void AddResource(task_manager::Resource* resource);
void RemoveResource(task_manager::Resource* resource); void RemoveResource(task_manager::Resource* resource);
...@@ -566,9 +555,6 @@ class TaskManagerModel : public base::RefCountedThreadSafe<TaskManagerModel> { ...@@ -566,9 +555,6 @@ class TaskManagerModel : public base::RefCountedThreadSafe<TaskManagerModel> {
// A salt lick for the goats. // A salt lick for the goats.
uint64 goat_salt_; uint64 goat_salt_;
// Resource identifier that is unique within single session.
int last_unique_id_;
// Buffer for coalescing BytesReadParam so we don't have to post a task on // Buffer for coalescing BytesReadParam so we don't have to post a task on
// each NotifyBytesRead() call. // each NotifyBytesRead() call.
std::vector<BytesReadParam> bytes_read_buffer_; std::vector<BytesReadParam> bytes_read_buffer_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment