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

Side by Side Diff: content/public/browser/zygote_host_linux.h

Issue 1532423003: Have each SandboxedProcessLauncherDelegate maintain a zygote. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Load and initialize all zygotes on browser startup. Created 4 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
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_PUBLIC_BROWSER_ZYGOTE_HOST_LINUX_H_ 5 #ifndef CONTENT_PUBLIC_BROWSER_ZYGOTE_HOST_LINUX_H_
6 #define CONTENT_PUBLIC_BROWSER_ZYGOTE_HOST_LINUX_H_ 6 #define CONTENT_PUBLIC_BROWSER_ZYGOTE_HOST_LINUX_H_
7 7
8 #include <unistd.h> 8 #include <unistd.h>
9 9
10 #include <cstddef>
11
10 #include "base/process/process.h" 12 #include "base/process/process.h"
11 #include "content/common/content_export.h" 13 #include "content/common/content_export.h"
12 14
13 namespace content { 15 namespace content {
14 16
17 #if defined(OS_LINUX)
mdempsky 2016/01/15 20:29:42 I think these should go into a new content/public/
Greg K 2016/01/19 19:34:19 Done.
18 class ZygoteCommunication;
19 using ZygoteHandle = ZygoteCommunication*;
20 #else
21 using ZygoteHandle = std::nullptr_t;
22 #endif
23
15 // http://code.google.com/p/chromium/wiki/LinuxZygote 24 // http://code.google.com/p/chromium/wiki/LinuxZygote
16 25
17 // The zygote host is the interface, in the browser process, to the zygote 26 // The zygote host is an interface, in the browser process, to the zygote
18 // process. 27 // process.
19 class ZygoteHost { 28 class ZygoteHost {
20 public: 29 public:
21 // Returns the singleton instance. 30 // Returns the singleton instance.
22 CONTENT_EXPORT static ZygoteHost* GetInstance(); 31 CONTENT_EXPORT static ZygoteHost* GetInstance();
23 32
33 // Allocates and initializes a zygote process, and returns the
34 // ZygoteHandle used to communicate with it.
35 CONTENT_EXPORT static ZygoteHandle CreateZygote();
36
24 virtual ~ZygoteHost() {} 37 virtual ~ZygoteHost() {}
25 38
26 // Returns the pid of the Zygote process. 39 // Returns the pid of the Zygote process.
27 virtual pid_t GetPid() const = 0; 40 virtual bool IsZygotePid(pid_t pid) = 0;
28 41
29 // Returns an int which is a bitmask of kSandboxLinux* values. Only valid 42 // Returns an int which is a bitmask of kSandboxLinux* values. Only valid
30 // after the first render has been forked. 43 // after the first render has been forked.
31 virtual int GetSandboxStatus() const = 0; 44 virtual int GetRendererSandboxStatus() const = 0;
32 45
33 // Adjust the OOM score of the given renderer's PID. The allowed 46 // Adjust the OOM score of the given renderer's PID. The allowed
34 // range for the score is [0, 1000], where higher values are more 47 // range for the score is [0, 1000], where higher values are more
35 // likely to be killed by the OOM killer. 48 // likely to be killed by the OOM killer.
36 virtual void AdjustRendererOOMScore(base::ProcessHandle process_handle, 49 virtual void AdjustRendererOOMScore(base::ProcessHandle process_handle,
37 int score) = 0; 50 int score) = 0;
38 }; 51 };
39 52
40 } // namespace content 53 } // namespace content
41 54
42 #endif // CONTENT_PUBLIC_BROWSER_ZYGOTE_HOST_LINUX_H_ 55 #endif // CONTENT_PUBLIC_BROWSER_ZYGOTE_HOST_LINUX_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698