summaryrefslogtreecommitdiffstats
path: root/chrome/common
diff options
context:
space:
mode:
authorthestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-13 22:34:25 +0000
committerthestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-13 22:34:25 +0000
commit54ec76d27e99b76d16831d48c5c9a13dee8a9c93 (patch)
treedbde1343223b6cb6158e85fc33d23db6dd6e58eb /chrome/common
parent89dd4eed72dfea6912684540a65842ad01773aa6 (diff)
downloadchromium_src-54ec76d27e99b76d16831d48c5c9a13dee8a9c93.zip
chromium_src-54ec76d27e99b76d16831d48c5c9a13dee8a9c93.tar.gz
chromium_src-54ec76d27e99b76d16831d48c5c9a13dee8a9c93.tar.bz2
Revert r20553.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20554 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common')
-rw-r--r--chrome/common/platform_util_linux.cc6
-rw-r--r--chrome/common/process_watcher.h8
-rw-r--r--chrome/common/process_watcher_posix.cc34
3 files changed, 7 insertions, 41 deletions
diff --git a/chrome/common/platform_util_linux.cc b/chrome/common/platform_util_linux.cc
index b13033c..988de92 100644
--- a/chrome/common/platform_util_linux.cc
+++ b/chrome/common/platform_util_linux.cc
@@ -6,10 +6,10 @@
#include <gtk/gtk.h>
+#include "base/file_path.h"
#include "base/file_util.h"
#include "base/process_util.h"
#include "base/string_util.h"
-#include "chrome/common/process_watcher.h"
namespace {
@@ -18,9 +18,7 @@ void XDGOpen(const FilePath& path) {
argv.push_back("xdg-open");
argv.push_back(path.value());
base::file_handle_mapping_vector no_files;
- base::ProcessHandle handle;
- if (base::LaunchApp(argv, no_files, false, &handle))
- ProcessWatcher::EnsureProcessGetsReaped(handle);
+ base::LaunchApp(argv, no_files, false, NULL);
}
} // namespace
diff --git a/chrome/common/process_watcher.h b/chrome/common/process_watcher.h
index a1f909c..3242984 100644
--- a/chrome/common/process_watcher.h
+++ b/chrome/common/process_watcher.h
@@ -5,8 +5,6 @@
#ifndef CHROME_COMMON_PROCESS_WATCHER_H_
#define CHROME_COMMON_PROCESS_WATCHER_H_
-#include "build/build_config.h"
-
#include "base/basictypes.h"
#include "base/process_util.h"
@@ -27,12 +25,6 @@ class ProcessWatcher {
//
static void EnsureProcessTerminated(base::ProcessHandle process_handle);
-#if defined(OS_POSIX)
- // The nicer version of EnsureProcessTerminated() that is patient and will
- // wait for |process_handle| to finish and then reap it.
- static void EnsureProcessGetsReaped(base::ProcessHandle process_handle);
-#endif
-
private:
// Do not instantiate this class.
ProcessWatcher();
diff --git a/chrome/common/process_watcher_posix.cc b/chrome/common/process_watcher_posix.cc
index a583fde..f1ae4f4 100644
--- a/chrome/common/process_watcher_posix.cc
+++ b/chrome/common/process_watcher_posix.cc
@@ -30,9 +30,8 @@ static bool IsChildDead(pid_t child) {
// If the child doesn't exit within a couple of seconds, kill it.
class BackgroundReaper : public PlatformThread::Delegate {
public:
- explicit BackgroundReaper(pid_t child, unsigned timeout)
- : child_(child),
- timeout_(timeout) {
+ explicit BackgroundReaper(pid_t child)
+ : child_(child) {
}
void ThreadMain() {
@@ -44,17 +43,8 @@ class BackgroundReaper : public PlatformThread::Delegate {
// There's no good way to wait for a specific child to exit in a timed
// fashion. (No kqueue on Linux), so we just loop and sleep.
- // Wait forever case.
- if (timeout_ == 0) {
- while (1) {
- PlatformThread::Sleep(5000); // 5 seconds, not in a hurry.
- if (IsChildDead(child_))
- return;
- }
- }
-
- // Waits 0.5 * timeout_ seconds
- for (unsigned i = 0; i < timeout_; ++i) {
+ // Waits 0.5 * 4 = 2 seconds.
+ for (unsigned i = 0; i < 4; ++i) {
PlatformThread::Sleep(500); // 0.5 seconds
if (IsChildDead(child_))
return;
@@ -72,9 +62,6 @@ class BackgroundReaper : public PlatformThread::Delegate {
private:
const pid_t child_;
- // Number of 0.5 seconds intervals to wait, if 0 then wait forever and do
- // not attempt to kill |child_|.
- const unsigned timeout_;
DISALLOW_COPY_AND_ASSIGN(BackgroundReaper);
};
@@ -85,17 +72,6 @@ void ProcessWatcher::EnsureProcessTerminated(base::ProcessHandle process) {
if (IsChildDead(process))
return;
- const unsigned timeout = 4; // 4 * 0.5 seconds = 2 seconds
- BackgroundReaper* reaper = new BackgroundReaper(process, timeout);
- PlatformThread::CreateNonJoinable(0, reaper);
-}
-
-// static
-void ProcessWatcher::EnsureProcessGetsReaped(base::ProcessHandle process) {
- // If the child is already dead, then there's nothing to do
- if (IsChildDead(process))
- return;
-
- BackgroundReaper* reaper = new BackgroundReaper(process, 0);
+ BackgroundReaper* reaper = new BackgroundReaper(process);
PlatformThread::CreateNonJoinable(0, reaper);
}