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 <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/pickle.h" | 11 #include "base/pickle.h" |
12 #include "base/process_util.h" | 12 #include "base/process_util.h" |
13 #include "base/synchronization/lock.h" | 13 #include "base/synchronization/lock.h" |
14 #include "content/public/browser/file_descriptor_info.h" | 14 #include "content/public/browser/file_descriptor_info.h" |
15 #include "content/public/browser/zygote_host_linux.h" | 15 #include "content/public/browser/zygote_host_linux.h" |
16 | 16 |
17 template<typename Type> | 17 template<typename Type> |
18 struct DefaultSingletonTraits; | 18 struct DefaultSingletonTraits; |
19 | 19 |
20 class CONTENT_EXPORT ZygoteHostImpl : public content::ZygoteHost { | 20 namespace content { |
| 21 |
| 22 class CONTENT_EXPORT ZygoteHostImpl : public ZygoteHost { |
21 public: | 23 public: |
22 // Returns the singleton instance. | 24 // Returns the singleton instance. |
23 static ZygoteHostImpl* GetInstance(); | 25 static ZygoteHostImpl* GetInstance(); |
24 | 26 |
25 void Init(const std::string& sandbox_cmd); | 27 void Init(const std::string& sandbox_cmd); |
26 | 28 |
27 // Tries to start a process of type indicated by process_type. | 29 // Tries to start a process of type indicated by process_type. |
28 // Returns its pid on success, otherwise | 30 // Returns its pid on success, otherwise |
29 // base::kNullProcessHandle; | 31 // base::kNullProcessHandle; |
30 pid_t ForkRequest(const std::vector<std::string>& command_line, | 32 pid_t ForkRequest(const std::vector<std::string>& command_line, |
31 const std::vector<content::FileDescriptorInfo>& mapping, | 33 const std::vector<FileDescriptorInfo>& mapping, |
32 const std::string& process_type); | 34 const std::string& process_type); |
33 void EnsureProcessTerminated(pid_t process); | 35 void EnsureProcessTerminated(pid_t process); |
34 | 36 |
35 // Get the termination status (and, optionally, the exit code) of | 37 // Get the termination status (and, optionally, the exit code) of |
36 // the process. |exit_code| is set to the exit code of the child | 38 // the process. |exit_code| is set to the exit code of the child |
37 // process. (|exit_code| may be NULL.) | 39 // process. (|exit_code| may be NULL.) |
38 base::TerminationStatus GetTerminationStatus(base::ProcessHandle handle, | 40 base::TerminationStatus GetTerminationStatus(base::ProcessHandle handle, |
39 int* exit_code); | 41 int* exit_code); |
40 | 42 |
41 // ZygoteHost implementation: | 43 // ZygoteHost implementation: |
(...skipping 23 matching lines...) Expand all Loading... |
65 // received. | 67 // received. |
66 base::Lock control_lock_; | 68 base::Lock control_lock_; |
67 pid_t pid_; | 69 pid_t pid_; |
68 bool init_; | 70 bool init_; |
69 bool using_suid_sandbox_; | 71 bool using_suid_sandbox_; |
70 std::string sandbox_binary_; | 72 std::string sandbox_binary_; |
71 bool have_read_sandbox_status_word_; | 73 bool have_read_sandbox_status_word_; |
72 int sandbox_status_; | 74 int sandbox_status_; |
73 }; | 75 }; |
74 | 76 |
| 77 } // namespace content |
| 78 |
75 #endif // CONTENT_BROWSER_ZYGOTE_HOST_ZYGOTE_HOST_IMPL_LINUX_H_ | 79 #endif // CONTENT_BROWSER_ZYGOTE_HOST_ZYGOTE_HOST_IMPL_LINUX_H_ |
OLD | NEW |