summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authorbrettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-14 03:25:15 +0000
committerbrettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-14 03:25:15 +0000
commit176aa48371da91eb98d675d87b4e70c7b26d696f (patch)
tree4c972de6ecd5a54650ab1dc7d421187f5d25834f /base
parent9a3f0ac2899139ace97e399015259d028b4d5704 (diff)
downloadchromium_src-176aa48371da91eb98d675d87b4e70c7b26d696f.zip
chromium_src-176aa48371da91eb98d675d87b4e70c7b26d696f.tar.gz
chromium_src-176aa48371da91eb98d675d87b4e70c7b26d696f.tar.bz2
Add Terminate() to the Process object, have RenderProcessHost use this to avoid some more Windows specific code.
Move Process and SharedMemory into the base namespace (most changes). Review URL: http://codereview.chromium.org/10895 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5446 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r--base/clipboard.h4
-rw-r--r--base/clipboard_win.cc11
-rw-r--r--base/gfx/platform_canvas_win.cc4
-rw-r--r--base/multiprocess_test.h8
-rw-r--r--base/process.h27
-rw-r--r--base/process_posix.cc11
-rw-r--r--base/process_util.h4
-rw-r--r--base/process_util_linux.cc4
-rw-r--r--base/process_util_unittest.cc23
-rw-r--r--base/process_util_win.cc12
-rw-r--r--base/process_win.cc24
-rw-r--r--base/run_all_perftests.cc2
-rw-r--r--base/run_all_unittests.cc2
-rw-r--r--base/shared_memory.h7
-rw-r--r--base/shared_memory_posix.cc3
-rw-r--r--base/shared_memory_unittest.cc7
-rw-r--r--base/shared_memory_win.cc3
-rw-r--r--base/stats_table.cc10
-rw-r--r--base/stats_table_unittest.cc7
-rw-r--r--base/trace_event.cc8
-rw-r--r--base/trace_event.h4
21 files changed, 112 insertions, 73 deletions
diff --git a/base/clipboard.h b/base/clipboard.h
index a91d6cb..af1ac5a 100644
--- a/base/clipboard.h
+++ b/base/clipboard.h
@@ -90,7 +90,7 @@ class Clipboard {
// the objects, it came from the process designated by |process|. This will
// assist in turning it into a shared memory region that the current process
// can use.
- void WriteObjects(const ObjectMap& objects, ProcessHandle process);
+ void WriteObjects(const ObjectMap& objects, base::ProcessHandle process);
// Tests whether the clipboard contains a certain format
bool IsFormatAvailable(FormatType format) const;
@@ -160,7 +160,7 @@ class Clipboard {
void WriteBitmapFromSharedMemory(const char* bitmap_data,
const char* size_data,
- ProcessHandle handle);
+ base::ProcessHandle handle);
void WriteBitmapFromHandle(HBITMAP source_hbitmap,
const gfx::Size& size);
diff --git a/base/clipboard_win.cc b/base/clipboard_win.cc
index affb520..814065d 100644
--- a/base/clipboard_win.cc
+++ b/base/clipboard_win.cc
@@ -147,7 +147,8 @@ void Clipboard::WriteObjects(const ObjectMap& objects) {
WriteObjects(objects, NULL);
}
-void Clipboard::WriteObjects(const ObjectMap& objects, ProcessHandle process) {
+void Clipboard::WriteObjects(const ObjectMap& objects,
+ base::ProcessHandle process) {
ScopedClipboard clipboard;
if (!clipboard.Acquire(clipboard_owner_))
return;
@@ -267,12 +268,12 @@ void Clipboard::WriteBitmap(const char* pixel_data, const char* size_data) {
void Clipboard::WriteBitmapFromSharedMemory(const char* bitmap_data,
const char* size_data,
- ProcessHandle process) {
- const SharedMemoryHandle* remote_bitmap_handle =
- reinterpret_cast<const SharedMemoryHandle*>(bitmap_data);
+ base::ProcessHandle process) {
+ const base::SharedMemoryHandle* remote_bitmap_handle =
+ reinterpret_cast<const base::SharedMemoryHandle*>(bitmap_data);
const gfx::Size* size = reinterpret_cast<const gfx::Size*>(size_data);
- SharedMemory bitmap(*remote_bitmap_handle, false, process);
+ base::SharedMemory bitmap(*remote_bitmap_handle, false, process);
// TODO(darin): share data in gfx/bitmap_header.cc somehow
BITMAPINFO bm_info = {0};
diff --git a/base/gfx/platform_canvas_win.cc b/base/gfx/platform_canvas_win.cc
index f2c69ac..fe90c55 100644
--- a/base/gfx/platform_canvas_win.cc
+++ b/base/gfx/platform_canvas_win.cc
@@ -34,8 +34,8 @@ void CrashForBitmapAllocationFailure(int w, int h) {
// If we're using a crazy amount of virtual address space, then maybe there
// isn't enough for our bitmap.
const int64 kLotsOfMem = 1500000000; // 1.5GB.
- scoped_ptr<process_util::ProcessMetrics> process_metrics(
- process_util::ProcessMetrics::CreateProcessMetrics(GetCurrentProcess()));
+ scoped_ptr<base::ProcessMetrics> process_metrics(
+ base::ProcessMetrics::CreateProcessMetrics(GetCurrentProcess()));
CHECK(process_metrics->GetPagefileUsage() < kLotsOfMem);
// Everything else.
diff --git a/base/multiprocess_test.h b/base/multiprocess_test.h
index 69aa50b..a85334e 100644
--- a/base/multiprocess_test.h
+++ b/base/multiprocess_test.h
@@ -51,14 +51,14 @@ class MultiProcessTest : public PlatformTest {
//
// TODO(darin): re-enable this once we have base/debug_util.h
// ProcessDebugFlags(&cl, DebugUtil::UNKNOWN, false);
- ProcessHandle SpawnChild(const std::wstring& procname) {
+ base::ProcessHandle SpawnChild(const std::wstring& procname) {
CommandLine cl;
- ProcessHandle handle = static_cast<ProcessHandle>(NULL);
+ base::ProcessHandle handle = static_cast<base::ProcessHandle>(NULL);
#if defined(OS_WIN)
std::wstring clstr = cl.command_line_string();
CommandLine::AppendSwitchWithValue(&clstr, kRunClientProcess, procname);
- process_util::LaunchApp(clstr, false, true, &handle);
+ base::LaunchApp(clstr, false, true, &handle);
#elif defined(OS_POSIX)
std::vector<std::string> clvec(cl.argv());
std::wstring wswitchstr =
@@ -66,7 +66,7 @@ class MultiProcessTest : public PlatformTest {
procname);
std::string switchstr = WideToUTF8(wswitchstr);
clvec.push_back(switchstr.c_str());
- process_util::LaunchApp(clvec, false, &handle);
+ base::LaunchApp(clvec, false, &handle);
#endif
return handle;
diff --git a/base/process.h b/base/process.h
index 806b1de..7be16e0 100644
--- a/base/process.h
+++ b/base/process.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef BASE_PROCESS_H__
-#define BASE_PROCESS_H__
+#ifndef BASE_PROCESS_H_
+#define BASE_PROCESS_H_
#include "base/basictypes.h"
@@ -11,6 +11,8 @@
#include <windows.h>
#endif
+namespace base {
+
// ProcessHandle is a platform specific type which represents the underlying OS
// handle to a process.
#if defined(OS_WIN)
@@ -20,9 +22,6 @@ typedef HANDLE ProcessHandle;
typedef int ProcessHandle;
#endif
-// A Process
-// TODO(mbelshe): Replace existing code which uses the ProcessHandle w/ the
-// Process object where relevant.
class Process {
public:
Process() : process_(0), last_working_set_size_(0) {}
@@ -43,13 +42,13 @@ class Process {
// Is the this process the current process.
bool is_current() const;
- // Close the Process Handle.
- void Close() {
-#ifdef OS_WIN
- CloseHandle(process_);
-#endif
- process_ = 0;
- }
+ // Close the process handle. This will not terminate the process.
+ void Close();
+
+ // Terminates the process with extreme prejudice. The given result code will
+ // be the exit code of the process. If the process has already exited, this
+ // will do nothing.
+ void Terminate(int result_code);
// A process is backgrounded when it's priority is lower than normal.
// Return true if this process is backgrounded, false otherwise.
@@ -85,5 +84,7 @@ class Process {
size_t last_working_set_size_;
};
-#endif // BASE_PROCESS_H__
+} // namespace base
+
+#endif // BASE_PROCESS_H_
diff --git a/base/process_posix.cc b/base/process_posix.cc
index 73711db..8d210ba 100644
--- a/base/process_posix.cc
+++ b/base/process_posix.cc
@@ -6,6 +6,16 @@
#include "base/logging.h"
#include "base/process_util.h"
+namespace base {
+
+void Process::Close() {
+ process_ = 0;
+}
+
+void Process::Terminate() {
+ NOTIMPLEMENTED();
+}
+
bool Process::IsProcessBackgrounded() const {
return false;
}
@@ -46,3 +56,4 @@ Process Process::Current() {
return Process(process_util::GetCurrentProcessHandle());
}
+} // namspace base
diff --git a/base/process_util.h b/base/process_util.h
index 3f777a6..5146c12 100644
--- a/base/process_util.h
+++ b/base/process_util.h
@@ -44,7 +44,7 @@ struct IoCounters {
};
#endif
-namespace process_util {
+namespace base {
// A minimalistic but hopefully cross-platform set of exit codes.
// Do not change the enumeration values or you will break third-party
@@ -322,6 +322,6 @@ void EnableTerminationOnHeapCorruption();
// the current process's scheduling priority to a high priority.
void RaiseProcessToHighPriority();
-} // namespace process_util
+} // namespace base
#endif // BASE_PROCESS_UTIL_H_
diff --git a/base/process_util_linux.cc b/base/process_util_linux.cc
index 2dba808..1c31f9f 100644
--- a/base/process_util_linux.cc
+++ b/base/process_util_linux.cc
@@ -25,7 +25,7 @@ enum ParsingState {
} // namespace
-namespace process_util {
+namespace base {
bool LaunchApp(const std::vector<std::string>& argv,
bool wait, ProcessHandle* process_handle) {
@@ -327,4 +327,4 @@ int ProcessMetrics::GetCPUUsage() {
return -1;
}
-} // namespace process_util
+} // namespace base
diff --git a/base/process_util_unittest.cc b/base/process_util_unittest.cc
index 4073afd..7e8b9a2 100644
--- a/base/process_util_unittest.cc
+++ b/base/process_util_unittest.cc
@@ -15,7 +15,8 @@
#include <dlfcn.h>
#endif
-namespace {
+namespace base {
+
class ProcessUtilTest : public MultiProcessTest {
};
@@ -27,7 +28,7 @@ TEST_F(ProcessUtilTest, SpawnChild) {
ProcessHandle handle = this->SpawnChild(L"SimpleChildProcess");
ASSERT_NE(static_cast<ProcessHandle>(NULL), handle);
- EXPECT_TRUE(process_util::WaitForSingleProcess(handle, 1000));
+ EXPECT_TRUE(WaitForSingleProcess(handle, 1000));
}
MULTIPROCESS_TEST_MAIN(SlowChildProcess) {
@@ -53,24 +54,24 @@ MULTIPROCESS_TEST_MAIN(SlowChildProcess) {
#if !defined(OS_MACOSX)
TEST_F(ProcessUtilTest, KillSlowChild) {
remove("SlowChildProcess.die");
- int oldcount = process_util::GetProcessCount(L"base_unittests" EXE_SUFFIX, 0);
+ int oldcount = GetProcessCount(L"base_unittests" EXE_SUFFIX, 0);
ProcessHandle handle = this->SpawnChild(L"SlowChildProcess");
ASSERT_NE(static_cast<ProcessHandle>(NULL), handle);
- EXPECT_EQ(oldcount+1, process_util::GetProcessCount(L"base_unittests" EXE_SUFFIX, 0));
+ EXPECT_EQ(oldcount+1, GetProcessCount(L"base_unittests" EXE_SUFFIX, 0));
FILE *fp = fopen("SlowChildProcess.die", "w");
fclose(fp);
// TODO(port): do something less racy here
PlatformThread::Sleep(1000);
- EXPECT_EQ(oldcount, process_util::GetProcessCount(L"base_unittests" EXE_SUFFIX, 0));
+ EXPECT_EQ(oldcount, GetProcessCount(L"base_unittests" EXE_SUFFIX, 0));
}
#endif
// TODO(estade): if possible, port these 2 tests.
#if defined(OS_WIN)
TEST_F(ProcessUtilTest, EnableLFH) {
- ASSERT_TRUE(process_util::EnableLowFragmentationHeap());
+ ASSERT_TRUE(EnableLowFragmentationHeap());
if (IsDebuggerPresent()) {
// Under these conditions, LFH can't be enabled. There's no point to test
// anything.
@@ -101,13 +102,13 @@ TEST_F(ProcessUtilTest, EnableLFH) {
}
TEST_F(ProcessUtilTest, CalcFreeMemory) {
- process_util::ProcessMetrics* metrics =
- process_util::ProcessMetrics::CreateProcessMetrics(::GetCurrentProcess());
+ ProcessMetrics* metrics =
+ ProcessMetrics::CreateProcessMetrics(::GetCurrentProcess());
ASSERT_TRUE(NULL != metrics);
// Typical values here is ~1900 for total and ~1000 for largest. Obviously
// it depends in what other tests have done to this process.
- process_util::FreeMBytes free_mem1 = {0};
+ FreeMBytes free_mem1 = {0};
EXPECT_TRUE(metrics->CalculateFreeMemory(&free_mem1));
EXPECT_LT(10u, free_mem1.total);
EXPECT_LT(10u, free_mem1.largest);
@@ -124,7 +125,7 @@ TEST_F(ProcessUtilTest, CalcFreeMemory) {
size_t expected_total = free_mem1.total - kAllocMB;
size_t expected_largest = free_mem1.largest;
- process_util::FreeMBytes free_mem2 = {0};
+ FreeMBytes free_mem2 = {0};
EXPECT_TRUE(metrics->CalculateFreeMemory(&free_mem2));
EXPECT_GE(free_mem2.total, free_mem2.largest);
EXPECT_GE(expected_total, free_mem2.total);
@@ -136,4 +137,4 @@ TEST_F(ProcessUtilTest, CalcFreeMemory) {
}
#endif // defined(OS_WIN)
-} // namespace
+} // namespace base
diff --git a/base/process_util_win.cc b/base/process_util_win.cc
index d12f167..d163e30 100644
--- a/base/process_util_win.cc
+++ b/base/process_util_win.cc
@@ -22,7 +22,7 @@ typedef BOOL (WINAPI* HeapSetFn)(HANDLE, HEAP_INFORMATION_CLASS, PVOID, SIZE_T);
} // namespace
-namespace process_util {
+namespace base {
int GetCurrentProcId() {
return ::GetCurrentProcessId();
@@ -329,11 +329,11 @@ bool CleanupProcesses(const std::wstring& executable_name,
int wait_milliseconds,
int exit_code,
const ProcessFilter* filter) {
- bool exited_cleanly =
- process_util::WaitForProcessesToExit(executable_name, wait_milliseconds,
- filter);
+ bool exited_cleanly = WaitForProcessesToExit(executable_name,
+ wait_milliseconds,
+ filter);
if (!exited_cleanly)
- process_util::KillProcesses(executable_name, exit_code, filter);
+ KillProcesses(executable_name, exit_code, filter);
return exited_cleanly;
}
@@ -615,4 +615,4 @@ void RaiseProcessToHighPriority() {
SetPriorityClass(GetCurrentProcess(), HIGH_PRIORITY_CLASS);
}
-} // namespace process_util
+} // namespace base
diff --git a/base/process_win.cc b/base/process_win.cc
index 7a60854..697a020 100644
--- a/base/process_win.cc
+++ b/base/process_win.cc
@@ -7,6 +7,21 @@
#include "base/process_util.h"
#include "base/scoped_ptr.h"
+namespace base {
+
+void Process::Close() {
+ if (!process_)
+ return;
+ ::CloseHandle(process_);
+ process_ = NULL;
+}
+
+void Process::Terminate(int result_code) {
+ if (!process_)
+ return;
+ ::TerminateProcess(process_, result_code);
+}
+
bool Process::IsProcessBackgrounded() const {
DCHECK(process_);
DWORD priority = GetPriorityClass(process_);
@@ -43,9 +58,9 @@ bool Process::ReduceWorkingSet() {
// The intended algorithm is:
// TargetWorkingSetSize = (LastWorkingSet/2 + CurrentWorkingSet) /2
- scoped_ptr<process_util::ProcessMetrics> metrics(
- process_util::ProcessMetrics::CreateProcessMetrics(process_));
- process_util::WorkingSetKBytes working_set;
+ scoped_ptr<ProcessMetrics> metrics(
+ ProcessMetrics::CreateProcessMetrics(process_));
+ WorkingSetKBytes working_set;
if (!metrics->GetWorkingSetKBytes(&working_set))
return false;
@@ -96,7 +111,7 @@ int32 Process::pid() const {
if (process_ == 0)
return 0;
- return process_util::GetProcId(process_);
+ return GetProcId(process_);
}
bool Process::is_current() const {
@@ -108,3 +123,4 @@ Process Process::Current() {
return Process(GetCurrentProcess());
}
+} // namespace base
diff --git a/base/run_all_perftests.cc b/base/run_all_perftests.cc
index 1ecf8d1..c0b91c1 100644
--- a/base/run_all_perftests.cc
+++ b/base/run_all_perftests.cc
@@ -25,7 +25,7 @@ class PerfTestSuite : public TestSuite {
// Raise to high priority to have more precise measurements. Since we don't
// aim at 1% precision, it is not necessary to run at realtime level.
if (!DebugUtil::BeingDebugged())
- process_util::RaiseProcessToHighPriority();
+ base::RaiseProcessToHighPriority();
TestSuite::Initialize();
}
diff --git a/base/run_all_unittests.cc b/base/run_all_unittests.cc
index 4ab019a..e7c7b37 100644
--- a/base/run_all_unittests.cc
+++ b/base/run_all_unittests.cc
@@ -6,6 +6,6 @@
#include "base/test_suite.h"
int main(int argc, char** argv) {
- process_util::EnableTerminationOnHeapCorruption();
+ base::EnableTerminationOnHeapCorruption();
return TestSuite(argc, argv).Run();
}
diff --git a/base/shared_memory.h b/base/shared_memory.h
index 358b7b5..34420ce 100644
--- a/base/shared_memory.h
+++ b/base/shared_memory.h
@@ -9,6 +9,8 @@
#include "base/basictypes.h"
#include "base/process.h"
+namespace base {
+
// SharedMemoryHandle is a platform specific type which represents
// the underlying OS handle to a shared memory segment.
#if defined(OS_WIN)
@@ -35,7 +37,7 @@ class SharedMemory {
// shared memory file that was created by a remote process and not shared
// to the current process.
SharedMemory(SharedMemoryHandle handle, bool read_only,
- ProcessHandle process);
+ base::ProcessHandle process);
// Destructor. Will close any open files.
~SharedMemory();
@@ -89,7 +91,7 @@ class SharedMemory {
// file. new_handle is an ouput parameter to receive
// the handle for use in the remote process.
// Returns true on success, false otherwise.
- bool ShareToProcess(ProcessHandle process,
+ bool ShareToProcess(base::ProcessHandle process,
SharedMemoryHandle* new_handle) {
return ShareToProcessCommon(process, new_handle, false);
}
@@ -147,5 +149,6 @@ class SharedMemoryAutoLock {
DISALLOW_EVIL_CONSTRUCTORS(SharedMemoryAutoLock);
};
+} // namespace base
#endif // BASE_SHARED_MEMORY_H_
diff --git a/base/shared_memory_posix.cc b/base/shared_memory_posix.cc
index 3e6d9eb..5f0c05c 100644
--- a/base/shared_memory_posix.cc
+++ b/base/shared_memory_posix.cc
@@ -10,6 +10,8 @@
#include "base/logging.h"
#include "base/string_util.h"
+namespace base {
+
namespace {
// Paranoia. Semaphores and shared memory segments should live in different
// namespaces, but who knows what's out there.
@@ -166,3 +168,4 @@ void SharedMemory::Unlock() {
sem_post(lock_);
}
+} // namespace base
diff --git a/base/shared_memory_unittest.cc b/base/shared_memory_unittest.cc
index 599352d..0c3e464 100644
--- a/base/shared_memory_unittest.cc
+++ b/base/shared_memory_unittest.cc
@@ -9,10 +9,9 @@
static const int kNumThreads = 5;
-namespace {
+namespace base {
-class SharedMemoryTest : public testing::Test {
-};
+namespace {
// Each thread will open the shared memory. Each thread will take a different 4
// byte int pointer, and keep changing it, with some small pauses in between.
@@ -181,3 +180,5 @@ TEST(SharedMemoryTest, Lock) {
}
}
#endif
+
+} // namespace base
diff --git a/base/shared_memory_win.cc b/base/shared_memory_win.cc
index ea81d431..4c56a70 100644
--- a/base/shared_memory_win.cc
+++ b/base/shared_memory_win.cc
@@ -7,6 +7,8 @@
#include "base/logging.h"
#include "base/win_util.h"
+namespace base {
+
SharedMemory::SharedMemory()
: mapped_file_(NULL),
memory_(NULL),
@@ -161,3 +163,4 @@ void SharedMemory::Unlock() {
ReleaseMutex(lock_);
}
+} // namespace base
diff --git a/base/stats_table.cc b/base/stats_table.cc
index 061de0d..72cc5ab 100644
--- a/base/stats_table.cc
+++ b/base/stats_table.cc
@@ -112,7 +112,7 @@ class StatsTablePrivate {
static StatsTablePrivate* New(const std::wstring& name, int size,
int max_threads, int max_counters);
- SharedMemory* shared_memory() { return &shared_memory_; }
+ base::SharedMemory* shared_memory() { return &shared_memory_; }
// Accessors for our header pointers
TableHeader* table_header() const { return table_header_; }
@@ -152,7 +152,7 @@ class StatsTablePrivate {
// Initializes our in-memory pointers into a pre-created StatsTable.
void ComputeMappedPointers(void* memory);
- SharedMemory shared_memory_;
+ base::SharedMemory shared_memory_;
TableHeader* table_header_;
wchar_t* thread_names_table_;
int* thread_tid_table_;
@@ -289,7 +289,7 @@ int StatsTable::RegisterThread(const std::wstring& name) {
// so that two threads don't grab the same slot. Fortunately,
// thread creation shouldn't happen in inner loops.
{
- SharedMemoryAutoLock lock(impl_->shared_memory());
+ base::SharedMemoryAutoLock lock(impl_->shared_memory());
slot = FindEmptyThread();
if (!slot) {
return 0;
@@ -304,7 +304,7 @@ int StatsTable::RegisterThread(const std::wstring& name) {
base::wcslcpy(impl_->thread_name(slot), thread_name.c_str(),
kMaxThreadNameLength);
*(impl_->thread_tid(slot)) = PlatformThread::CurrentId();
- *(impl_->thread_pid(slot)) = process_util::GetCurrentProcId();
+ *(impl_->thread_pid(slot)) = base::GetCurrentProcId();
}
// Set our thread local storage.
@@ -454,7 +454,7 @@ int StatsTable::AddCounter(const std::wstring& name) {
{
// To add a counter to the shared memory, we need the
// shared memory lock.
- SharedMemoryAutoLock lock(impl_->shared_memory());
+ base::SharedMemoryAutoLock lock(impl_->shared_memory());
// We have space, so create a new counter.
counter_id = FindCounterOrEmptyRow(name);
diff --git a/base/stats_table_unittest.cc b/base/stats_table_unittest.cc
index 0ce99b7..68a07ac 100644
--- a/base/stats_table_unittest.cc
+++ b/base/stats_table_unittest.cc
@@ -16,9 +16,8 @@
#include <windows.h>
#endif
-using base::TimeTicks;
+namespace base {
-namespace {
class StatsTableTest : public MultiProcessTest {
};
@@ -199,7 +198,7 @@ TEST_F(StatsTableTest, MultipleProcesses) {
// Wait for the processes to finish.
for (int index = 0; index < kMaxProcs; index++) {
- EXPECT_TRUE(process_util::WaitForSingleProcess(procs[index], 60 * 1000));
+ EXPECT_TRUE(WaitForSingleProcess(procs[index], 60 * 1000));
}
StatsCounter zero_counter(kCounterZero);
@@ -381,4 +380,4 @@ TEST_F(StatsTableTest, StatsScope) {
EXPECT_EQ(2, table.GetCounterValue(L"c:bar"));
}
-} // namespace
+} // namespace base
diff --git a/base/trace_event.cc b/base/trace_event.cc
index 2aa9b6f..9b10f9e 100644
--- a/base/trace_event.cc
+++ b/base/trace_event.cc
@@ -26,8 +26,8 @@ static const FilePath::CharType* kLogFileName =
FILE_PATH_LITERAL("trace_%d.log");
TraceLog::TraceLog() : enabled_(false), log_file_(NULL) {
- ProcessHandle proc = process_util::GetCurrentProcessHandle();
- process_metrics_.reset(process_util::ProcessMetrics::CreateProcessMetrics(proc));
+ base::ProcessHandle proc = base::GetCurrentProcessHandle();
+ process_metrics_.reset(base::ProcessMetrics::CreateProcessMetrics(proc));
}
TraceLog::~TraceLog() {
@@ -86,7 +86,7 @@ void TraceLog::CloseLogFile() {
bool TraceLog::OpenLogFile() {
FilePath::StringType pid_filename =
- StringPrintf(kLogFileName, process_util::GetCurrentProcId());
+ StringPrintf(kLogFileName, base::GetCurrentProcId());
FilePath log_file_path;
if (!PathService::Get(base::DIR_EXE, &log_file_path))
return false;
@@ -133,7 +133,7 @@ void TraceLog::Trace(const std::string& name,
StringPrintf("{'pid':'0x%lx', 'tid':'0x%lx', 'type':'%s', "
"'name':'%s', 'id':'0x%lx', 'extra':'%s', 'file':'%s', "
"'line_number':'%d', 'usec_begin': %I64d},\r\n",
- process_util::GetCurrentProcId(),
+ base::GetCurrentProcId(),
PlatformThread::CurrentId(),
kEventTypeNames[type],
name.c_str(),
diff --git a/base/trace_event.h b/base/trace_event.h
index fc531ec..131af46 100644
--- a/base/trace_event.h
+++ b/base/trace_event.h
@@ -73,7 +73,7 @@
#define TRACE_EVENT_INSTANT(name, id, extra)
#endif
-namespace process_util {
+namespace base {
class ProcessMetrics;
}
@@ -126,7 +126,7 @@ class TraceLog {
FILE* log_file_;
Lock file_lock_;
TimeTicks trace_start_time_;
- scoped_ptr<process_util::ProcessMetrics> process_metrics_;
+ scoped_ptr<base::ProcessMetrics> process_metrics_;
RepeatingTimer<TraceLog> timer_;
};