summaryrefslogtreecommitdiffstats
path: root/chrome/browser/memory_details.cc
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-04 23:55:06 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-04 23:55:06 +0000
commitcd3d789910d9bbd81c2a08eee26bffc4ae10ab52 (patch)
tree2d640336dd883be4f375540ea6573ede6fd3e732 /chrome/browser/memory_details.cc
parent90f6e2e8b787268630fcecddd7542e1bfb587ab3 (diff)
downloadchromium_src-cd3d789910d9bbd81c2a08eee26bffc4ae10ab52.zip
chromium_src-cd3d789910d9bbd81c2a08eee26bffc4ae10ab52.tar.gz
chromium_src-cd3d789910d9bbd81c2a08eee26bffc4ae10ab52.tar.bz2
Clean up the browser about URL handler to not derive from WebContents. It is
instead integrated in the BrowserURLHandler for special schemes. This solves a number of problems and cleans things up nicely. Most of the functions were not necessary to have in the header file of the browser about handler, so I made them local to the .cc file. I moved everything around, but there was no change to any of the About...() functions. This improves the about:memory page to not include the memory of the new tab page it replaced. The entry for itself also has the proper title. This works by using a meta refresh to the actual page, the the process transition no longer happens at the same time as the about:memory page computation. This also fixes problems with the about:network and about:ipc dialogs opening blank pages and also re-opening the dialog when you close the browser. Review URL: http://codereview.chromium.org/27238 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10941 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/memory_details.cc')
-rw-r--r--chrome/browser/memory_details.cc28
1 files changed, 25 insertions, 3 deletions
diff --git a/chrome/browser/memory_details.cc b/chrome/browser/memory_details.cc
index b60a16c..ba27f89 100644
--- a/chrome/browser/memory_details.cc
+++ b/chrome/browser/memory_details.cc
@@ -10,8 +10,10 @@
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chrome_thread.h"
#include "chrome/browser/renderer_host/render_process_host.h"
+#include "chrome/browser/tab_contents/navigation_entry.h"
#include "chrome/browser/tab_contents/web_contents.h"
#include "chrome/common/child_process_host.h"
+#include "chrome/common/url_constants.h"
class RenderViewHostDelegate;
@@ -180,8 +182,7 @@ void MemoryDetails::CollectChildInfoOnUIThread() {
// Check if it's a renderer, if so get the list of page titles in it and
// check if it's a diagnostics-related process. We skip all diagnostics
// pages (e.g. "about:xxx" URLs). Iterate the RenderProcessHosts to find
- // the tab contents. If it is of type TAB_CONTENTS_ABOUT_UI, mark the
- // process as diagnostics related.
+ // the tab contents.
RenderProcessHost::iterator renderer_iter;
for (renderer_iter = RenderProcessHost::begin(); renderer_iter !=
RenderProcessHost::end(); ++renderer_iter) {
@@ -217,7 +218,28 @@ void MemoryDetails::CollectChildInfoOnUIThread() {
if (!title.length())
title = L"Untitled";
process.titles.push_back(title);
- if (contents->type() == TAB_CONTENTS_ABOUT_UI)
+
+ // We need to check the pending entry as well as the pending entry to
+ // see if it's an about:memory URL (we don't want to count these in the
+ // total memory usage of the browser).
+ //
+ // When we reach here, about:memory will be the pending entry since we
+ // haven't responded with any data such that it would be committed. If
+ // you have another about:memory tab open (which would be committed),
+ // we don't want to count it either, so we also check the last committed
+ // entry.
+ //
+ // Either the pending or last committed entries can be NULL.
+ const NavigationEntry* pending_entry = NULL;
+ //contents->controller()->GetPendingEntry();
+ const NavigationEntry* last_committed_entry =
+ contents->controller()->GetLastCommittedEntry();
+ if ((last_committed_entry &&
+ LowerCaseEqualsASCII(last_committed_entry->display_url().spec(),
+ chrome::kAboutMemoryURL)) ||
+ (pending_entry &&
+ LowerCaseEqualsASCII(pending_entry->display_url().spec(),
+ chrome::kAboutMemoryURL)))
process.is_diagnostics = true;
}
}