| 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 #include "content/common/child_process_host_impl.h" | 5 #include "content/common/child_process_host_impl.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "base/atomicops.h" | 9 #include "base/atomicops.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 child_path = CommandLine::ForCurrentProcess()->GetSwitchValuePath( | 91 child_path = CommandLine::ForCurrentProcess()->GetSwitchValuePath( |
| 92 switches::kBrowserSubprocessPath); | 92 switches::kBrowserSubprocessPath); |
| 93 | 93 |
| 94 #if defined(OS_LINUX) | 94 #if defined(OS_LINUX) |
| 95 // Use /proc/self/exe rather than our known binary path so updates | 95 // Use /proc/self/exe rather than our known binary path so updates |
| 96 // can't swap out the binary from underneath us. | 96 // can't swap out the binary from underneath us. |
| 97 // When running under Valgrind, forking /proc/self/exe ends up forking the | 97 // When running under Valgrind, forking /proc/self/exe ends up forking the |
| 98 // Valgrind executable, which then crashes. However, it's almost safe to | 98 // Valgrind executable, which then crashes. However, it's almost safe to |
| 99 // assume that the updates won't happen while testing with Valgrind tools. | 99 // assume that the updates won't happen while testing with Valgrind tools. |
| 100 if (child_path.empty() && flags & CHILD_ALLOW_SELF && !RunningOnValgrind()) | 100 if (child_path.empty() && flags & CHILD_ALLOW_SELF && !RunningOnValgrind()) |
| 101 child_path = FilePath("/proc/self/exe"); | 101 child_path = FilePath(base::kProcSelfExe); |
| 102 #endif | 102 #endif |
| 103 | 103 |
| 104 // On most platforms, the child executable is the same as the current | 104 // On most platforms, the child executable is the same as the current |
| 105 // executable. | 105 // executable. |
| 106 if (child_path.empty()) | 106 if (child_path.empty()) |
| 107 PathService::Get(content::CHILD_PROCESS_EXE, &child_path); | 107 PathService::Get(content::CHILD_PROCESS_EXE, &child_path); |
| 108 | 108 |
| 109 #if defined(OS_MACOSX) | 109 #if defined(OS_MACOSX) |
| 110 DCHECK(!(flags & CHILD_NO_PIE && flags & CHILD_ALLOW_HEAP_EXECUTION)); | 110 DCHECK(!(flags & CHILD_NO_PIE && flags & CHILD_ALLOW_HEAP_EXECUTION)); |
| 111 | 111 |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 base::SharedMemoryHandle* handle) { | 287 base::SharedMemoryHandle* handle) { |
| 288 AllocateSharedMemory(buffer_size, peer_handle_, handle); | 288 AllocateSharedMemory(buffer_size, peer_handle_, handle); |
| 289 } | 289 } |
| 290 | 290 |
| 291 void ChildProcessHostImpl::OnShutdownRequest() { | 291 void ChildProcessHostImpl::OnShutdownRequest() { |
| 292 if (delegate_->CanShutdown()) | 292 if (delegate_->CanShutdown()) |
| 293 Send(new ChildProcessMsg_Shutdown()); | 293 Send(new ChildProcessMsg_Shutdown()); |
| 294 } | 294 } |
| 295 | 295 |
| 296 } // namespace content | 296 } // namespace content |
| OLD | NEW |