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 727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
738 | 738 |
739 renderer_socket_ = fds[0]; | 739 renderer_socket_ = fds[0]; |
740 const int browser_socket = fds[1]; | 740 const int browser_socket = fds[1]; |
741 | 741 |
742 int pipefds[2]; | 742 int pipefds[2]; |
743 CHECK(0 == pipe(pipefds)); | 743 CHECK(0 == pipe(pipefds)); |
744 const int child_lifeline_fd = pipefds[0]; | 744 const int child_lifeline_fd = pipefds[0]; |
745 childs_lifeline_fd_ = pipefds[1]; | 745 childs_lifeline_fd_ = pipefds[1]; |
746 | 746 |
747 // We need to be monothreaded before we fork(). | 747 // We need to be monothreaded before we fork(). |
748 #if !defined(TOOLKIT_GTK) && !defined(THREAD_SANITIZER) | 748 #if !defined(THREAD_SANITIZER) |
749 // Exclude gtk port as TestSuite in base/tests/test_suite.cc is calling | |
750 // gtk_init. | |
751 // TODO(oshima): Remove ifdef when above issues are resolved. | |
752 DCHECK_EQ(1, base::GetNumberOfThreads(base::GetCurrentProcessHandle())); | 749 DCHECK_EQ(1, base::GetNumberOfThreads(base::GetCurrentProcessHandle())); |
753 #endif // !defined(TOOLKIT_GTK) && !defined(THREAD_SANITIZER) | 750 #endif // !defined(THREAD_SANITIZER) |
754 pid_ = fork(); | 751 pid_ = fork(); |
755 if (pid_ == 0) { | 752 if (pid_ == 0) { |
756 if (IGNORE_EINTR(close(fds[0])) < 0) | 753 if (IGNORE_EINTR(close(fds[0])) < 0) |
757 DPLOG(ERROR) << "close"; | 754 DPLOG(ERROR) << "close"; |
758 if (IGNORE_EINTR(close(pipefds[1])) < 0) | 755 if (IGNORE_EINTR(close(pipefds[1])) < 0) |
759 DPLOG(ERROR) << "close"; | 756 DPLOG(ERROR) << "close"; |
760 | 757 |
761 SandboxIPCProcess handler(child_lifeline_fd, browser_socket, sandbox_path); | 758 SandboxIPCProcess handler(child_lifeline_fd, browser_socket, sandbox_path); |
762 handler.Run(); | 759 handler.Run(); |
763 _exit(0); | 760 _exit(0); |
764 } | 761 } |
765 } | 762 } |
766 | 763 |
767 RenderSandboxHostLinux::~RenderSandboxHostLinux() { | 764 RenderSandboxHostLinux::~RenderSandboxHostLinux() { |
768 if (initialized_) { | 765 if (initialized_) { |
769 if (IGNORE_EINTR(close(renderer_socket_)) < 0) | 766 if (IGNORE_EINTR(close(renderer_socket_)) < 0) |
770 PLOG(ERROR) << "close"; | 767 PLOG(ERROR) << "close"; |
771 if (IGNORE_EINTR(close(childs_lifeline_fd_)) < 0) | 768 if (IGNORE_EINTR(close(childs_lifeline_fd_)) < 0) |
772 PLOG(ERROR) << "close"; | 769 PLOG(ERROR) << "close"; |
773 } | 770 } |
774 } | 771 } |
775 | 772 |
776 } // namespace content | 773 } // namespace content |
OLD | NEW |