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