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

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

Issue 50014: Fix a bunch of tiny near-bugs and bugs that static analysis identified... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 9 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
« no previous file with comments | « base/tracked_objects.cc ('k') | chrome/browser/net/dns_host_info.h » ('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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 #include <psapi.h> 6 #include <psapi.h>
7 7
8 #include "base/file_version_info.h" 8 #include "base/file_version_info.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 TabContents* contents = NULL; 212 TabContents* contents = NULL;
213 if (host->delegate()) 213 if (host->delegate())
214 contents = host->delegate()->GetAsWebContents(); 214 contents = host->delegate()->GetAsWebContents();
215 if (!contents) 215 if (!contents)
216 continue; 216 continue;
217 std::wstring title = UTF16ToWideHack(contents->GetTitle()); 217 std::wstring title = UTF16ToWideHack(contents->GetTitle());
218 if (!title.length()) 218 if (!title.length())
219 title = L"Untitled"; 219 title = L"Untitled";
220 process.titles.push_back(title); 220 process.titles.push_back(title);
221 221
222 // We need to check the pending entry as well as the pending entry to 222 // We need to check the pending entry as well as the display_url to
223 // see if it's an about:memory URL (we don't want to count these in the 223 // see if it's an about:memory URL (we don't want to count these in the
224 // total memory usage of the browser). 224 // total memory usage of the browser).
225 // 225 //
226 // When we reach here, about:memory will be the pending entry since we 226 // When we reach here, about:memory will be the pending entry since we
227 // haven't responded with any data such that it would be committed. If 227 // haven't responded with any data such that it would be committed. If
228 // you have another about:memory tab open (which would be committed), 228 // you have another about:memory tab open (which would be committed),
229 // we don't want to count it either, so we also check the last committed 229 // we don't want to count it either, so we also check the last committed
230 // entry. 230 // entry.
231 // 231 //
232 // Either the pending or last committed entries can be NULL. 232 // Either the pending or last committed entries can be NULL.
233 const NavigationEntry* pending_entry = NULL; 233 const NavigationEntry* pending_entry =
234 //contents->controller()->GetPendingEntry(); 234 contents->controller()->GetPendingEntry();
235 const NavigationEntry* last_committed_entry = 235 const NavigationEntry* last_committed_entry =
236 contents->controller()->GetLastCommittedEntry(); 236 contents->controller()->GetLastCommittedEntry();
237 if ((last_committed_entry && 237 if ((last_committed_entry &&
238 LowerCaseEqualsASCII(last_committed_entry->display_url().spec(), 238 LowerCaseEqualsASCII(last_committed_entry->display_url().spec(),
239 chrome::kAboutMemoryURL)) || 239 chrome::kAboutMemoryURL)) ||
240 (pending_entry && 240 (pending_entry &&
241 LowerCaseEqualsASCII(pending_entry->display_url().spec(), 241 LowerCaseEqualsASCII(pending_entry->display_url().spec(),
242 chrome::kAboutMemoryURL))) 242 chrome::kAboutMemoryURL)))
243 process.is_diagnostics = true; 243 process.is_diagnostics = true;
244 } 244 }
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 } 291 }
292 292
293 UMA_HISTOGRAM_COUNTS_100("Memory.ProcessCount", 293 UMA_HISTOGRAM_COUNTS_100("Memory.ProcessCount",
294 static_cast<int>(browser.processes.size())); 294 static_cast<int>(browser.processes.size()));
295 UMA_HISTOGRAM_COUNTS_100("Memory.PluginProcessCount", plugin_count); 295 UMA_HISTOGRAM_COUNTS_100("Memory.PluginProcessCount", plugin_count);
296 UMA_HISTOGRAM_COUNTS_100("Memory.WorkerProcessCount", worker_count); 296 UMA_HISTOGRAM_COUNTS_100("Memory.WorkerProcessCount", worker_count);
297 297
298 int total_sample = static_cast<int>(aggregate_memory / 1000); 298 int total_sample = static_cast<int>(aggregate_memory / 1000);
299 UMA_HISTOGRAM_MEMORY_MB("Memory.Total", total_sample); 299 UMA_HISTOGRAM_MEMORY_MB("Memory.Total", total_sample);
300 } 300 }
OLDNEW
« no previous file with comments | « base/tracked_objects.cc ('k') | chrome/browser/net/dns_host_info.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698