| 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/browser/renderer_host/render_sandbox_host_linux.h" | 5 #include "content/browser/renderer_host/render_sandbox_host_linux.h" |
| 6 | 6 |
| 7 #include <fcntl.h> | 7 #include <fcntl.h> |
| 8 #include <fontconfig/fontconfig.h> | 8 #include <fontconfig/fontconfig.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 #include <sys/poll.h> | 10 #include <sys/poll.h> |
| (...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 702 | 702 |
| 703 renderer_socket_ = fds[0]; | 703 renderer_socket_ = fds[0]; |
| 704 const int browser_socket = fds[1]; | 704 const int browser_socket = fds[1]; |
| 705 | 705 |
| 706 int pipefds[2]; | 706 int pipefds[2]; |
| 707 CHECK(0 == pipe(pipefds)); | 707 CHECK(0 == pipe(pipefds)); |
| 708 const int child_lifeline_fd = pipefds[0]; | 708 const int child_lifeline_fd = pipefds[0]; |
| 709 childs_lifeline_fd_ = pipefds[1]; | 709 childs_lifeline_fd_ = pipefds[1]; |
| 710 | 710 |
| 711 // We need to be monothreaded before we fork(). | 711 // We need to be monothreaded before we fork(). |
| 712 #if !defined(TOOLKIT_GTK) | 712 #if !defined(TOOLKIT_GTK) && !defined(THREAD_SANITIZER) |
| 713 // Exclude gtk port as TestSuite in base/tests/test_suite.cc is calling | 713 // Exclude gtk port as TestSuite in base/tests/test_suite.cc is calling |
| 714 // gtk_init. | 714 // gtk_init. |
| 715 // TODO(oshima): Remove ifdef when above issues are resolved. | 715 // TODO(oshima): Remove ifdef when above issues are resolved. |
| 716 DCHECK_EQ(1, base::GetNumberOfThreads(base::GetCurrentProcessHandle())); | 716 DCHECK_EQ(1, base::GetNumberOfThreads(base::GetCurrentProcessHandle())); |
| 717 #endif | 717 #endif // !defined(TOOLKIT_GTK) && !defined(THREAD_SANITIZER) |
| 718 pid_ = fork(); | 718 pid_ = fork(); |
| 719 if (pid_ == 0) { | 719 if (pid_ == 0) { |
| 720 if (IGNORE_EINTR(close(fds[0])) < 0) | 720 if (IGNORE_EINTR(close(fds[0])) < 0) |
| 721 DPLOG(ERROR) << "close"; | 721 DPLOG(ERROR) << "close"; |
| 722 if (IGNORE_EINTR(close(pipefds[1])) < 0) | 722 if (IGNORE_EINTR(close(pipefds[1])) < 0) |
| 723 DPLOG(ERROR) << "close"; | 723 DPLOG(ERROR) << "close"; |
| 724 | 724 |
| 725 SandboxIPCProcess handler(child_lifeline_fd, browser_socket, sandbox_path); | 725 SandboxIPCProcess handler(child_lifeline_fd, browser_socket, sandbox_path); |
| 726 handler.Run(); | 726 handler.Run(); |
| 727 _exit(0); | 727 _exit(0); |
| 728 } | 728 } |
| 729 } | 729 } |
| 730 | 730 |
| 731 RenderSandboxHostLinux::~RenderSandboxHostLinux() { | 731 RenderSandboxHostLinux::~RenderSandboxHostLinux() { |
| 732 if (initialized_) { | 732 if (initialized_) { |
| 733 if (IGNORE_EINTR(close(renderer_socket_)) < 0) | 733 if (IGNORE_EINTR(close(renderer_socket_)) < 0) |
| 734 PLOG(ERROR) << "close"; | 734 PLOG(ERROR) << "close"; |
| 735 if (IGNORE_EINTR(close(childs_lifeline_fd_)) < 0) | 735 if (IGNORE_EINTR(close(childs_lifeline_fd_)) < 0) |
| 736 PLOG(ERROR) << "close"; | 736 PLOG(ERROR) << "close"; |
| 737 } | 737 } |
| 738 } | 738 } |
| 739 | 739 |
| 740 } // namespace content | 740 } // namespace content |
| OLD | NEW |