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

Unified Diff: chrome/common/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: Enable with command-line flag, pass channel ID from zygote 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/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_

Powered by Google App Engine
This is Rietveld 408576698