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