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

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

Issue 177024: Linux: about:memory (Closed)
Patch Set: ... Created 11 years, 3 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
« no previous file with comments | « base/process_util_linux.cc ('k') | chrome/browser/browser_resources.grd » ('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/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 602 matching lines...) Expand 10 before | Expand all | Expand 10 after
613 titles->Append(new StringValue(info->titles[i])); 613 titles->Append(new StringValue(info->titles[i]));
614 } 614 }
615 615
616 616
617 void AboutMemoryHandler::OnDetailsAvailable() { 617 void AboutMemoryHandler::OnDetailsAvailable() {
618 // the root of the JSON hierarchy for about:memory jstemplate 618 // the root of the JSON hierarchy for about:memory jstemplate
619 DictionaryValue root; 619 DictionaryValue root;
620 ListValue* browsers = new ListValue(); 620 ListValue* browsers = new ListValue();
621 root.Set(L"browsers", browsers); 621 root.Set(L"browsers", browsers);
622 622
623 ProcessData* browser_processes = processes(); 623 const std::vector<ProcessData>& browser_processes = processes();
624 624
625 // Aggregate per-process data into browser summary data. 625 // Aggregate per-process data into browser summary data.
626 std::wstring log_string; 626 std::wstring log_string;
627 for (int index = 0; index < MemoryDetails::MAX_BROWSERS; index++) { 627 for (size_t index = 0; index < browser_processes.size(); index++) {
628 if (browser_processes[index].processes.size() == 0) 628 if (browser_processes[index].processes.size() == 0)
629 continue; 629 continue;
630 630
631 // Sum the information for the processes within this browser. 631 // Sum the information for the processes within this browser.
632 ProcessMemoryInformation aggregate; 632 ProcessMemoryInformation aggregate;
633 ProcessMemoryInformationList::iterator iterator; 633 ProcessMemoryInformationList::const_iterator iterator;
634 iterator = browser_processes[index].processes.begin(); 634 iterator = browser_processes[index].processes.begin();
635 aggregate.pid = iterator->pid; 635 aggregate.pid = iterator->pid;
636 aggregate.version = iterator->version; 636 aggregate.version = iterator->version;
637 while (iterator != browser_processes[index].processes.end()) { 637 while (iterator != browser_processes[index].processes.end()) {
638 if (!iterator->is_diagnostics || 638 if (!iterator->is_diagnostics ||
639 browser_processes[index].processes.size() == 1) { 639 browser_processes[index].processes.size() == 1) {
640 aggregate.working_set.priv += iterator->working_set.priv; 640 aggregate.working_set.priv += iterator->working_set.priv;
641 aggregate.working_set.shared += iterator->working_set.shared; 641 aggregate.working_set.shared += iterator->working_set.shared;
642 aggregate.working_set.shareable += iterator->working_set.shareable; 642 aggregate.working_set.shareable += iterator->working_set.shareable;
643 aggregate.committed.priv += iterator->committed.priv; 643 aggregate.committed.priv += iterator->committed.priv;
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
772 AboutIPCDialog::RunDialog(); 772 AboutIPCDialog::RunDialog();
773 return true; 773 return true;
774 } 774 }
775 #endif 775 #endif
776 776
777 #else 777 #else
778 // TODO(port) Implement this. 778 // TODO(port) Implement this.
779 #endif 779 #endif
780 return false; 780 return false;
781 } 781 }
OLDNEW
« no previous file with comments | « base/process_util_linux.cc ('k') | chrome/browser/browser_resources.grd » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698