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

Side by Side Diff: chrome/browser/memory_details.cc

Issue 5519016: Add a new GetInstance() method for singleton classes used in chrome/browser files. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 10 years 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
« no previous file with comments | « chrome/browser/gtk/browser_window_gtk.cc ('k') | chrome/browser/memory_details_linux.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #include "chrome/browser/memory_details.h" 5 #include "chrome/browser/memory_details.h"
6 6
7 #include "base/file_version_info.h" 7 #include "base/file_version_info.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/process_util.h" 9 #include "base/process_util.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 // Now go do expensive memory lookups from the file thread. 95 // Now go do expensive memory lookups from the file thread.
96 BrowserThread::PostTask( 96 BrowserThread::PostTask(
97 BrowserThread::FILE, FROM_HERE, 97 BrowserThread::FILE, FROM_HERE,
98 NewRunnableMethod(this, &MemoryDetails::CollectProcessData, child_info)); 98 NewRunnableMethod(this, &MemoryDetails::CollectProcessData, child_info));
99 } 99 }
100 100
101 void MemoryDetails::CollectChildInfoOnUIThread() { 101 void MemoryDetails::CollectChildInfoOnUIThread() {
102 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 102 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
103 103
104 #if defined(OS_LINUX) 104 #if defined(OS_LINUX)
105 const pid_t zygote_pid = Singleton<ZygoteHost>()->pid(); 105 const pid_t zygote_pid = ZygoteHost::GetInstance()->pid();
106 const pid_t sandbox_helper_pid = Singleton<RenderSandboxHostLinux>()->pid(); 106 const pid_t sandbox_helper_pid = RenderSandboxHostLinux::GetInstance()->pid();
107 #endif 107 #endif
108 108
109 ProcessData* const chrome_browser = ChromeBrowser(); 109 ProcessData* const chrome_browser = ChromeBrowser();
110 // Get more information about the process. 110 // Get more information about the process.
111 for (size_t index = 0; index < chrome_browser->processes.size(); 111 for (size_t index = 0; index < chrome_browser->processes.size();
112 index++) { 112 index++) {
113 // Check if it's a renderer, if so get the list of page titles in it and 113 // Check if it's a renderer, if so get the list of page titles in it and
114 // check if it's a diagnostics-related process. We skip all diagnostics 114 // check if it's a diagnostics-related process. We skip all diagnostics
115 // pages (e.g. "about:xxx" URLs). Iterate the RenderProcessHosts to find 115 // pages (e.g. "about:xxx" URLs). Iterate the RenderProcessHosts to find
116 // the tab contents. 116 // the tab contents.
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 UMA_HISTOGRAM_COUNTS_100("Memory.ProcessCount", 258 UMA_HISTOGRAM_COUNTS_100("Memory.ProcessCount",
259 static_cast<int>(browser.processes.size())); 259 static_cast<int>(browser.processes.size()));
260 UMA_HISTOGRAM_COUNTS_100("Memory.PluginProcessCount", plugin_count); 260 UMA_HISTOGRAM_COUNTS_100("Memory.PluginProcessCount", plugin_count);
261 UMA_HISTOGRAM_COUNTS_100("Memory.WorkerProcessCount", worker_count); 261 UMA_HISTOGRAM_COUNTS_100("Memory.WorkerProcessCount", worker_count);
262 // TODO(viettrungluu): Do we want separate counts for the other 262 // TODO(viettrungluu): Do we want separate counts for the other
263 // (platform-specific) process types? 263 // (platform-specific) process types?
264 264
265 int total_sample = static_cast<int>(aggregate_memory / 1000); 265 int total_sample = static_cast<int>(aggregate_memory / 1000);
266 UMA_HISTOGRAM_MEMORY_MB("Memory.Total", total_sample); 266 UMA_HISTOGRAM_MEMORY_MB("Memory.Total", total_sample);
267 } 267 }
OLDNEW
« no previous file with comments | « chrome/browser/gtk/browser_window_gtk.cc ('k') | chrome/browser/memory_details_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698