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

Side by Side Diff: content/child/child_thread_impl.cc

Issue 1903663004: IPC: Fix attachment brokering race condition. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase (scoped_ptr->std::unique_ptr) Created 4 years, 8 months 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
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/child/child_thread_impl.h" 5 #include "content/child/child_thread_impl.h"
6 6
7 #include <signal.h> 7 #include <signal.h>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 // and single-process mode. 465 // and single-process mode.
466 if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kProcessType)) 466 if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kProcessType))
467 channel_->AddFilter(new SuicideOnChannelErrorFilter()); 467 channel_->AddFilter(new SuicideOnChannelErrorFilter());
468 #endif 468 #endif
469 469
470 // Add filters passed here via options. 470 // Add filters passed here via options.
471 for (auto startup_filter : options.startup_filters) { 471 for (auto startup_filter : options.startup_filters) {
472 channel_->AddFilter(startup_filter); 472 channel_->AddFilter(startup_filter);
473 } 473 }
474 474
475 ConnectChannel(options.use_mojo_channel, options.in_process_ipc_token);
476 IPC::AttachmentBroker* broker = IPC::AttachmentBroker::GetGlobal(); 475 IPC::AttachmentBroker* broker = IPC::AttachmentBroker::GetGlobal();
477 if (broker && !broker->IsPrivilegedBroker()) 476 if (broker && !broker->IsPrivilegedBroker())
478 broker->RegisterBrokerCommunicationChannel(channel_.get()); 477 broker->RegisterBrokerCommunicationChannel(channel_.get());
478 ConnectChannel(options.use_mojo_channel, options.in_process_ipc_token);
479 479
480 int connection_timeout = kConnectionTimeoutS; 480 int connection_timeout = kConnectionTimeoutS;
481 std::string connection_override = 481 std::string connection_override =
482 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( 482 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
483 switches::kIPCConnectionTimeout); 483 switches::kIPCConnectionTimeout);
484 if (!connection_override.empty()) { 484 if (!connection_override.empty()) {
485 int temp; 485 int temp;
486 if (base::StringToInt(connection_override, &temp)) 486 if (base::StringToInt(connection_override, &temp))
487 connection_timeout = temp; 487 connection_timeout = temp;
488 } 488 }
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
721 void ChildThreadImpl::EnsureConnected() { 721 void ChildThreadImpl::EnsureConnected() {
722 VLOG(0) << "ChildThreadImpl::EnsureConnected()"; 722 VLOG(0) << "ChildThreadImpl::EnsureConnected()";
723 base::Process::Current().Terminate(0, false); 723 base::Process::Current().Terminate(0, false);
724 } 724 }
725 725
726 bool ChildThreadImpl::IsInBrowserProcess() const { 726 bool ChildThreadImpl::IsInBrowserProcess() const {
727 return browser_process_io_runner_; 727 return browser_process_io_runner_;
728 } 728 }
729 729
730 } // namespace content 730 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_process_host_impl.cc ('k') | content/common/child_process_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698