OLD | NEW |
---|---|
(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_H_ | |
6 #define CONTENT_COMMON_ZYGOTE_FORK_DELEGATE_H_ | |
7 #pragma once | |
8 | |
9 #include "base/basictypes.h" | |
10 | |
11 class ZygoteForkDelegate { | |
12 public: | |
13 // A ZygoteForkDelegate is created during Chrome linux zygote | |
14 // initialization, and provides "fork()" functionality with | |
15 // as an alternative to forking the zygote. A new delegate is | |
16 // passed in as an argument to ZygoteMain(). | |
17 ZygoteForkDelegate() {}; | |
jam
2011/06/21 20:54:08
nit: no need for semicolon
Brad Chen
2011/06/21 23:43:48
Done.
| |
18 virtual ~ZygoteForkDelegate() {}; | |
19 // Initialization happens in the zygote after it has been | |
20 // started by ZygoteMain. | |
21 virtual void Init(const bool sandboxed, | |
22 const int browserdesc, | |
23 const int sandboxdesc) = 0; | |
24 // Returns 'true' if the delegate would like to handle a given | |
25 // fork request. Otherwise returns false. | |
26 virtual bool CanHelp(const std::string& process_type) = 0; | |
27 // Delegate forks, returning a -1 on failure. Outside the | |
28 // suid sandbox, Fork() returns the Linux process ID. Inside | |
29 // the sandbox, returns a positive integer, with PID discovery | |
30 // handled by the sandbox. | |
31 virtual pid_t Fork(const std::vector<int>& fds) = 0; | |
32 }; | |
33 | |
34 class NullForkDelegate : public ZygoteForkDelegate { | |
35 public: | |
36 NullForkDelegate() {}; | |
37 ~NullForkDelegate() {}; | |
38 virtual void Init(const bool sandboxed, | |
39 const int browserdesc, | |
40 const int sandboxdesc) {}; | |
41 virtual bool CanHelp(const std::string& process_type) { return false; }; | |
42 virtual pid_t Fork(const std::vector<int>& fds) { return -1; }; | |
43 }; | |
44 | |
45 #endif // CONTENT_COMMON_ZYGOTE_FORK_DELEGATE_H_ | |
OLD | NEW |