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_LINUX_H_ | |
6 #define CONTENT_COMMON_ZYGOTE_FORK_DELEGATE_LINUX_H_ | |
7 #pragma once | |
8 | |
9 #include <unistd.h> | |
10 | |
11 #include <string> | |
12 #include <vector> | |
13 | |
14 #include "base/basictypes.h" | |
15 | |
16 // The ZygoteForkDelegate allows the Chrome Linux zygote to delegate | |
17 // fork operations to another class that knows how to do some | |
18 // specialized version of fork. | |
19 class ZygoteForkDelegate { | |
20 public: | |
21 // A ZygoteForkDelegate is created during Chrome linux zygote | |
22 // initialization, and provides "fork()" functionality with | |
23 // as an alternative to forking the zygote. A new delegate is | |
24 // passed in as an argument to ZygoteMain(). | |
25 ZygoteForkDelegate() {} | |
26 virtual ~ZygoteForkDelegate() {} | |
27 // Initialization happens in the zygote after it has been | |
Evan Martin
2011/06/27 18:49:32
Can you add some whitespace lines to this?
Brad Chen
2011/06/27 22:06:25
Done.
| |
28 // started by ZygoteMain. | |
29 virtual void Init(const bool sandboxed, | |
30 const int browserdesc, | |
31 const int sandboxdesc) = 0; | |
32 // Returns 'true' if the delegate would like to handle a given | |
33 // fork request. Otherwise returns false. | |
34 virtual bool CanHelp(const std::string& process_type) = 0; | |
35 // Delegate forks, returning a -1 on failure. Outside the | |
36 // suid sandbox, Fork() returns the Linux process ID. Inside | |
37 // the sandbox, returns a positive integer, with PID discovery | |
38 // handled by the sandbox. | |
39 virtual pid_t Fork(const std::vector<int>& fds) = 0; | |
40 // After a successful for, signal the child to indicate that | |
41 // the child's PID has been received. Also communicate the | |
42 // channel switch as a part of acknowledgement message. | |
43 virtual bool AckChild(const int fd, const std::string& channel_switch) = 0; | |
44 }; | |
45 #endif // CONTENT_COMMON_ZYGOTE_FORK_DELEGATE_LINUX_H_ | |
OLD | NEW |