OLD | NEW |
(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_PUBLIC_BROWSER_ZYGOTE_HOST_LINUX_H_ |
| 6 #define CONTENT_PUBLIC_BROWSER_ZYGOTE_HOST_LINUX_H_ |
| 7 #pragma once |
| 8 |
| 9 #include <unistd.h> |
| 10 |
| 11 #include "base/process.h" |
| 12 #include "content/common/content_export.h" |
| 13 |
| 14 namespace content { |
| 15 |
| 16 // http://code.google.com/p/chromium/wiki/LinuxZygote |
| 17 |
| 18 // The zygote host is the interface, in the browser process, to the zygote |
| 19 // process. |
| 20 class ZygoteHost { |
| 21 public: |
| 22 // Returns the singleton instance. |
| 23 CONTENT_EXPORT static ZygoteHost* GetInstance(); |
| 24 |
| 25 // These form a bitmask which describes the conditions of the sandbox that |
| 26 // the zygote finds itself in. |
| 27 enum { |
| 28 kSandboxSUID = 1 << 0, // SUID sandbox active |
| 29 kSandboxPIDNS = 1 << 1, // SUID sandbox is using the PID namespace |
| 30 kSandboxNetNS = 1 << 2, // SUID sandbox is using the network namespace |
| 31 kSandboxSeccomp = 1 << 3, // seccomp sandbox active. |
| 32 }; |
| 33 |
| 34 virtual pid_t GetPid() const = 0; |
| 35 |
| 36 // Returns an int which is a bitmask of kSandbox* values. Only valid after |
| 37 // the first render has been forked. |
| 38 virtual int GetSandboxStatus() const = 0; |
| 39 |
| 40 // Adjust the OOM score of the given renderer's PID. The allowed |
| 41 // range for the score is [0, 1000], where higher values are more |
| 42 // likely to be killed by the OOM killer. |
| 43 virtual void AdjustRendererOOMScore(base::ProcessHandle process_handle, |
| 44 int score) = 0; |
| 45 }; |
| 46 |
| 47 } // namespace content |
| 48 |
| 49 #endif // CONTENT_PUBLIC_BROWSER_ZYGOTE_HOST_LINUX_H_ |
OLD | NEW |