| 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 #include "content/browser/zygote_host_linux.h" | 5 #include "content/browser/zygote_host_linux.h" |
| 6 | 6 |
| 7 #include <dlfcn.h> | 7 #include <dlfcn.h> |
| 8 #include <fcntl.h> | 8 #include <fcntl.h> |
| 9 #include <pthread.h> | 9 #include <pthread.h> |
| 10 #include <sys/socket.h> | 10 #include <sys/socket.h> |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 } | 87 } |
| 88 } | 88 } |
| 89 #endif // CHROMIUM_SELINUX | 89 #endif // CHROMIUM_SELINUX |
| 90 | 90 |
| 91 // This is the object which implements the zygote. The ZygoteMain function, | 91 // This is the object which implements the zygote. The ZygoteMain function, |
| 92 // which is called from ChromeMain, simply constructs one of these objects and | 92 // which is called from ChromeMain, simply constructs one of these objects and |
| 93 // runs it. | 93 // runs it. |
| 94 class Zygote { | 94 class Zygote { |
| 95 public: | 95 public: |
| 96 Zygote(int sandbox_flags, content::ZygoteForkDelegate* helper) | 96 Zygote(int sandbox_flags, content::ZygoteForkDelegate* helper) |
| 97 : sandbox_flags_(sandbox_flags), helper_(helper) { | 97 : sandbox_flags_(sandbox_flags), |
| 98 helper_(helper), |
| 99 initial_uma_sample_(0), |
| 100 initial_uma_boundary_value_(0) { |
| 98 if (helper_) | 101 if (helper_) |
| 99 helper_->InitialUMA(&initial_uma_name_, | 102 helper_->InitialUMA(&initial_uma_name_, |
| 100 &initial_uma_sample_, | 103 &initial_uma_sample_, |
| 101 &initial_uma_boundary_value_); | 104 &initial_uma_boundary_value_); |
| 102 } | 105 } |
| 103 | 106 |
| 104 bool ProcessRequests() { | 107 bool ProcessRequests() { |
| 105 // A SOCK_SEQPACKET socket is installed in fd 3. We get commands from the | 108 // A SOCK_SEQPACKET socket is installed in fd 3. We get commands from the |
| 106 // browser on it. | 109 // browser on it. |
| 107 // A SOCK_DGRAM is installed in fd 5. This is the sandbox IPC channel. | 110 // A SOCK_DGRAM is installed in fd 5. This is the sandbox IPC channel. |
| (...skipping 758 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 866 VLOG(1) << "Enabling experimental Seccomp sandbox."; | 869 VLOG(1) << "Enabling experimental Seccomp sandbox."; |
| 867 sandbox_flags |= ZygoteHost::kSandboxSeccomp; | 870 sandbox_flags |= ZygoteHost::kSandboxSeccomp; |
| 868 } | 871 } |
| 869 } | 872 } |
| 870 #endif // SECCOMP_SANDBOX | 873 #endif // SECCOMP_SANDBOX |
| 871 | 874 |
| 872 Zygote zygote(sandbox_flags, forkdelegate); | 875 Zygote zygote(sandbox_flags, forkdelegate); |
| 873 // This function call can return multiple times, once per fork(). | 876 // This function call can return multiple times, once per fork(). |
| 874 return zygote.ProcessRequests(); | 877 return zygote.ProcessRequests(); |
| 875 } | 878 } |
| OLD | NEW |