Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(272)

Side by Side Diff: content/browser/renderer_host/render_sandbox_host_linux.cc

Issue 83633004: Do not spawn a thread in browser/interactive ui tests before spawning sandbox host process (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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) && !defined(OS_CHROMEOS) 712 #if !defined(TOOLKIT_GTK)
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 // Exclude ChromeOS because KioskTest spawns EmbeddedTestServer.
716 // TODO(oshima): Remove ifdef when above issues are resolved. 715 // TODO(oshima): Remove ifdef when above issues are resolved.
717 DCHECK_EQ(1, base::GetNumberOfThreads(base::GetCurrentProcessHandle())); 716 DCHECK_EQ(1, base::GetNumberOfThreads(base::GetCurrentProcessHandle()));
718 #endif 717 #endif
719 pid_ = fork(); 718 pid_ = fork();
720 if (pid_ == 0) { 719 if (pid_ == 0) {
721 if (HANDLE_EINTR(close(fds[0])) < 0) 720 if (HANDLE_EINTR(close(fds[0])) < 0)
722 DPLOG(ERROR) << "close"; 721 DPLOG(ERROR) << "close";
723 if (HANDLE_EINTR(close(pipefds[1])) < 0) 722 if (HANDLE_EINTR(close(pipefds[1])) < 0)
724 DPLOG(ERROR) << "close"; 723 DPLOG(ERROR) << "close";
725 724
726 SandboxIPCProcess handler(child_lifeline_fd, browser_socket, sandbox_path); 725 SandboxIPCProcess handler(child_lifeline_fd, browser_socket, sandbox_path);
727 handler.Run(); 726 handler.Run();
728 _exit(0); 727 _exit(0);
729 } 728 }
730 } 729 }
731 730
732 RenderSandboxHostLinux::~RenderSandboxHostLinux() { 731 RenderSandboxHostLinux::~RenderSandboxHostLinux() {
733 if (initialized_) { 732 if (initialized_) {
734 if (HANDLE_EINTR(close(renderer_socket_)) < 0) 733 if (HANDLE_EINTR(close(renderer_socket_)) < 0)
735 PLOG(ERROR) << "close"; 734 PLOG(ERROR) << "close";
736 if (HANDLE_EINTR(close(childs_lifeline_fd_)) < 0) 735 if (HANDLE_EINTR(close(childs_lifeline_fd_)) < 0)
737 PLOG(ERROR) << "close"; 736 PLOG(ERROR) << "close";
738 } 737 }
739 } 738 }
740 739
741 } // namespace content 740 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698