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

Side by Side Diff: content/browser/zygote_host_impl_linux.h

Issue 10806076: Move ZygoteHost implementation to content/browser/zygote_host (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add an empty line to the OWNERS file Created 8 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 | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_BROWSER_ZYGOTE_HOST_IMPL_LINUX_H_
6 #define CONTENT_BROWSER_ZYGOTE_HOST_IMPL_LINUX_H_
7
8 #include <string>
9 #include <vector>
10
11 #include "base/global_descriptors_posix.h"
12 #include "base/process_util.h"
13 #include "base/synchronization/lock.h"
14 #include "content/public/browser/zygote_host_linux.h"
15
16 template<typename Type>
17 struct DefaultSingletonTraits;
18
19 class CONTENT_EXPORT ZygoteHostImpl : public content::ZygoteHost {
20 public:
21 // Returns the singleton instance.
22 static ZygoteHostImpl* GetInstance();
23
24 void Init(const std::string& sandbox_cmd);
25
26 // Tries to start a process of type indicated by process_type.
27 // Returns its pid on success, otherwise
28 // base::kNullProcessHandle;
29 pid_t ForkRequest(const std::vector<std::string>& command_line,
30 const base::GlobalDescriptors::Mapping& mapping,
31 const std::string& process_type);
32 void EnsureProcessTerminated(pid_t process);
33
34 // Get the termination status (and, optionally, the exit code) of
35 // the process. |exit_code| is set to the exit code of the child
36 // process. (|exit_code| may be NULL.)
37 base::TerminationStatus GetTerminationStatus(base::ProcessHandle handle,
38 int* exit_code);
39
40 // ZygoteHost implementation:
41 virtual pid_t GetPid() const OVERRIDE;
42 virtual pid_t GetSandboxHelperPid() const OVERRIDE;
43 virtual int GetSandboxStatus() const OVERRIDE;
44 virtual void AdjustRendererOOMScore(base::ProcessHandle process_handle,
45 int score) OVERRIDE;
46 virtual void AdjustLowMemoryMargin(int64 margin_mb) OVERRIDE;
47
48 private:
49 friend struct DefaultSingletonTraits<ZygoteHostImpl>;
50 ZygoteHostImpl();
51 virtual ~ZygoteHostImpl();
52
53 ssize_t ReadReply(void* buf, size_t buflen);
54
55 int control_fd_; // the socket to the zygote
56 // A lock protecting all communication with the zygote. This lock must be
57 // acquired before sending a command and released after the result has been
58 // received.
59 base::Lock control_lock_;
60 pid_t pid_;
61 bool init_;
62 bool using_suid_sandbox_;
63 std::string sandbox_binary_;
64 bool have_read_sandbox_status_word_;
65 int sandbox_status_;
66 };
67
68 #endif // CONTENT_BROWSER_ZYGOTE_HOST_IMPL_LINUX_H_
OLDNEW
« no previous file with comments | « content/browser/zygote_host/zygote_host_impl_linux.cc ('k') | content/browser/zygote_host_impl_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698