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

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

Issue 1689012: Move common code into process_util.cc (Closed)
Patch Set: More fixes Created 10 years, 7 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/shared_memory.h ('k') | chrome/browser/memory_details_win.cc » ('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) 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 <set> 7 #include <set>
8 #include <string> 8 #include <string>
9 9
10 #include "app/l10n_util.h" 10 #include "app/l10n_util.h"
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 // over browsers, then over PIDs. 99 // over browsers, then over PIDs.
100 100
101 // Get PIDs of main browser processes. 101 // Get PIDs of main browser processes.
102 std::vector<base::ProcessId> pids_by_browser[MAX_BROWSERS]; 102 std::vector<base::ProcessId> pids_by_browser[MAX_BROWSERS];
103 std::vector<base::ProcessId> all_pids; 103 std::vector<base::ProcessId> all_pids;
104 for (size_t index = CHROME_BROWSER; index < MAX_BROWSERS; index++) { 104 for (size_t index = CHROME_BROWSER; index < MAX_BROWSERS; index++) {
105 base::NamedProcessIterator process_it(process_data_[index].process_name, 105 base::NamedProcessIterator process_it(process_data_[index].process_name,
106 NULL); 106 NULL);
107 107
108 while (const base::ProcessEntry* entry = process_it.NextProcessEntry()) { 108 while (const base::ProcessEntry* entry = process_it.NextProcessEntry()) {
109 pids_by_browser[index].push_back(entry->pid); 109 pids_by_browser[index].push_back(entry->pid());
110 all_pids.push_back(entry->pid); 110 all_pids.push_back(entry->pid());
111 } 111 }
112 } 112 }
113 113
114 // Get PIDs of helpers. 114 // Get PIDs of helpers.
115 std::vector<base::ProcessId> helper_pids; 115 std::vector<base::ProcessId> helper_pids;
116 { 116 {
117 base::NamedProcessIterator helper_it(chrome::kHelperProcessExecutableName, 117 base::NamedProcessIterator helper_it(chrome::kHelperProcessExecutableName,
118 NULL); 118 NULL);
119 while (const base::ProcessEntry* entry = helper_it.NextProcessEntry()) { 119 while (const base::ProcessEntry* entry = helper_it.NextProcessEntry()) {
120 helper_pids.push_back(entry->pid); 120 helper_pids.push_back(entry->pid());
121 all_pids.push_back(entry->pid); 121 all_pids.push_back(entry->pid());
122 } 122 }
123 } 123 }
124 124
125 // Capture information about the processes we're interested in. 125 // Capture information about the processes we're interested in.
126 ProcessInfoSnapshot process_info; 126 ProcessInfoSnapshot process_info;
127 process_info.Sample(all_pids); 127 process_info.Sample(all_pids);
128 128
129 // Handle the other processes first. 129 // Handle the other processes first.
130 for (size_t index = CHROME_BROWSER + 1; index < MAX_BROWSERS; index++) { 130 for (size_t index = CHROME_BROWSER + 1; index < MAX_BROWSERS; index++) {
131 for (std::vector<base::ProcessId>::const_iterator it = 131 for (std::vector<base::ProcessId>::const_iterator it =
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 } 218 }
219 } 219 }
220 220
221 // Memory info. 221 // Memory info.
222 process_info.GetCommittedKBytesOfPID(info.pid, &info.committed); 222 process_info.GetCommittedKBytesOfPID(info.pid, &info.committed);
223 process_info.GetWorkingSetKBytesOfPID(info.pid, &info.working_set); 223 process_info.GetWorkingSetKBytesOfPID(info.pid, &info.working_set);
224 224
225 // Add the process info to our list. 225 // Add the process info to our list.
226 process_data_[CHROME_BROWSER].processes.push_back(info); 226 process_data_[CHROME_BROWSER].processes.push_back(info);
227 } 227 }
OLDNEW
« no previous file with comments | « base/shared_memory.h ('k') | chrome/browser/memory_details_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698