Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1196)

Side by Side Diff: content/browser/zygote_host/zygote_communication_linux.h

Issue 2950153002: Improve process launch handle sharing API. (Closed)
Patch Set: Fix Mojo launcher, review comments Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_COMMUNICATION_LINUX_H_ 5 #ifndef CONTENT_BROWSER_ZYGOTE_HOST_ZYGOTE_COMMUNICATION_LINUX_H_
6 #define CONTENT_BROWSER_ZYGOTE_HOST_ZYGOTE_COMMUNICATION_LINUX_H_ 6 #define CONTENT_BROWSER_ZYGOTE_HOST_ZYGOTE_COMMUNICATION_LINUX_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
11 #include <vector> 11 #include <vector>
12 12
13 #include <sys/types.h> 13 #include <sys/types.h>
14 14
15 #include "base/files/scoped_file.h" 15 #include "base/files/scoped_file.h"
16 #include "base/process/kill.h" 16 #include "base/process/kill.h"
17 #include "base/process/process_handle.h" 17 #include "base/process/process_handle.h"
18 #include "base/synchronization/lock.h" 18 #include "base/synchronization/lock.h"
19 #include "content/common/content_export.h" 19 #include "content/common/content_export.h"
20 #include "content/public/browser/file_descriptor_info.h" 20 #include "content/public/browser/posix_file_descriptor_info.h"
21 21
22 namespace base { 22 namespace base {
23 class Pickle; 23 class Pickle;
24 } // namespace base 24 } // namespace base
25 25
26 namespace content { 26 namespace content {
27 27
28 // Handles interprocess communication with the Linux zygote process. The zygote 28 // Handles interprocess communication with the Linux zygote process. The zygote
29 // does not use standard Chrome IPC or mojo, see: 29 // does not use standard Chrome IPC or mojo, see:
30 // https://chromium.googlesource.com/chromium/src/+/master/docs/linux_sandbox_ip c.md 30 // https://chromium.googlesource.com/chromium/src/+/master/docs/linux_sandbox_ip c.md
31 class CONTENT_EXPORT ZygoteCommunication { 31 class CONTENT_EXPORT ZygoteCommunication {
32 public: 32 public:
33 ZygoteCommunication(); 33 ZygoteCommunication();
34 ~ZygoteCommunication(); 34 ~ZygoteCommunication();
35 35
36 void Init(); 36 void Init();
37 37
38 // Tries to start a process of type indicated by process_type. 38 // Tries to start a process of type indicated by process_type.
39 // Returns its pid on success, otherwise base::kNullProcessHandle; 39 // Returns its pid on success, otherwise base::kNullProcessHandle;
40 pid_t ForkRequest(const std::vector<std::string>& command_line, 40 pid_t ForkRequest(const std::vector<std::string>& command_line,
41 std::unique_ptr<FileDescriptorInfo> mapping, 41 std::unique_ptr<PosixFileDescriptorInfo> mapping,
42 const std::string& process_type); 42 const std::string& process_type);
43 43
44 void EnsureProcessTerminated(pid_t process); 44 void EnsureProcessTerminated(pid_t process);
45 45
46 // Should be called every time a Zygote child died. 46 // Should be called every time a Zygote child died.
47 void ZygoteChildDied(pid_t process); 47 void ZygoteChildDied(pid_t process);
48 48
49 // Get the termination status (and, optionally, the exit code) of 49 // Get the termination status (and, optionally, the exit code) of
50 // the process. |exit_code| is set to the exit code of the child 50 // the process. |exit_code| is set to the exit code of the child
51 // process. (|exit_code| may be NULL.) 51 // process. (|exit_code| may be NULL.)
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 base::Lock child_tracking_lock_; 92 base::Lock child_tracking_lock_;
93 int sandbox_status_; 93 int sandbox_status_;
94 bool have_read_sandbox_status_word_; 94 bool have_read_sandbox_status_word_;
95 // Set to true when the zygote is initialized successfully. 95 // Set to true when the zygote is initialized successfully.
96 bool init_; 96 bool init_;
97 }; 97 };
98 98
99 } // namespace content 99 } // namespace content
100 100
101 #endif // CONTENT_BROWSER_ZYGOTE_HOST_ZYGOTE_COMMUNICATION_LINUX_H_ 101 #endif // CONTENT_BROWSER_ZYGOTE_HOST_ZYGOTE_COMMUNICATION_LINUX_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698