| 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/kill.h" | 12 #include "base/process/kill.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 namespace content { | 20 namespace content { |
| 21 | 21 |
| 22 class CONTENT_EXPORT ZygoteHostImpl : public ZygoteHost { | 22 class CONTENT_EXPORT ZygoteHostImpl : public ZygoteHost { |
| 23 public: | 23 public: |
| 24 // Returns the singleton instance. | 24 // Returns the singleton instance. |
| 25 static ZygoteHostImpl* GetInstance(); | 25 static ZygoteHostImpl* GetInstance(); |
| 26 | 26 |
| 27 void Init(const std::string& sandbox_cmd); | 27 void Init(const std::string& sandbox_cmd); |
| 28 | 28 |
| 29 // Notify the Zygote to exit immediately. This object should not be |
| 30 // used afterwards. |
| 31 void TearDown(); |
| 32 |
| 29 // Tries to start a process of type indicated by process_type. | 33 // Tries to start a process of type indicated by process_type. |
| 30 // Returns its pid on success, otherwise | 34 // Returns its pid on success, otherwise |
| 31 // base::kNullProcessHandle; | 35 // base::kNullProcessHandle; |
| 32 pid_t ForkRequest(const std::vector<std::string>& command_line, | 36 pid_t ForkRequest(const std::vector<std::string>& command_line, |
| 33 const std::vector<FileDescriptorInfo>& mapping, | 37 const std::vector<FileDescriptorInfo>& mapping, |
| 34 const std::string& process_type); | 38 const std::string& process_type); |
| 35 void EnsureProcessTerminated(pid_t process); | 39 void EnsureProcessTerminated(pid_t process); |
| 36 | 40 |
| 37 // Get the termination status (and, optionally, the exit code) of | 41 // Get the termination status (and, optionally, the exit code) of |
| 38 // the process. |exit_code| is set to the exit code of the child | 42 // the process. |exit_code| is set to the exit code of the child |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 bool init_; | 82 bool init_; |
| 79 bool using_suid_sandbox_; | 83 bool using_suid_sandbox_; |
| 80 std::string sandbox_binary_; | 84 std::string sandbox_binary_; |
| 81 bool have_read_sandbox_status_word_; | 85 bool have_read_sandbox_status_word_; |
| 82 int sandbox_status_; | 86 int sandbox_status_; |
| 83 }; | 87 }; |
| 84 | 88 |
| 85 } // namespace content | 89 } // namespace content |
| 86 | 90 |
| 87 #endif // CONTENT_BROWSER_ZYGOTE_HOST_ZYGOTE_HOST_IMPL_LINUX_H_ | 91 #endif // CONTENT_BROWSER_ZYGOTE_HOST_ZYGOTE_HOST_IMPL_LINUX_H_ |
| OLD | NEW |