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

Side by Side Diff: chrome/test/memory_test/memory_test.cc

Issue 125260: Don't grant unnecessary handle privileges in OpenProcessHandle. (Closed)
Patch Set: update Created 11 years, 6 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 | « chrome/test/chrome_process_util.cc ('k') | chrome/test/page_cycler/page_cycler_test.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) 2006-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2009 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 "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/command_line.h" 6 #include "base/command_line.h"
7 #include "base/file_path.h" 7 #include "base/file_path.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/process_util.h" 10 #include "base/process_util.h"
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 283
284 FilePath data_dir(user_data_dir()); 284 FilePath data_dir(user_data_dir());
285 int browser_process_pid = ChromeBrowserProcessId(data_dir); 285 int browser_process_pid = ChromeBrowserProcessId(data_dir);
286 ChromeProcessList chrome_processes(GetRunningChromeProcesses(data_dir)); 286 ChromeProcessList chrome_processes(GetRunningChromeProcesses(data_dir));
287 287
288 ChromeProcessList::const_iterator it; 288 ChromeProcessList::const_iterator it;
289 for (it = chrome_processes.begin(); it != chrome_processes.end(); ++it) { 289 for (it = chrome_processes.begin(); it != chrome_processes.end(); ++it) {
290 scoped_ptr<base::ProcessMetrics> process_metrics; 290 scoped_ptr<base::ProcessMetrics> process_metrics;
291 IoCounters io_counters; 291 IoCounters io_counters;
292 base::ProcessHandle process_handle; 292 base::ProcessHandle process_handle;
293 if (!base::OpenProcessHandle(*it, &process_handle)) { 293 if (!base::OpenPrivilegedProcessHandle(*it, &process_handle)) {
294 NOTREACHED(); 294 NOTREACHED();
295 } 295 }
296 process_metrics.reset( 296 process_metrics.reset(
297 base::ProcessMetrics::CreateProcessMetrics(process_handle)); 297 base::ProcessMetrics::CreateProcessMetrics(process_handle));
298 bzero(&io_counters, sizeof(io_counters)); 298 bzero(&io_counters, sizeof(io_counters));
299 299
300 if (process_metrics.get()->GetIOCounters(&io_counters)) { 300 if (process_metrics.get()->GetIOCounters(&io_counters)) {
301 std::string chrome_name = (*it == browser_process_pid) ? "_b" : "_r"; 301 std::string chrome_name = (*it == browser_process_pid) ? "_b" : "_r";
302 302
303 // Print out IO performance. We assume that the values can be 303 // Print out IO performance. We assume that the values can be
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 447
448 TEST_F(MemoryTest, FiveTabTest) { 448 TEST_F(MemoryTest, FiveTabTest) {
449 RunTest("5t", 5); 449 RunTest("5t", 5);
450 } 450 }
451 451
452 TEST_F(MemoryTest, TwelveTabTest) { 452 TEST_F(MemoryTest, TwelveTabTest) {
453 RunTest("12t", 12); 453 RunTest("12t", 12);
454 } 454 }
455 455
456 } // namespace 456 } // namespace
OLDNEW
« no previous file with comments | « chrome/test/chrome_process_util.cc ('k') | chrome/test/page_cycler/page_cycler_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698