OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_BROWSER_ZYGOTE_HOST_LINUX_H_ | 5 #ifndef CONTENT_BROWSER_ZYGOTE_HOST_LINUX_H_ |
6 #define CONTENT_BROWSER_ZYGOTE_HOST_LINUX_H_ | 6 #define CONTENT_BROWSER_ZYGOTE_HOST_LINUX_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <unistd.h> | 9 #include <unistd.h> |
10 | 10 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 pid_t pid() const { return pid_; } | 67 pid_t pid() const { return pid_; } |
68 | 68 |
69 // Returns an int which is a bitmask of kSandbox* values. Only valid after | 69 // Returns an int which is a bitmask of kSandbox* values. Only valid after |
70 // the first render has been forked. | 70 // the first render has been forked. |
71 int sandbox_status() const { | 71 int sandbox_status() const { |
72 if (have_read_sandbox_status_word_) | 72 if (have_read_sandbox_status_word_) |
73 return sandbox_status_; | 73 return sandbox_status_; |
74 return 0; | 74 return 0; |
75 } | 75 } |
76 | 76 |
77 // Adjust the OOM score of the given renderer's PID. | 77 // Adjust the OOM score of the given renderer's PID. The allowed |
| 78 // range for the score is [0, 1000], where higher values are more |
| 79 // likely to be killed by the OOM killer. |
78 void AdjustRendererOOMScore(base::ProcessHandle process_handle, int score); | 80 void AdjustRendererOOMScore(base::ProcessHandle process_handle, int score); |
79 | 81 |
80 private: | 82 private: |
81 friend struct DefaultSingletonTraits<ZygoteHost>; | 83 friend struct DefaultSingletonTraits<ZygoteHost>; |
82 ZygoteHost(); | 84 ZygoteHost(); |
83 ~ZygoteHost(); | 85 ~ZygoteHost(); |
84 | 86 |
85 ssize_t ReadReply(void* buf, size_t buflen); | 87 ssize_t ReadReply(void* buf, size_t buflen); |
86 | 88 |
87 int control_fd_; // the socket to the zygote | 89 int control_fd_; // the socket to the zygote |
88 // A lock protecting all communication with the zygote. This lock must be | 90 // A lock protecting all communication with the zygote. This lock must be |
89 // acquired before sending a command and released after the result has been | 91 // acquired before sending a command and released after the result has been |
90 // received. | 92 // received. |
91 base::Lock control_lock_; | 93 base::Lock control_lock_; |
92 pid_t pid_; | 94 pid_t pid_; |
93 bool init_; | 95 bool init_; |
94 bool using_suid_sandbox_; | 96 bool using_suid_sandbox_; |
95 std::string sandbox_binary_; | 97 std::string sandbox_binary_; |
96 bool have_read_sandbox_status_word_; | 98 bool have_read_sandbox_status_word_; |
97 int sandbox_status_; | 99 int sandbox_status_; |
98 }; | 100 }; |
99 | 101 |
100 #endif // CONTENT_BROWSER_ZYGOTE_HOST_LINUX_H_ | 102 #endif // CONTENT_BROWSER_ZYGOTE_HOST_LINUX_H_ |
OLD | NEW |