Index: chrome/common/nacl_fork_delegate_linux.h |
diff --git a/chrome/common/nacl_fork_delegate_linux.h b/chrome/common/nacl_fork_delegate_linux.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..2a0ac0722e2523c89178cd117a59397ff2731b0a |
--- /dev/null |
+++ b/chrome/common/nacl_fork_delegate_linux.h |
@@ -0,0 +1,56 @@ |
+// Copyright (c) 2011 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 CHROME_COMMON_NACL_FORK_DELEGATE_LINUX_H_ |
+#define CHROME_COMMON_NACL_FORK_DELEGATE_LINUX_H_ |
+#pragma once |
+ |
+#if defined(OS_LINUX) |
jam
2011/06/24 00:10:34
not needed
Brad Chen
2011/06/24 00:40:11
Done.
|
+ |
+#include "base/basictypes.h" |
+#include "content/common/zygote_fork_delegate_linux.h" |
+ |
+class NaClForkDelegate : public ZygoteForkDelegate { |
+ public: |
+ // The NaClForkDelegate is created during Chrome linux zygote |
+ // initialization, and provides "fork()" functionality with |
+ // NaCl specific process characteristics (specifically address |
+ // space layout) as an alternative to forking the zygote. |
+ // A new delegate is passed in as an argument to ZygoteMain(). |
+ NaClForkDelegate(); |
+ ~NaClForkDelegate(); |
+ |
+ // Initialization happens in the zygote after it has been |
jam
2011/06/24 00:10:34
nit: no need to duplicate the comments from the in
Brad Chen
2011/06/24 00:40:11
Done.
|
+ // started by ZygoteMain. |
+ virtual void Init(const bool sandboxed, |
+ const int browserdesc, |
+ const int sandboxdesc); |
+ // Returns 'true' if the delegate would like to handle a given |
+ // fork request. Otherwise returns false. |
+ virtual bool CanHelp(const std::string& process_type); |
+ // Delegate forks, returning a -1 on failure. Outside the |
+ // suid sandbox, Fork() returns the Linux process ID. Inside |
+ // the sandbox, returns a positive integer, with PID discovery |
+ // handled by the sandbox. |
+ virtual pid_t Fork(const std::vector<int>& fds); |
+ // After a successful for, signal the child to indicate that |
+ // the child's PID has been received. Also communicate the |
+ // channel switch as a part of acknowledgement message. |
+ virtual bool AckChild(const int fd, const std::string& channel_switch); |
+ |
+ private: |
+ pid_t Pid() { |
jam
2011/06/24 00:10:34
nit: why are there private getters for these membe
Brad Chen
2011/06/24 00:40:11
Done.
|
+ return pid_; |
+ }; |
+ int FD() { |
+ return fd_; |
+ }; |
+ |
+ bool sandboxed_; |
+ int fd_; |
+ pid_t pid_; |
+}; |
+ |
+#endif // OS_LINUX |
+#endif // CHROME_COMMON_NACL_FORK_DELEGATE_LINUX_H_ |