diff options
-rw-r--r-- | base/process_util.h | 20 | ||||
-rw-r--r-- | base/process_util_win.cc | 4 | ||||
-rw-r--r-- | chrome/browser/memory_details_mac.cc | 14 | ||||
-rw-r--r-- | chrome/browser/safe_browsing/safe_browsing_database_bloom.cc | 4 | ||||
-rw-r--r-- | chrome/browser/safe_browsing/safe_browsing_database_unittest.cc | 4 | ||||
-rw-r--r-- | chrome/test/chrome_process_util.cc | 11 | ||||
-rw-r--r-- | chrome/test/chrome_process_util.h | 9 | ||||
-rw-r--r-- | chrome/test/ui/ui_test.cc | 2 | ||||
-rw-r--r-- | chrome_frame/test_utils.cc | 5 |
9 files changed, 37 insertions, 36 deletions
diff --git a/base/process_util.h b/base/process_util.h index 20f16a7..b9abef0 100644 --- a/base/process_util.h +++ b/base/process_util.h @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -29,6 +29,7 @@ struct kinfo_proc; #include <vector> #include "base/command_line.h" +#include "base/file_descriptor_shuffle.h" #include "base/file_path.h" #include "base/process.h" @@ -40,11 +41,17 @@ struct kinfo_proc; #endif #endif +namespace base { + #if defined(OS_WIN) -typedef PROCESSENTRY32 ProcessEntry; -typedef IO_COUNTERS IoCounters; + +struct ProcessEntry : public PROCESSENTRY32 { +}; +struct IoCounters : public IO_COUNTERS { +}; + #elif defined(OS_POSIX) -// TODO(port): we should not rely on a Win32 structure. + struct ProcessEntry { base::ProcessId pid; base::ProcessId ppid; @@ -60,10 +67,7 @@ struct IoCounters { uint64_t OtherTransferCount; }; -#include "base/file_descriptor_shuffle.h" -#endif - -namespace base { +#endif // defined(OS_POSIX) // A minimalistic but hopefully cross-platform set of exit codes. // Do not change the enumeration values or you will break third-party diff --git a/base/process_util_win.cc b/base/process_util_win.cc index a845ac7..b12f81e 100644 --- a/base/process_util_win.cc +++ b/base/process_util_win.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -722,7 +722,7 @@ double ProcessMetrics::GetCPUUsage() { return cpu; } -bool ProcessMetrics::GetIOCounters(IO_COUNTERS* io_counters) const { +bool ProcessMetrics::GetIOCounters(base::IoCounters* io_counters) const { return GetProcessIoCounters(process_, io_counters) != FALSE; } diff --git a/chrome/browser/memory_details_mac.cc b/chrome/browser/memory_details_mac.cc index fda205e..2b334e4 100644 --- a/chrome/browser/memory_details_mac.cc +++ b/chrome/browser/memory_details_mac.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -104,9 +104,9 @@ void MemoryDetails::CollectProcessData( base::NamedProcessIterator process_it(process_data_[index].process_name, NULL); - while (const ProcessEntry* process_entry = process_it.NextProcessEntry()) { - pids_by_browser[index].push_back(process_entry->pid); - all_pids.push_back(process_entry->pid); + while (const base::ProcessEntry* entry = process_it.NextProcessEntry()) { + pids_by_browser[index].push_back(entry->pid); + all_pids.push_back(entry->pid); } } @@ -115,9 +115,9 @@ void MemoryDetails::CollectProcessData( { base::NamedProcessIterator helper_it(chrome::kHelperProcessExecutableName, NULL); - while (const ProcessEntry* process_entry = helper_it.NextProcessEntry()) { - helper_pids.push_back(process_entry->pid); - all_pids.push_back(process_entry->pid); + while (const base::ProcessEntry* entry = helper_it.NextProcessEntry()) { + helper_pids.push_back(entry->pid); + all_pids.push_back(entry->pid); } } diff --git a/chrome/browser/safe_browsing/safe_browsing_database_bloom.cc b/chrome/browser/safe_browsing/safe_browsing_database_bloom.cc index d1ceb37..6951e41 100644 --- a/chrome/browser/safe_browsing/safe_browsing_database_bloom.cc +++ b/chrome/browser/safe_browsing/safe_browsing_database_bloom.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -473,7 +473,7 @@ void SafeBrowsingDatabaseBloom::GetChunkIds( void SafeBrowsingDatabaseBloom::BuildBloomFilter() { #if defined(OS_WIN) // For measuring the amount of IO during the bloom filter build. - IoCounters io_before, io_after; + base::IoCounters io_before, io_after; base::ProcessHandle handle = base::Process::Current().handle(); scoped_ptr<base::ProcessMetrics> metric; metric.reset(base::ProcessMetrics::CreateProcessMetrics(handle)); diff --git a/chrome/browser/safe_browsing/safe_browsing_database_unittest.cc b/chrome/browser/safe_browsing/safe_browsing_database_unittest.cc index 84cbc80..ea4a7684 100644 --- a/chrome/browser/safe_browsing/safe_browsing_database_unittest.cc +++ b/chrome/browser/safe_browsing/safe_browsing_database_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // @@ -1024,7 +1024,7 @@ struct ChunksInfo { void PerformUpdate(const FilePath& initial_db, const std::vector<ChunksInfo>& chunks, const std::vector<SBChunkDelete>& deletes) { - IoCounters before, after; + base::IoCounters before, after; FilePath path; PathService::Get(base::DIR_TEMP, &path); diff --git a/chrome/test/chrome_process_util.cc b/chrome/test/chrome_process_util.cc index dd3ee1b..5f47df0 100644 --- a/chrome/test/chrome_process_util.cc +++ b/chrome/test/chrome_process_util.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -70,15 +70,12 @@ class ChildProcessFilter : public base::ProcessFilter { ChromeProcessList GetRunningChromeProcesses(base::ProcessId browser_pid) { ChromeProcessList result; - if (browser_pid == static_cast<base::ProcessId>(-1)) return result; ChildProcessFilter filter(browser_pid); base::NamedProcessIterator it(chrome::kBrowserProcessExecutableName, &filter); - - const ProcessEntry* process_entry; - while ((process_entry = it.NextProcessEntry())) { + while (const base::ProcessEntry* process_entry = it.NextProcessEntry()) { #if defined(OS_WIN) result.push_back(process_entry->th32ProcessID); #elif defined(OS_POSIX) @@ -94,7 +91,7 @@ ChromeProcessList GetRunningChromeProcesses(base::ProcessId browser_pid) { ChildProcessFilter filter(result); base::NamedProcessIterator it(chrome::kBrowserProcessExecutableName, &filter); - while ((process_entry = it.NextProcessEntry())) + while (const base::ProcessEntry* process_entry = it.NextProcessEntry()) result.push_back(process_entry->pid); } #endif // defined(OS_LINUX) @@ -107,7 +104,7 @@ ChromeProcessList GetRunningChromeProcesses(base::ProcessId browser_pid) { ChildProcessFilter filter(browser_pid); base::NamedProcessIterator it(chrome::kHelperProcessExecutableName, &filter); - while ((process_entry = it.NextProcessEntry())) + while (const base::ProcessEntry* process_entry = it.NextProcessEntry()) result.push_back(process_entry->pid); } #endif // defined(OS_MACOSX) diff --git a/chrome/test/chrome_process_util.h b/chrome/test/chrome_process_util.h index 94e0355..31bb897 100644 --- a/chrome/test/chrome_process_util.h +++ b/chrome/test/chrome_process_util.h @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -46,7 +46,7 @@ class ChromeTestProcessMetrics { return process_metrics_->GetPeakWorkingSetSize(); } - bool GetIOCounters(IoCounters* io_counters) { + bool GetIOCounters(base::IoCounters* io_counters) { return process_metrics_->GetIOCounters(io_counters); } @@ -54,10 +54,11 @@ class ChromeTestProcessMetrics { private: explicit ChromeTestProcessMetrics(base::ProcessHandle process) { - process_metrics_.reset( #if !defined(OS_MACOSX) + process_metrics_.reset( base::ProcessMetrics::CreateProcessMetrics(process)); #else + process_metrics_.reset( base::ProcessMetrics::CreateProcessMetrics(process, NULL)); #endif process_handle_ = process; @@ -89,7 +90,7 @@ typedef std::vector<MacChromeProcessInfo> MacChromeProcessInfoList; // Any ProcessId that info can't be found for will be left out. MacChromeProcessInfoList GetRunningMacProcessInfo( - const ChromeProcessList &process_list); + const ChromeProcessList& process_list); #endif // defined(OS_MACOSX) diff --git a/chrome/test/ui/ui_test.cc b/chrome/test/ui/ui_test.cc index 8ebb443..f9c5151 100644 --- a/chrome/test/ui/ui_test.cc +++ b/chrome/test/ui/ui_test.cc @@ -1301,7 +1301,7 @@ void UITestBase::PrintIOPerfInfo(const char* test_name) { // base::ProcessMetrics::CreateProcessMetrics(process_handle)); scoped_ptr<ChromeTestProcessMetrics> process_metrics( ChromeTestProcessMetrics::CreateProcessMetrics(process_handle)); - IoCounters io_counters; + base::IoCounters io_counters; memset(&io_counters, 0, sizeof(io_counters)); if (process_metrics.get()->GetIOCounters(&io_counters)) { diff --git a/chrome_frame/test_utils.cc b/chrome_frame/test_utils.cc index e1d33fe..319aa54 100644 --- a/chrome_frame/test_utils.cc +++ b/chrome_frame/test_utils.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -268,10 +268,9 @@ class ArgumentFilter : public base::ProcessFilter { bool KillAllNamedProcessesWithArgument(const std::wstring& process_name, const std::wstring& argument) { bool result = true; - const ProcessEntry* entry; ArgumentFilter filter(argument); base::NamedProcessIterator iter(process_name, &filter); - while (entry = iter.NextProcessEntry()) { + while (const base::ProcessEntry* entry = iter.NextProcessEntry()) { if (!base::KillProcessById((*entry).th32ProcessID, 0, true)) { DLOG(ERROR) << "Failed to kill process " << (*entry).th32ProcessID; result = false; |