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

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

Issue 5968008: Update file version info/memory details/process utils to use string16.... (Closed) Base URL: svn://chrome-svn/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
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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 std::vector<ProcessMemoryInformation> child_info; 81 std::vector<ProcessMemoryInformation> child_info;
82 82
83 // Collect the list of child processes. 83 // Collect the list of child processes.
84 for (BrowserChildProcessHost::Iterator iter; !iter.Done(); ++iter) { 84 for (BrowserChildProcessHost::Iterator iter; !iter.Done(); ++iter) {
85 ProcessMemoryInformation info; 85 ProcessMemoryInformation info;
86 info.pid = base::GetProcId(iter->handle()); 86 info.pid = base::GetProcId(iter->handle());
87 if (!info.pid) 87 if (!info.pid)
88 continue; 88 continue;
89 89
90 info.type = iter->type(); 90 info.type = iter->type();
91 info.titles.push_back(iter->name()); 91 info.titles.push_back(WideToUTF16Hack(iter->name()));
92 child_info.push_back(info); 92 child_info.push_back(info);
93 } 93 }
94 94
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() {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 DCHECK(widget); 142 DCHECK(widget);
143 if (!widget || !widget->IsRenderView()) 143 if (!widget || !widget->IsRenderView())
144 continue; 144 continue;
145 145
146 const RenderViewHost* host = static_cast<const RenderViewHost*>(widget); 146 const RenderViewHost* host = static_cast<const RenderViewHost*>(widget);
147 TabContents* contents = NULL; 147 TabContents* contents = NULL;
148 if (host->delegate()) 148 if (host->delegate())
149 contents = host->delegate()->GetAsTabContents(); 149 contents = host->delegate()->GetAsTabContents();
150 if (!contents) 150 if (!contents)
151 continue; 151 continue;
152 std::wstring title = UTF16ToWideHack(contents->GetTitle()); 152 string16 title = contents->GetTitle();
153 if (!title.length()) 153 if (!title.length())
154 title = L"Untitled"; 154 title = UTF8ToUTF16("Untitled");
Evan Martin 2010/12/22 23:03:59 Heh, funny this isn't translated.
Avi (use Gerrit) 2010/12/22 23:25:02 :(
155 process.titles.push_back(title); 155 process.titles.push_back(title);
156 156
157 // We need to check the pending entry as well as the virtual_url to 157 // We need to check the pending entry as well as the virtual_url to
158 // see if it's an about:memory URL (we don't want to count these in the 158 // see if it's an about:memory URL (we don't want to count these in the
159 // total memory usage of the browser). 159 // total memory usage of the browser).
160 // 160 //
161 // When we reach here, about:memory will be the pending entry since we 161 // When we reach here, about:memory will be the pending entry since we
162 // haven't responded with any data such that it would be committed. If 162 // haven't responded with any data such that it would be committed. If
163 // you have another about:memory tab open (which would be committed), 163 // you have another about:memory tab open (which would be committed),
164 // we don't want to count it either, so we also check the last committed 164 // we don't want to count it either, so we also check the last committed
(...skipping 93 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

Powered by Google App Engine
This is Rietveld 408576698