| 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 COMPONENTS_NACL_ZYGOTE_NACL_FORK_DELEGATE_LINUX_H_ | 5 #ifndef COMPONENTS_NACL_ZYGOTE_NACL_FORK_DELEGATE_LINUX_H_ |
| 6 #define COMPONENTS_NACL_ZYGOTE_NACL_FORK_DELEGATE_LINUX_H_ | 6 #define COMPONENTS_NACL_ZYGOTE_NACL_FORK_DELEGATE_LINUX_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/gtest_prod_util.h" |
| 13 #include "content/public/common/zygote_fork_delegate_linux.h" | 14 #include "content/public/common/zygote_fork_delegate_linux.h" |
| 14 | 15 |
| 16 namespace base { |
| 17 struct LaunchOptions; |
| 18 } |
| 19 |
| 15 template <typename> | 20 template <typename> |
| 16 class ScopedVector; | 21 class ScopedVector; |
| 17 | 22 |
| 18 namespace nacl { | 23 namespace nacl { |
| 19 | 24 |
| 20 // Appends any ZygoteForkDelegate instances needed by NaCl to |*delegates|. | 25 // Appends any ZygoteForkDelegate instances needed by NaCl to |*delegates|. |
| 21 void AddNaClZygoteForkDelegates( | 26 void AddNaClZygoteForkDelegates( |
| 22 ScopedVector<content::ZygoteForkDelegate>* delegates); | 27 ScopedVector<content::ZygoteForkDelegate>* delegates); |
| 23 | 28 |
| 24 // The NaClForkDelegate is created during Chrome linux zygote | 29 // The NaClForkDelegate is created during Chrome linux zygote |
| (...skipping 13 matching lines...) Expand all Loading... |
| 38 virtual bool CanHelp(const std::string& process_type, std::string* uma_name, | 43 virtual bool CanHelp(const std::string& process_type, std::string* uma_name, |
| 39 int* uma_sample, int* uma_boundary_value) OVERRIDE; | 44 int* uma_sample, int* uma_boundary_value) OVERRIDE; |
| 40 virtual pid_t Fork(const std::string& process_type, | 45 virtual pid_t Fork(const std::string& process_type, |
| 41 const std::vector<int>& fds, | 46 const std::vector<int>& fds, |
| 42 const std::string& channel_id) OVERRIDE; | 47 const std::string& channel_id) OVERRIDE; |
| 43 virtual bool GetTerminationStatus(pid_t pid, bool known_dead, | 48 virtual bool GetTerminationStatus(pid_t pid, bool known_dead, |
| 44 base::TerminationStatus* status, | 49 base::TerminationStatus* status, |
| 45 int* exit_code) OVERRIDE; | 50 int* exit_code) OVERRIDE; |
| 46 | 51 |
| 47 private: | 52 private: |
| 53 static void AddPassthroughEnvToOptions(base::LaunchOptions* options); |
| 54 |
| 48 // These values are reported via UMA and hence they become permanent | 55 // These values are reported via UMA and hence they become permanent |
| 49 // constants. Old values cannot be reused, only new ones added. | 56 // constants. Old values cannot be reused, only new ones added. |
| 50 enum NaClHelperStatus { | 57 enum NaClHelperStatus { |
| 51 kNaClHelperUnused = 0, | 58 kNaClHelperUnused = 0, |
| 52 kNaClHelperMissing = 1, | 59 kNaClHelperMissing = 1, |
| 53 kNaClHelperBootstrapMissing = 2, | 60 kNaClHelperBootstrapMissing = 2, |
| 54 kNaClHelperValgrind = 3, | 61 kNaClHelperValgrind = 3, |
| 55 kNaClHelperLaunchFailed = 4, | 62 kNaClHelperLaunchFailed = 4, |
| 56 kNaClHelperAckFailed = 5, | 63 kNaClHelperAckFailed = 5, |
| 57 kNaClHelperSuccess = 6, | 64 kNaClHelperSuccess = 6, |
| 58 kNaClHelperStatusBoundary // Must be one greater than highest value used. | 65 kNaClHelperStatusBoundary // Must be one greater than highest value used. |
| 59 }; | 66 }; |
| 60 | 67 |
| 61 const bool nonsfi_mode_; | 68 const bool nonsfi_mode_; |
| 62 NaClHelperStatus status_; | 69 NaClHelperStatus status_; |
| 63 int fd_; | 70 int fd_; |
| 64 | 71 |
| 72 FRIEND_TEST_ALL_PREFIXES(NaClForkDelegateLinuxTest, EnvPassthrough); |
| 73 |
| 65 DISALLOW_COPY_AND_ASSIGN(NaClForkDelegate); | 74 DISALLOW_COPY_AND_ASSIGN(NaClForkDelegate); |
| 66 }; | 75 }; |
| 67 | 76 |
| 68 } // namespace nacl | 77 } // namespace nacl |
| 69 | 78 |
| 70 #endif // COMPONENTS_NACL_ZYGOTE_NACL_FORK_DELEGATE_LINUX_H_ | 79 #endif // COMPONENTS_NACL_ZYGOTE_NACL_FORK_DELEGATE_LINUX_H_ |
| OLD | NEW |