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

Unified Diff: tools/android/forwarder2/daemon.h

Issue 11269036: Support HTTP test-server based net unit tests on Android. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix Clang build + sync Created 8 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: tools/android/forwarder2/daemon.h
diff --git a/tools/android/forwarder2/daemon.h b/tools/android/forwarder2/daemon.h
new file mode 100644
index 0000000000000000000000000000000000000000..f3654e0c199707ccfdf0905852006759f7b9cf14
--- /dev/null
+++ b/tools/android/forwarder2/daemon.h
@@ -0,0 +1,38 @@
+// Copyright (c) 2012 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.
+
+#ifndef TOOLS_ANDROID_FORWARDER2_DAEMON_H_
+#define TOOLS_ANDROID_FORWARDER2_DAEMON_H_
+
+#include <string>
+
+#include "base/at_exit.h"
+#include "base/basictypes.h"
+
+namespace forwarder2 {
+
+class Daemon {
+ public:
+ // |pid_file_path| is the file path to which the daemon's PID will be written.
+ // Note that a lock on the file is also acquired to guarantee that a single
+ // instance of daemon is running.
+ explicit Daemon(const std::string& pid_file_path);
+
+ // Returns whether the daemon was successfully spawned. Use |is_daemon| to
+ // distinguish the parent from the child (daemon) process.
+ bool Spawn(bool* is_daemon);
+
+ // Kills the daemon and blocks until it exited.
+ bool Kill();
+
+ private:
+ const std::string pid_file_path_;
+ base::AtExitManager at_exit_manager;
+
+ DISALLOW_COPY_AND_ASSIGN(Daemon);
+};
+
+} // namespace forwarder2
+
+#endif // TOOLS_ANDROID_FORWARDER2_DAEMON_H_

Powered by Google App Engine
This is Rietveld 408576698