Index: base/mp/mp_child_process_context.h |
=================================================================== |
--- base/mp/mp_child_process_context.h (revision 0) |
+++ base/mp/mp_child_process_context.h (revision 0) |
@@ -0,0 +1,73 @@ |
+// 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. |
+ |
+#ifndef BASE_MP_CHILD_PROCESS_CONTEXT_H_ |
+#define BASE_MP_CHILD_PROCESS_CONTEXT_H_ |
+ |
+#include "base/basictypes.h" |
+#include "base/file_path.h" |
+#include "base/process.h" |
+#include "base/ref_counted.h" |
+#include "base/task.h" |
+#include "base/tracked.h" |
+#include <string> |
+ |
+class CommandLine; |
+class MessageLoop; |
+ |
+namespace base { |
+ |
+class MpChildProcessContext { |
+ public: |
+ // Return the bad message received application exit code. |
+ virtual int GetBadMessageResultCode() = 0; |
+ |
+ // Return the normal application exit code. |
+ virtual int GetNormalExitResultCode() = 0; |
+ |
+ // Generate a randome channel ID value. |
+ virtual std::string GenerateRandomChannelID(void* instance) = 0; |
+ |
+ // Return the identifier for the current thread. |
+ virtual bool GetCurrentThreadIdentifier(int* identifier) = 0; |
+ |
+ // Return true if currently on the specified thread. |
+ virtual bool CurrentlyOnThread(int identifier) = 0; |
+ |
+ // Post a task to the specified thread. |
+ virtual bool PostTask(int identifier, |
+ const tracked_objects::Location& from_here, |
+ Task* task) = 0; |
+ |
+ // Post a task to the thread responsible for launching processes. |
+ virtual bool PostProcessLauncherTask( |
+ const tracked_objects::Location& from_here, |
+ Task* task) = 0; |
+ |
+ // Derived classes implement this method to create the process. |
+ virtual base::ProcessHandle StartProcess( |
+#if defined(OS_WIN) |
+ const FilePath& exposed_dir, |
+#elif defined(OS_POSIX) |
+ bool use_zygote, |
+ const base::environment_vector& environ, |
+ int ipcfd, |
+#endif |
+ CommandLine* cmd_line) = 0; |
+ |
+ // Derived classes implement this method to ensure that the process is |
+ // terminated. |
+ virtual void EnsureProcessTerminated(base::ProcessHandle) = 0; |
+ |
+ // Derived classes implement this method to check if a process has crashed. |
+ virtual bool CheckProcessCrash(bool* child_exited, |
+#if defined(OS_POSIX) |
+ bool use_zygote, |
+#endif |
+ base::ProcessHandle handle) = 0; |
+}; |
+ |
+} // namespace base |
+ |
+#endif // BASE_MP_CHILD_PROCESS_CONTEXT_H_ |