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

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

Issue 159777: Add about:memory support for Linux.... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 11 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) 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/browser_about_handler.h" 5 #include "chrome/browser/browser_about_handler.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "app/l10n_util.h" 10 #include "app/l10n_util.h"
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 titles->Append(new StringValue(info->titles[i])); 503 titles->Append(new StringValue(info->titles[i]));
504 } 504 }
505 505
506 506
507 void AboutMemoryHandler::OnDetailsAvailable() { 507 void AboutMemoryHandler::OnDetailsAvailable() {
508 // the root of the JSON hierarchy for about:memory jstemplate 508 // the root of the JSON hierarchy for about:memory jstemplate
509 DictionaryValue root; 509 DictionaryValue root;
510 ListValue* browsers = new ListValue(); 510 ListValue* browsers = new ListValue();
511 root.Set(L"browsers", browsers); 511 root.Set(L"browsers", browsers);
512 512
513 ProcessData* browser_processes = processes(); 513 const std::vector<ProcessData>& browser_processes = processes();
514 514
515 // Aggregate per-process data into browser summary data. 515 // Aggregate per-process data into browser summary data.
516 std::wstring log_string; 516 std::wstring log_string;
517 for (int index = 0; index < MemoryDetails::MAX_BROWSERS; index++) { 517 for (unsigned int index = 0; index < browser_processes.size(); index++) {
Evan Martin 2009/08/03 05:16:11 size_t
518 if (browser_processes[index].processes.size() == 0) 518 if (browser_processes[index].processes.size() == 0)
519 continue; 519 continue;
520 520
521 // Sum the information for the processes within this browser. 521 // Sum the information for the processes within this browser.
522 ProcessMemoryInformation aggregate; 522 ProcessMemoryInformation aggregate;
523 ProcessMemoryInformationList::iterator iterator; 523 ProcessMemoryInformationList::const_iterator iterator;
524 iterator = browser_processes[index].processes.begin(); 524 iterator = browser_processes[index].processes.begin();
525 aggregate.pid = iterator->pid; 525 aggregate.pid = iterator->pid;
526 aggregate.version = iterator->version; 526 aggregate.version = iterator->version;
527 while (iterator != browser_processes[index].processes.end()) { 527 while (iterator != browser_processes[index].processes.end()) {
528 if (!iterator->is_diagnostics || 528 if (!iterator->is_diagnostics ||
529 browser_processes[index].processes.size() == 1) { 529 browser_processes[index].processes.size() == 1) {
530 aggregate.working_set.priv += iterator->working_set.priv; 530 aggregate.working_set.priv += iterator->working_set.priv;
531 aggregate.working_set.shared += iterator->working_set.shared; 531 aggregate.working_set.shared += iterator->working_set.shared;
532 aggregate.working_set.shareable += iterator->working_set.shareable; 532 aggregate.working_set.shareable += iterator->working_set.shareable;
533 aggregate.committed.priv += iterator->committed.priv; 533 aggregate.committed.priv += iterator->committed.priv;
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
662 AboutIPCDialog::RunDialog(); 662 AboutIPCDialog::RunDialog();
663 return true; 663 return true;
664 } 664 }
665 #endif 665 #endif
666 666
667 #else 667 #else
668 // TODO(port) Implement this. 668 // TODO(port) Implement this.
669 #endif 669 #endif
670 return false; 670 return false;
671 } 671 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698