Bug 1414631 - Remove the Chromium Process class r?jld
MozReview-Commit-ID: B5NmJPQhGYm
--- a/ipc/chromium/moz.build
+++ b/ipc/chromium/moz.build
@@ -38,17 +38,16 @@ if os_win:
'src/base/cpu.cc',
'src/base/file_util_win.cc',
'src/base/lock_impl_win.cc',
'src/base/message_pump_win.cc',
'src/base/object_watcher.cc',
'src/base/platform_file_win.cc',
'src/base/platform_thread_win.cc',
'src/base/process_util_win.cc',
- 'src/base/process_win.cc',
'src/base/rand_util_win.cc',
'src/base/shared_memory_win.cc',
'src/base/sys_info_win.cc',
'src/base/sys_string_conversions_win.cc',
'src/base/thread_local_storage_win.cc',
'src/base/thread_local_win.cc',
'src/base/time_win.cc',
'src/base/waitable_event_win.cc',
@@ -65,17 +64,16 @@ if os_posix:
UNIFIED_SOURCES += [
'src/base/condition_variable_posix.cc',
'src/base/file_descriptor_shuffle.cc',
'src/base/file_util_posix.cc',
'src/base/lock_impl_posix.cc',
'src/base/message_pump_libevent.cc',
'src/base/platform_file_posix.cc',
'src/base/platform_thread_posix.cc',
- 'src/base/process_posix.cc',
'src/base/process_util_posix.cc',
'src/base/rand_util_posix.cc',
'src/base/shared_memory_posix.cc',
'src/base/string16.cc',
'src/base/sys_info_posix.cc',
'src/base/thread_local_posix.cc',
'src/base/thread_local_storage_posix.cc',
'src/base/waitable_event_posix.cc',
--- a/ipc/chromium/src/base/process.h
+++ b/ipc/chromium/src/base/process.h
@@ -23,59 +23,11 @@ namespace base {
typedef HANDLE ProcessHandle;
typedef DWORD ProcessId;
#elif defined(OS_POSIX)
// On POSIX, our ProcessHandle will just be the PID.
typedef pid_t ProcessHandle;
typedef pid_t ProcessId;
#endif
-class Process {
- public:
- Process() : process_(0), last_working_set_size_(0) {}
- explicit Process(ProcessHandle aHandle) :
- process_(aHandle), last_working_set_size_(0) {}
-
- // A handle to the current process.
- static Process Current();
-
- // Get/Set the handle for this process. The handle will be 0 if the process
- // is no longer running.
- ProcessHandle handle() const { return process_; }
- void set_handle(ProcessHandle aHandle) { process_ = aHandle; }
-
- // Get the PID for this process.
- ProcessId pid() const;
-
- // Is the this process the current process.
- bool is_current() const;
-
- // 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.
- bool IsProcessBackgrounded() const;
-
- // Set a prcess as backgrounded. If value is true, the priority
- // of the process will be lowered. If value is false, the priority
- // of the process will be made "normal" - equivalent to default
- // process priority.
- // Returns true if the priority was changed, false otherwise.
- bool SetProcessBackgrounded(bool value);
-
- // Releases as much of the working set back to the OS as possible.
- // Returns true if successful, false otherwise.
- bool EmptyWorkingSet();
-
- private:
- ProcessHandle process_;
- size_t last_working_set_size_;
-};
-
} // namespace base
#endif // BASE_PROCESS_H_
deleted file mode 100644
--- a/ipc/chromium/src/base/process_posix.cc
+++ /dev/null
@@ -1,62 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-// Copyright (c) 2008 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.
-
-#include "base/process.h"
-#include "base/process_util.h"
-
-namespace base {
-
-void Process::Close() {
- process_ = 0;
- // if the process wasn't termiated (so we waited) or the state
- // wasn't already collected w/ a wait from process_utils, we're gonna
- // end up w/ a zombie when it does finally exit.
-}
-
-void Process::Terminate(int result_code) {
- // result_code isn't supportable.
- if (!process_)
- return;
- // We don't wait here. It's the responsibility of other code to reap the
- // child.
- KillProcess(process_, result_code, false);
-}
-
-bool Process::IsProcessBackgrounded() const {
- // http://code.google.com/p/chromium/issues/detail?id=8083
- return false;
-}
-
-bool Process::SetProcessBackgrounded(bool value) {
- // http://code.google.com/p/chromium/issues/detail?id=8083
- // Just say we did it to keep renderer happy at the moment. Need to finish
- // cleaning this up w/in higher layers since windows is probably the only
- // one that can raise priorities w/o privileges.
- return true;
-}
-
-bool Process::EmptyWorkingSet() {
- // http://code.google.com/p/chromium/issues/detail?id=8083
- return false;
-}
-
-ProcessId Process::pid() const {
- if (process_ == 0)
- return 0;
-
- return GetProcId(process_);
-}
-
-bool Process::is_current() const {
- return process_ == GetCurrentProcessHandle();
-}
-
-// static
-Process Process::Current() {
- return Process(GetCurrentProcessHandle());
-}
-
-} // namspace base
deleted file mode 100644
--- a/ipc/chromium/src/base/process_win.cc
+++ /dev/null
@@ -1,64 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-// Copyright (c) 2006-2008 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.
-
-#include "base/process.h"
-#include "base/logging.h"
-#include "base/process_util.h"
-
-namespace base {
-
-void Process::Close() {
- if (!process_)
- return;
- CloseProcessHandle(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_);
- if (priority == 0)
- return false; // Failure case.
- return priority == BELOW_NORMAL_PRIORITY_CLASS;
-}
-
-bool Process::SetProcessBackgrounded(bool value) {
- DCHECK(process_);
- DWORD priority = value ? BELOW_NORMAL_PRIORITY_CLASS : NORMAL_PRIORITY_CLASS;
- return (SetPriorityClass(process_, priority) != 0);
-}
-
-bool Process::EmptyWorkingSet() {
- if (!process_)
- return false;
-
- BOOL rv = SetProcessWorkingSetSize(process_, -1, -1);
- return rv == TRUE;
-}
-
-ProcessId Process::pid() const {
- if (process_ == 0)
- return 0;
-
- return GetProcId(process_);
-}
-
-bool Process::is_current() const {
- return process_ == GetCurrentProcess();
-}
-
-// static
-Process Process::Current() {
- return Process(GetCurrentProcess());
-}
-
-} // namespace base
--- a/ipc/glue/GeckoChildProcessHost.cpp
+++ b/ipc/glue/GeckoChildProcessHost.cpp
@@ -623,17 +623,17 @@ GeckoChildProcessHost::PerformAsyncLaunc
return false;
}
base::ProcessHandle process = 0;
// send the child the PID so that it can open a ProcessHandle back to us.
// probably don't want to do this in the long run
char pidstring[32];
- SprintfLiteral(pidstring,"%d", base::Process::Current().pid());
+ SprintfLiteral(pidstring, "%d", base::GetCurrentProcId());
const char* const childProcessType =
XRE_ChildProcessTypeToString(mProcessType);
//--------------------------------------------------
#if defined(OS_POSIX)
// For POSIX, we have to be extremely anal about *not* using
// std::wstring in code compiled with Mozilla's -fshort-wchar