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

Side by Side Diff: content/common/zygote_fork_delegate_linux.h

Issue 6995121: New NaCl zygote implementation 2 (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Addressing more feedback from jam@ 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_COMMON_ZYGOTE_FORK_DELEGATE_LINUX_H_
6 #define CONTENT_COMMON_ZYGOTE_FORK_DELEGATE_LINUX_H_
7 #pragma once
8
9 #include <unistd.h>
10
11 #include "base/basictypes.h"
12
13 class ZygoteForkDelegate {
14 public:
15 // A ZygoteForkDelegate is created during Chrome linux zygote
16 // initialization, and provides "fork()" functionality with
17 // as an alternative to forking the zygote. A new delegate is
18 // passed in as an argument to ZygoteMain().
19 ZygoteForkDelegate() {}
20 virtual ~ZygoteForkDelegate() {}
21 // Initialization happens in the zygote after it has been
22 // started by ZygoteMain.
23 virtual void Init(const bool sandboxed,
24 const int browserdesc,
25 const int sandboxdesc) = 0;
26 // Returns 'true' if the delegate would like to handle a given
27 // fork request. Otherwise returns false.
28 virtual bool CanHelp(const std::string& process_type) = 0;
29 // Delegate forks, returning a -1 on failure. Outside the
30 // suid sandbox, Fork() returns the Linux process ID. Inside
31 // the sandbox, returns a positive integer, with PID discovery
32 // handled by the sandbox.
33 virtual pid_t Fork(const std::vector<int>& fds) = 0;
34 // After a successful for, signal the child to indicate that
35 // the child's PID has been received. Also communicate the
36 // channel switch as a part of acknowledgement message.
37 virtual bool AckChild(const int fd, const std::string& channel_switch) = 0;
38 };
39
40 class NullForkDelegate : public ZygoteForkDelegate {
41 public:
42 NullForkDelegate() {}
43 ~NullForkDelegate() {}
44 virtual void Init(const bool sandboxed,
45 const int browserdesc,
46 const int sandboxdesc) {}
47 virtual bool CanHelp(const std::string& process_type) { return false; }
48 virtual pid_t Fork(const std::vector<int>& fds) { return -1; }
49 virtual bool AckChild(const int fd, const std::string& channel_switch) {
50 return false;
51 }
52 };
53
54 #endif // CONTENT_COMMON_ZYGOTE_FORK_DELEGATE_LINUX_H_
OLDNEW
« chrome/nacl/nacl_listener.cc ('K') | « content/common/sandbox_methods_linux.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698