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_BROWSER_ZYGOTE_HOST_ZYGOTE_HOST_IMPL_LINUX_H_ | 5 #ifndef CONTENT_BROWSER_ZYGOTE_HOST_ZYGOTE_HOST_IMPL_LINUX_H_ |
6 #define CONTENT_BROWSER_ZYGOTE_HOST_ZYGOTE_HOST_IMPL_LINUX_H_ | 6 #define CONTENT_BROWSER_ZYGOTE_HOST_ZYGOTE_HOST_IMPL_LINUX_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 | 71 |
72 // Should be called every time a Zygote child is born. | 72 // Should be called every time a Zygote child is born. |
73 void ZygoteChildBorn(pid_t process); | 73 void ZygoteChildBorn(pid_t process); |
74 | 74 |
75 // Should be called every time a Zygote child died. | 75 // Should be called every time a Zygote child died. |
76 void ZygoteChildDied(pid_t process); | 76 void ZygoteChildDied(pid_t process); |
77 | 77 |
78 // Sends |data| to the zygote via |control_fd_|. If |fds| is non-NULL, the | 78 // Sends |data| to the zygote via |control_fd_|. If |fds| is non-NULL, the |
79 // included file descriptors will also be passed. The caller is responsible | 79 // included file descriptors will also be passed. The caller is responsible |
80 // for acquiring |control_lock_|. | 80 // for acquiring |control_lock_|. |
81 bool SendMessage(const Pickle& data, const std::vector<int>* fds); | 81 bool SendMessage(const base::Pickle& data, const std::vector<int>* fds); |
82 | 82 |
83 ssize_t ReadReply(void* buf, size_t buflen); | 83 ssize_t ReadReply(void* buf, size_t buflen); |
84 | 84 |
85 // Whether we should use the namespace sandbox instead of the setuid sandbox. | 85 // Whether we should use the namespace sandbox instead of the setuid sandbox. |
86 bool ShouldUseNamespaceSandbox(); | 86 bool ShouldUseNamespaceSandbox(); |
87 | 87 |
88 int control_fd_; // the socket to the zygote | 88 int control_fd_; // the socket to the zygote |
89 // A lock protecting all communication with the zygote. This lock must be | 89 // A lock protecting all communication with the zygote. This lock must be |
90 // acquired before sending a command and released after the result has been | 90 // acquired before sending a command and released after the result has been |
91 // received. | 91 // received. |
92 base::Lock control_lock_; | 92 base::Lock control_lock_; |
93 pid_t pid_; | 93 pid_t pid_; |
94 bool init_; | 94 bool init_; |
95 bool use_suid_sandbox_for_adj_oom_score_; | 95 bool use_suid_sandbox_for_adj_oom_score_; |
96 std::string sandbox_binary_; | 96 std::string sandbox_binary_; |
97 bool have_read_sandbox_status_word_; | 97 bool have_read_sandbox_status_word_; |
98 int sandbox_status_; | 98 int sandbox_status_; |
99 // A lock protecting list_of_running_zygote_children_ and | 99 // A lock protecting list_of_running_zygote_children_ and |
100 // should_teardown_after_last_child_exits_. | 100 // should_teardown_after_last_child_exits_. |
101 base::Lock child_tracking_lock_; | 101 base::Lock child_tracking_lock_; |
102 std::set<pid_t> list_of_running_zygote_children_; | 102 std::set<pid_t> list_of_running_zygote_children_; |
103 bool should_teardown_after_last_child_exits_; | 103 bool should_teardown_after_last_child_exits_; |
104 }; | 104 }; |
105 | 105 |
106 } // namespace content | 106 } // namespace content |
107 | 107 |
108 #endif // CONTENT_BROWSER_ZYGOTE_HOST_ZYGOTE_HOST_IMPL_LINUX_H_ | 108 #endif // CONTENT_BROWSER_ZYGOTE_HOST_ZYGOTE_HOST_IMPL_LINUX_H_ |
OLD | NEW |