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

Unified Diff: chrome/nacl/nacl_fork_delegate_linux.h

Issue 6995121: New NaCl zygote implementation 2 (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Use IPC::Channel directly instead of ChildProcess Created 9 years, 6 months 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: chrome/nacl/nacl_fork_delegate_linux.h
diff --git a/chrome/nacl/nacl_fork_delegate_linux.h b/chrome/nacl/nacl_fork_delegate_linux.h
new file mode 100644
index 0000000000000000000000000000000000000000..77b88b036159c3c203b840deb66fd803c2b866c7
--- /dev/null
+++ b/chrome/nacl/nacl_fork_delegate_linux.h
@@ -0,0 +1,52 @@
+// 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_NACL_NACL_FORK_DELEGATE_LINUX_H_
+#define CHROME_NACL_NACL_FORK_DELEGATE_LINUX_H_
+#pragma once
+
+#if defined(OS_LINUX)
+
+#include "base/basictypes.h"
+#include "content/common/zygote_fork_delegate.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
+ // 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);
+
+ private:
+ pid_t Pid() {
+ return pid_;
+ };
+ int FD() {
+ return fd_;
+ };
+
+ bool sandboxed_;
+ int fd_;
+ pid_t pid_;
+};
+
+#endif // OS_LINUX
+#endif // CHROME_NACL_NACL_FORK_DELEGATE_LINUX_H_

Powered by Google App Engine
This is Rietveld 408576698