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

Unified Diff: chrome/browser/task_manager/task_manager_resource_providers.cc

Issue 8469015: Switch BackgroundContents to use TabContents instead of RenderViewHost. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix unittest Created 9 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/task_manager/task_manager_resource_providers.cc
===================================================================
--- chrome/browser/task_manager/task_manager_resource_providers.cc (revision 109469)
+++ chrome/browser/task_manager/task_manager_resource_providers.cc (working copy)
@@ -496,8 +496,9 @@
BackgroundContents* background_contents,
const string16& application_name)
: TaskManagerRendererResource(
- background_contents->render_view_host()->process()->GetHandle(),
- background_contents->render_view_host()),
+ background_contents->tab_contents()->GetRenderProcessHost()->
+ GetHandle(),
+ background_contents->tab_contents()->render_view_host()),
background_contents_(background_contents),
application_name_(application_name) {
// Just use the same icon that other extension resources do.
@@ -558,25 +559,22 @@
int origin_pid,
int render_process_host_id,
int routing_id) {
- BackgroundContents* contents = BackgroundContents::GetBackgroundContentsByID(
- render_process_host_id, routing_id);
- if (!contents) // This resource no longer exists.
- return NULL;
-
// If an origin PID was specified, the request is from a plugin, not the
// render view host process
if (origin_pid)
return NULL;
- std::map<BackgroundContents*,
- TaskManagerBackgroundContentsResource*>::iterator res_iter =
- resources_.find(contents);
- if (res_iter == resources_.end())
- // Can happen if the page went away while a network request was being
- // performed.
- return NULL;
+ for (Resources::iterator i = resources_.begin(); i != resources_.end(); i++) {
+ TabContents* tab = i->first->tab_contents();
+ if (tab->render_view_host()->process()->id() == render_process_host_id &&
+ tab->render_view_host()->routing_id() == routing_id) {
+ return i->second;
+ }
+ }
- return res_iter->second;
+ // Can happen if the page went away while a network request was being
+ // performed.
+ return NULL;
}
void TaskManagerBackgroundContentsResourceProvider::StartUpdating() {
@@ -661,7 +659,7 @@
return;
// Don't add contents whose process is dead.
- if (!contents->render_view_host()->process()->GetHandle())
+ if (!contents->tab_contents()->GetRenderProcessHost()->GetHandle())
return;
// Should never add the same BackgroundContents twice.
@@ -673,9 +671,7 @@
BackgroundContents* contents) {
if (!updating_)
return;
- std::map<BackgroundContents*,
- TaskManagerBackgroundContentsResource*>::iterator iter =
- resources_.find(contents);
+ Resources::iterator iter = resources_.find(contents);
DCHECK(iter != resources_.end());
// Remove the resource from the Task Manager.
« no previous file with comments | « chrome/browser/task_manager/task_manager_resource_providers.h ('k') | chrome/browser/translate/translate_tab_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698