| OLD | NEW | 
|   1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |   1 // Copyright (c) 2009 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 CHROME_BROWSER_ZYGOTE_HOST_LINUX_H_ |   5 #ifndef CHROME_BROWSER_ZYGOTE_HOST_LINUX_H_ | 
|   6 #define CHROME_BROWSER_ZYGOTE_HOST_LINUX_H_ |   6 #define CHROME_BROWSER_ZYGOTE_HOST_LINUX_H_ | 
|   7  |   7  | 
|   8 #include <unistd.h> |   8 #include <unistd.h> | 
|   9  |   9  | 
|  10 #include <string> |  10 #include <string> | 
|  11 #include <vector> |  11 #include <vector> | 
|  12  |  12  | 
|  13 #include "base/global_descriptors_posix.h" |  13 #include "base/global_descriptors_posix.h" | 
|  14 #include "base/process.h" |  14 #include "base/process.h" | 
|  15  |  15  | 
|  16 template<typename Type> |  16 template<typename Type> | 
|  17 struct DefaultSingletonTraits; |  17 struct DefaultSingletonTraits; | 
|  18  |  18  | 
|  19 static const char kZygoteMagic[] = "ZYGOTE_OK"; |  19 static const char kZygoteMagic[] = "ZYGOTE_OK"; | 
|  20  |  20  | 
|  21 // http://code.google.com/p/chromium/wiki/LinuxZygote |  21 // http://code.google.com/p/chromium/wiki/LinuxZygote | 
|  22  |  22  | 
|  23 // The zygote host is the interface, in the browser process, to the zygote |  23 // The zygote host is the interface, in the browser process, to the zygote | 
|  24 // process. |  24 // process. | 
|  25 class ZygoteHost { |  25 class ZygoteHost { | 
|  26  public: |  26  public: | 
|  27   void Init(const std::string& sandbox_cmd); |  27   void Init(const std::string& sandbox_cmd); | 
|  28  |  28  | 
 |  29   // Tries to start a renderer process.  Returns its pid on success, otherwise | 
 |  30   // base::kNullProcessHandle; | 
|  29   pid_t ForkRenderer(const std::vector<std::string>& command_line, |  31   pid_t ForkRenderer(const std::vector<std::string>& command_line, | 
|  30                      const base::GlobalDescriptors::Mapping& mapping); |  32                      const base::GlobalDescriptors::Mapping& mapping); | 
|  31   void EnsureProcessTerminated(pid_t process); |  33   void EnsureProcessTerminated(pid_t process); | 
|  32  |  34  | 
|  33   // Get the termination status (exit code) of the process and return true if |  35   // Get the termination status (exit code) of the process and return true if | 
|  34   // the status indicates the process crashed. |child_exited| is set to true |  36   // the status indicates the process crashed. |child_exited| is set to true | 
|  35   // iff the child process has terminated. (|child_exited| may be NULL.) |  37   // iff the child process has terminated. (|child_exited| may be NULL.) | 
|  36   bool DidProcessCrash(base::ProcessHandle handle, bool* child_exited); |  38   bool DidProcessCrash(base::ProcessHandle handle, bool* child_exited); | 
|  37  |  39  | 
|  38   // These are the command codes used on the wire between the browser and the |  40   // These are the command codes used on the wire between the browser and the | 
| (...skipping 10 matching lines...) Expand all  Loading... | 
|  49   friend struct DefaultSingletonTraits<ZygoteHost>; |  51   friend struct DefaultSingletonTraits<ZygoteHost>; | 
|  50   ZygoteHost(); |  52   ZygoteHost(); | 
|  51   ~ZygoteHost(); |  53   ~ZygoteHost(); | 
|  52  |  54  | 
|  53   int control_fd_;  // the socket to the zygote |  55   int control_fd_;  // the socket to the zygote | 
|  54   pid_t pid_; |  56   pid_t pid_; | 
|  55   bool init_; |  57   bool init_; | 
|  56 }; |  58 }; | 
|  57  |  59  | 
|  58 #endif  // CHROME_BROWSER_ZYGOTE_HOST_LINUX_H_ |  60 #endif  // CHROME_BROWSER_ZYGOTE_HOST_LINUX_H_ | 
| OLD | NEW |