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

Side by Side Diff: content/zygote/zygote_linux.h

Issue 825353003: Revert of Remove deprecated methods from Pickle. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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
« no previous file with comments | « content/public/common/common_param_traits.cc ('k') | content/zygote/zygote_linux.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_ZYGOTE_ZYGOTE_H_ 5 #ifndef CONTENT_ZYGOTE_ZYGOTE_H_
6 #define CONTENT_ZYGOTE_ZYGOTE_H_ 6 #define CONTENT_ZYGOTE_ZYGOTE_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <string> 10 #include <string>
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 // Returns true if the SUID sandbox is active. 54 // Returns true if the SUID sandbox is active.
55 bool UsingSUIDSandbox() const; 55 bool UsingSUIDSandbox() const;
56 56
57 // --------------------------------------------------------------------------- 57 // ---------------------------------------------------------------------------
58 // Requests from the browser... 58 // Requests from the browser...
59 59
60 // Read and process a request from the browser. Returns true if we are in a 60 // Read and process a request from the browser. Returns true if we are in a
61 // new process and thus need to unwind back into ChromeMain. 61 // new process and thus need to unwind back into ChromeMain.
62 bool HandleRequestFromBrowser(int fd); 62 bool HandleRequestFromBrowser(int fd);
63 63
64 void HandleReapRequest(int fd, PickleIterator iter); 64 void HandleReapRequest(int fd, const Pickle& pickle, PickleIterator iter);
65 65
66 // Get the termination status of |real_pid|. |real_pid| is the PID as it 66 // Get the termination status of |real_pid|. |real_pid| is the PID as it
67 // appears outside of the sandbox. 67 // appears outside of the sandbox.
68 // Return true if it managed to get the termination status and return the 68 // Return true if it managed to get the termination status and return the
69 // status in |status| and the exit code in |exit_code|. 69 // status in |status| and the exit code in |exit_code|.
70 bool GetTerminationStatus(base::ProcessHandle real_pid, bool known_dead, 70 bool GetTerminationStatus(base::ProcessHandle real_pid, bool known_dead,
71 base::TerminationStatus* status, 71 base::TerminationStatus* status,
72 int* exit_code); 72 int* exit_code);
73 73
74 void HandleGetTerminationStatus(int fd, 74 void HandleGetTerminationStatus(int fd,
75 const Pickle& pickle,
75 PickleIterator iter); 76 PickleIterator iter);
76 77
77 // This is equivalent to fork(), except that, when using the SUID sandbox, it 78 // This is equivalent to fork(), except that, when using the SUID sandbox, it
78 // returns the real PID of the child process as it appears outside the 79 // returns the real PID of the child process as it appears outside the
79 // sandbox, rather than returning the PID inside the sandbox. The child's 80 // sandbox, rather than returning the PID inside the sandbox. The child's
80 // real PID is determined by having it call content::SendZygoteChildPing(int) 81 // real PID is determined by having it call content::SendZygoteChildPing(int)
81 // using the |pid_oracle| descriptor. 82 // using the |pid_oracle| descriptor.
82 // Finally, when using a ZygoteForkDelegate helper, |uma_name|, |uma_sample|, 83 // Finally, when using a ZygoteForkDelegate helper, |uma_name|, |uma_sample|,
83 // and |uma_boundary_value| may be set if the helper wants to make a UMA 84 // and |uma_boundary_value| may be set if the helper wants to make a UMA
84 // report via UMA_HISTOGRAM_ENUMERATION. 85 // report via UMA_HISTOGRAM_ENUMERATION.
85 int ForkWithRealPid(const std::string& process_type, 86 int ForkWithRealPid(const std::string& process_type,
86 const base::GlobalDescriptors::Mapping& fd_mapping, 87 const base::GlobalDescriptors::Mapping& fd_mapping,
87 const std::string& channel_id, 88 const std::string& channel_id,
88 base::ScopedFD pid_oracle, 89 base::ScopedFD pid_oracle,
89 std::string* uma_name, 90 std::string* uma_name,
90 int* uma_sample, 91 int* uma_sample,
91 int* uma_boundary_value); 92 int* uma_boundary_value);
92 93
93 // Unpacks process type and arguments from |iter| and forks a new process. 94 // Unpacks process type and arguments from |pickle| and forks a new process.
94 // Returns -1 on error, otherwise returns twice, returning 0 to the child 95 // Returns -1 on error, otherwise returns twice, returning 0 to the child
95 // process and the child process ID to the parent process, like fork(). 96 // process and the child process ID to the parent process, like fork().
96 base::ProcessId ReadArgsAndFork(PickleIterator iter, 97 base::ProcessId ReadArgsAndFork(const Pickle& pickle,
98 PickleIterator iter,
97 ScopedVector<base::ScopedFD> fds, 99 ScopedVector<base::ScopedFD> fds,
98 std::string* uma_name, 100 std::string* uma_name,
99 int* uma_sample, 101 int* uma_sample,
100 int* uma_boundary_value); 102 int* uma_boundary_value);
101 103
102 // Handle a 'fork' request from the browser: this means that the browser 104 // Handle a 'fork' request from the browser: this means that the browser
103 // wishes to start a new renderer. Returns true if we are in a new process, 105 // wishes to start a new renderer. Returns true if we are in a new process,
104 // otherwise writes the child_pid back to the browser via |fd|. Writes a 106 // otherwise writes the child_pid back to the browser via |fd|. Writes a
105 // child_pid of -1 on error. 107 // child_pid of -1 on error.
106 bool HandleForkRequest(int fd, 108 bool HandleForkRequest(int fd,
109 const Pickle& pickle,
107 PickleIterator iter, 110 PickleIterator iter,
108 ScopedVector<base::ScopedFD> fds); 111 ScopedVector<base::ScopedFD> fds);
109 112
110 bool HandleGetSandboxStatus(int fd, 113 bool HandleGetSandboxStatus(int fd,
114 const Pickle& pickle,
111 PickleIterator iter); 115 PickleIterator iter);
112 116
113 // The Zygote needs to keep some information about each process. Most 117 // The Zygote needs to keep some information about each process. Most
114 // notably what the PID of the process is inside the PID namespace of 118 // notably what the PID of the process is inside the PID namespace of
115 // the Zygote and whether or not a process was started by the 119 // the Zygote and whether or not a process was started by the
116 // ZygoteForkDelegate helper. 120 // ZygoteForkDelegate helper.
117 ZygoteProcessMap process_info_map_; 121 ZygoteProcessMap process_info_map_;
118 122
119 const int sandbox_flags_; 123 const int sandbox_flags_;
120 ScopedVector<ZygoteForkDelegate> helpers_; 124 ScopedVector<ZygoteForkDelegate> helpers_;
121 125
122 // Count of how many fork delegates for which we've invoked InitialUMA(). 126 // Count of how many fork delegates for which we've invoked InitialUMA().
123 size_t initial_uma_index_; 127 size_t initial_uma_index_;
124 128
125 // This vector contains the PIDs of any child processes which have been 129 // This vector contains the PIDs of any child processes which have been
126 // created prior to the construction of the Zygote object, and must be reaped 130 // created prior to the construction of the Zygote object, and must be reaped
127 // before the Zygote exits. The Zygote will perform a blocking wait on these 131 // before the Zygote exits. The Zygote will perform a blocking wait on these
128 // children, so they must be guaranteed to be exiting by the time the Zygote 132 // children, so they must be guaranteed to be exiting by the time the Zygote
129 // exits. 133 // exits.
130 std::vector<base::ProcessHandle> extra_children_; 134 std::vector<base::ProcessHandle> extra_children_;
131 135
132 // This vector contains the FDs that must be closed before reaping the extra 136 // This vector contains the FDs that must be closed before reaping the extra
133 // children. 137 // children.
134 std::vector<int> extra_fds_; 138 std::vector<int> extra_fds_;
135 }; 139 };
136 140
137 } // namespace content 141 } // namespace content
138 142
139 #endif // CONTENT_ZYGOTE_ZYGOTE_H_ 143 #endif // CONTENT_ZYGOTE_ZYGOTE_H_
OLDNEW
« no previous file with comments | « content/public/common/common_param_traits.cc ('k') | content/zygote/zygote_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698