OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_PUBLIC_COMMON_ZYGOTE_FORK_DELEGATE_LINUX_H_ | 5 #ifndef CONTENT_PUBLIC_COMMON_ZYGOTE_FORK_DELEGATE_LINUX_H_ |
6 #define CONTENT_PUBLIC_COMMON_ZYGOTE_FORK_DELEGATE_LINUX_H_ | 6 #define CONTENT_PUBLIC_COMMON_ZYGOTE_FORK_DELEGATE_LINUX_H_ |
7 | 7 |
8 #include <unistd.h> | 8 #include <unistd.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 // TODO(jln) base::TerminationStatus should be forward declared when switching | 13 // TODO(jln) base::TerminationStatus should be forward declared when switching |
14 // to C++11. | 14 // to C++11. |
15 #include "base/process/kill.h" | 15 #include "base/process/kill.h" |
16 | 16 |
17 namespace content { | 17 namespace content { |
18 | 18 |
19 // The ZygoteForkDelegate allows the Chrome Linux zygote to delegate | 19 // The ZygoteForkDelegate allows the Chrome Linux zygote to delegate |
20 // fork operations to another class that knows how to do some | 20 // fork operations to another class that knows how to do some |
21 // specialized version of fork. | 21 // specialized version of fork. |
22 class ZygoteForkDelegate { | 22 class ZygoteForkDelegate { |
23 public: | 23 public: |
24 // A ZygoteForkDelegate is created during Chrome linux zygote | 24 // A ZygoteForkDelegate is created during Chrome linux zygote |
25 // initialization, and provides "fork()" functionality as an | 25 // initialization, and provides "fork()" functionality as an |
26 // alternative to forking the zygote. A new delegate is passed in | 26 // alternative to forking the zygote. A new delegate is passed in |
27 // as an argument to ZygoteMain(). | 27 // as an argument to ZygoteMain(). |
28 virtual ~ZygoteForkDelegate() {} | 28 virtual ~ZygoteForkDelegate() {} |
29 | 29 |
30 // Initialization happens in the zygote after it has been | 30 // Initialization happens in the zygote after it has been started by |
31 // started by ZygoteMain. | 31 // ZygoteMain. |
32 // If |enable_layer1_sandbox| is true, the delegate must enable a | 32 virtual void Init(int sandboxdesc) = 0; |
33 // layer-1 sandbox such as the setuid sandbox. | |
34 virtual void Init(int sandboxdesc, bool enable_layer1_sandbox) = 0; | |
35 | 33 |
36 // After Init, supply a UMA_HISTOGRAM_ENUMERATION the delegate would like | 34 // After Init, supply a UMA_HISTOGRAM_ENUMERATION the delegate would like |
37 // reported to the browser process. (Note: Because these reports are | 35 // reported to the browser process. (Note: Because these reports are |
38 // piggy-backed onto fork responses that don't otherwise contain UMA reports, | 36 // piggy-backed onto fork responses that don't otherwise contain UMA reports, |
39 // this method may not be called until much later.) | 37 // this method may not be called until much later.) |
40 virtual void InitialUMA(std::string* uma_name, | 38 virtual void InitialUMA(std::string* uma_name, |
41 int* uma_sample, | 39 int* uma_sample, |
42 int* uma_boundary_value) = 0; | 40 int* uma_boundary_value) = 0; |
43 | 41 |
44 // Returns 'true' if the delegate would like to handle a given fork | 42 // Returns 'true' if the delegate would like to handle a given fork |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 // blocking wait() should be performed. In this case, GetTerminationStatus() | 75 // blocking wait() should be performed. In this case, GetTerminationStatus() |
78 // will send a SIGKILL to the target process first. | 76 // will send a SIGKILL to the target process first. |
79 virtual bool GetTerminationStatus(pid_t pid, bool known_dead, | 77 virtual bool GetTerminationStatus(pid_t pid, bool known_dead, |
80 base::TerminationStatus* status, | 78 base::TerminationStatus* status, |
81 int* exit_code) = 0; | 79 int* exit_code) = 0; |
82 }; | 80 }; |
83 | 81 |
84 } // namespace content | 82 } // namespace content |
85 | 83 |
86 #endif // CONTENT_PUBLIC_COMMON_ZYGOTE_FORK_DELEGATE_LINUX_H_ | 84 #endif // CONTENT_PUBLIC_COMMON_ZYGOTE_FORK_DELEGATE_LINUX_H_ |
OLD | NEW |