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

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

Issue 7480028: Removal of Profile from content part 2. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 4 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 RenderProcessHost::AllHostsIterator()); !renderer_iter.IsAtEnd(); 128 RenderProcessHost::AllHostsIterator()); !renderer_iter.IsAtEnd();
129 renderer_iter.Advance()) { 129 renderer_iter.Advance()) {
130 RenderProcessHost* render_process_host = renderer_iter.GetCurrentValue(); 130 RenderProcessHost* render_process_host = renderer_iter.GetCurrentValue();
131 DCHECK(render_process_host); 131 DCHECK(render_process_host);
132 // Ignore processes that don't have a connection, such as crashed tabs. 132 // Ignore processes that don't have a connection, such as crashed tabs.
133 if (!render_process_host->HasConnection() || 133 if (!render_process_host->HasConnection() ||
134 process.pid != base::GetProcId(render_process_host->GetHandle())) { 134 process.pid != base::GetProcId(render_process_host->GetHandle())) {
135 continue; 135 continue;
136 } 136 }
137 process.type = ChildProcessInfo::RENDER_PROCESS; 137 process.type = ChildProcessInfo::RENDER_PROCESS;
138 Profile* profile = render_process_host->profile(); 138 Profile* profile =
139 Profile::FromBrowserContext(render_process_host->browser_context());
139 ExtensionService* extension_service = profile->GetExtensionService(); 140 ExtensionService* extension_service = profile->GetExtensionService();
140 141
141 // The RenderProcessHost may host multiple TabContents. Any 142 // The RenderProcessHost may host multiple TabContents. Any
142 // of them which contain diagnostics information make the whole 143 // of them which contain diagnostics information make the whole
143 // process be considered a diagnostics process. 144 // process be considered a diagnostics process.
144 // 145 //
145 // NOTE: This is a bit dangerous. We know that for now, listeners 146 // NOTE: This is a bit dangerous. We know that for now, listeners
146 // are always RenderWidgetHosts. But in theory, they don't 147 // are always RenderWidgetHosts. But in theory, they don't
147 // have to be. 148 // have to be.
148 RenderProcessHost::listeners_iterator iter( 149 RenderProcessHost::listeners_iterator iter(
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 UMA_HISTOGRAM_COUNTS_100("Memory.OtherProcessCount", other_count); 350 UMA_HISTOGRAM_COUNTS_100("Memory.OtherProcessCount", other_count);
350 UMA_HISTOGRAM_COUNTS_100("Memory.PluginProcessCount", plugin_count); 351 UMA_HISTOGRAM_COUNTS_100("Memory.PluginProcessCount", plugin_count);
351 UMA_HISTOGRAM_COUNTS_100("Memory.RendererProcessCount", renderer_count); 352 UMA_HISTOGRAM_COUNTS_100("Memory.RendererProcessCount", renderer_count);
352 UMA_HISTOGRAM_COUNTS_100("Memory.WorkerProcessCount", worker_count); 353 UMA_HISTOGRAM_COUNTS_100("Memory.WorkerProcessCount", worker_count);
353 // TODO(viettrungluu): Do we want separate counts for the other 354 // TODO(viettrungluu): Do we want separate counts for the other
354 // (platform-specific) process types? 355 // (platform-specific) process types?
355 356
356 int total_sample = static_cast<int>(aggregate_memory / 1000); 357 int total_sample = static_cast<int>(aggregate_memory / 1000);
357 UMA_HISTOGRAM_MEMORY_MB("Memory.Total", total_sample); 358 UMA_HISTOGRAM_MEMORY_MB("Memory.Total", total_sample);
358 } 359 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698