OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_LINUX_H_ | 5 #ifndef CONTENT_BROWSER_ZYGOTE_HOST_LINUX_H_ |
6 #define CONTENT_BROWSER_ZYGOTE_HOST_LINUX_H_ | 6 #define CONTENT_BROWSER_ZYGOTE_HOST_LINUX_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <unistd.h> | 9 #include <unistd.h> |
10 | 10 |
11 #include <string> | 11 #include <string> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/global_descriptors_posix.h" | 14 #include "base/global_descriptors_posix.h" |
15 #include "base/process.h" | 15 #include "base/process.h" |
16 #include "base/process_util.h" | 16 #include "base/process_util.h" |
17 #include "base/synchronization/lock.h" | 17 #include "base/synchronization/lock.h" |
| 18 #include "content/common/content_export.h" |
18 | 19 |
19 template<typename Type> | 20 template<typename Type> |
20 struct DefaultSingletonTraits; | 21 struct DefaultSingletonTraits; |
21 | 22 |
22 static const char kZygoteMagic[] = "ZYGOTE_OK"; | 23 static const char kZygoteMagic[] = "ZYGOTE_OK"; |
23 | 24 |
24 // http://code.google.com/p/chromium/wiki/LinuxZygote | 25 // http://code.google.com/p/chromium/wiki/LinuxZygote |
25 | 26 |
26 // The zygote host is the interface, in the browser process, to the zygote | 27 // The zygote host is the interface, in the browser process, to the zygote |
27 // process. | 28 // process. |
28 class ZygoteHost { | 29 class CONTENT_EXPORT ZygoteHost { |
29 public: | 30 public: |
30 // Returns the singleton instance. | 31 // Returns the singleton instance. |
31 static ZygoteHost* GetInstance(); | 32 static ZygoteHost* GetInstance(); |
32 | 33 |
33 void Init(const std::string& sandbox_cmd); | 34 void Init(const std::string& sandbox_cmd); |
34 | 35 |
35 // Tries to start a process of type indicated by process_type. | 36 // Tries to start a process of type indicated by process_type. |
36 // Returns its pid on success, otherwise | 37 // Returns its pid on success, otherwise |
37 // base::kNullProcessHandle; | 38 // base::kNullProcessHandle; |
38 pid_t ForkRequest(const std::vector<std::string>& command_line, | 39 pid_t ForkRequest(const std::vector<std::string>& command_line, |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 base::Lock control_lock_; | 94 base::Lock control_lock_; |
94 pid_t pid_; | 95 pid_t pid_; |
95 bool init_; | 96 bool init_; |
96 bool using_suid_sandbox_; | 97 bool using_suid_sandbox_; |
97 std::string sandbox_binary_; | 98 std::string sandbox_binary_; |
98 bool have_read_sandbox_status_word_; | 99 bool have_read_sandbox_status_word_; |
99 int sandbox_status_; | 100 int sandbox_status_; |
100 }; | 101 }; |
101 | 102 |
102 #endif // CONTENT_BROWSER_ZYGOTE_HOST_LINUX_H_ | 103 #endif // CONTENT_BROWSER_ZYGOTE_HOST_LINUX_H_ |
OLD | NEW |