OLD | NEW |
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 "base/process/process.h" | 10 #include "base/process/process.h" |
11 #include "content/common/content_export.h" | 11 #include "content/common/content_export.h" |
12 | 12 |
13 namespace content { | 13 namespace content { |
14 | 14 |
15 // http://code.google.com/p/chromium/wiki/LinuxZygote | 15 // https://chromium.googlesource.com/chromium/src/+/master/docs/linux_zygote.md |
16 | 16 |
17 // The zygote host is the interface, in the browser process, to the zygote | 17 // The zygote host is the interface, in the browser process, to the zygote |
18 // process. | 18 // process. |
19 class ZygoteHost { | 19 class ZygoteHost { |
20 public: | 20 public: |
21 // Returns the singleton instance. | 21 // Returns the singleton instance. |
22 CONTENT_EXPORT static ZygoteHost* GetInstance(); | 22 CONTENT_EXPORT static ZygoteHost* GetInstance(); |
23 | 23 |
24 virtual ~ZygoteHost() {} | 24 virtual ~ZygoteHost() {} |
25 | 25 |
26 // Returns the pid of the Zygote process. | 26 // Returns the pid of the Zygote process. |
27 virtual pid_t GetPid() const = 0; | 27 virtual pid_t GetPid() const = 0; |
28 | 28 |
29 // Returns an int which is a bitmask of kSandboxLinux* values. Only valid | 29 // Returns an int which is a bitmask of kSandboxLinux* values. Only valid |
30 // after the first render has been forked. | 30 // after the first render has been forked. |
31 virtual int GetSandboxStatus() const = 0; | 31 virtual int GetSandboxStatus() const = 0; |
32 | 32 |
33 // Adjust the OOM score of the given renderer's PID. The allowed | 33 // 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 | 34 // range for the score is [0, 1000], where higher values are more |
35 // likely to be killed by the OOM killer. | 35 // likely to be killed by the OOM killer. |
36 virtual void AdjustRendererOOMScore(base::ProcessHandle process_handle, | 36 virtual void AdjustRendererOOMScore(base::ProcessHandle process_handle, |
37 int score) = 0; | 37 int score) = 0; |
38 }; | 38 }; |
39 | 39 |
40 } // namespace content | 40 } // namespace content |
41 | 41 |
42 #endif // CONTENT_PUBLIC_BROWSER_ZYGOTE_HOST_LINUX_H_ | 42 #endif // CONTENT_PUBLIC_BROWSER_ZYGOTE_HOST_LINUX_H_ |
OLD | NEW |