| 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_COMMON_ZYGOTE_FORK_DELEGATE_LINUX_H_ | 5 #ifndef CONTENT_PUBLIC_COMMON_ZYGOTE_FORK_DELEGATE_LINUX_H_ |
| 6 #define CONTENT_COMMON_ZYGOTE_FORK_DELEGATE_LINUX_H_ | 6 #define CONTENT_PUBLIC_COMMON_ZYGOTE_FORK_DELEGATE_LINUX_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <unistd.h> | 9 #include <unistd.h> |
| 10 | 10 |
| 11 #include <string> | 11 #include <string> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/basictypes.h" | 14 namespace content { |
| 15 | 15 |
| 16 // The ZygoteForkDelegate allows the Chrome Linux zygote to delegate | 16 // The ZygoteForkDelegate allows the Chrome Linux zygote to delegate |
| 17 // fork operations to another class that knows how to do some | 17 // fork operations to another class that knows how to do some |
| 18 // specialized version of fork. | 18 // specialized version of fork. |
| 19 class ZygoteForkDelegate { | 19 class ZygoteForkDelegate { |
| 20 public: | 20 public: |
| 21 // A ZygoteForkDelegate is created during Chrome linux zygote | 21 // A ZygoteForkDelegate is created during Chrome linux zygote |
| 22 // initialization, and provides "fork()" functionality as an | 22 // initialization, and provides "fork()" functionality as an |
| 23 // alternative to forking the zygote. A new delegate is passed in | 23 // alternative to forking the zygote. A new delegate is passed in |
| 24 // as an argument to ZygoteMain(). | 24 // as an argument to ZygoteMain(). |
| 25 ZygoteForkDelegate() {} | |
| 26 virtual ~ZygoteForkDelegate() {} | 25 virtual ~ZygoteForkDelegate() {} |
| 27 | 26 |
| 28 // Initialization happens in the zygote after it has been | 27 // Initialization happens in the zygote after it has been |
| 29 // started by ZygoteMain. | 28 // started by ZygoteMain. |
| 30 virtual void Init(bool sandboxed, | 29 virtual void Init(bool sandboxed, |
| 31 int browserdesc, | 30 int browserdesc, |
| 32 int sandboxdesc) = 0; | 31 int sandboxdesc) = 0; |
| 33 | 32 |
| 34 // After Init, supply a UMA_HISTOGRAM_ENUMERATION the delegate | 33 // After Init, supply a UMA_HISTOGRAM_ENUMERATION the delegate |
| 35 // would like to supply on the first fork. | 34 // would like to supply on the first fork. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 47 // suid sandbox, Fork() returns the Linux process ID. Inside | 46 // suid sandbox, Fork() returns the Linux process ID. Inside |
| 48 // the sandbox, returns a positive integer, with PID discovery | 47 // the sandbox, returns a positive integer, with PID discovery |
| 49 // handled by the sandbox. | 48 // handled by the sandbox. |
| 50 virtual pid_t Fork(const std::vector<int>& fds) = 0; | 49 virtual pid_t Fork(const std::vector<int>& fds) = 0; |
| 51 | 50 |
| 52 // After a successful for, signal the child to indicate that | 51 // After a successful for, signal the child to indicate that |
| 53 // the child's PID has been received. Also communicate the | 52 // the child's PID has been received. Also communicate the |
| 54 // channel switch as a part of acknowledgement message. | 53 // channel switch as a part of acknowledgement message. |
| 55 virtual bool AckChild(int fd, const std::string& channel_switch) = 0; | 54 virtual bool AckChild(int fd, const std::string& channel_switch) = 0; |
| 56 }; | 55 }; |
| 57 #endif // CONTENT_COMMON_ZYGOTE_FORK_DELEGATE_LINUX_H_ | 56 |
| 57 } // namespace content |
| 58 |
| 59 #endif // CONTENT_PUBLIC_COMMON_ZYGOTE_FORK_DELEGATE_LINUX_H_ |
| OLD | NEW |