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

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

Issue 1917333002: IPC: Fix attachment brokering race condition. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2704
Patch Set: 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 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 // and single-process mode. 451 // and single-process mode.
452 if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kProcessType)) 452 if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kProcessType))
453 channel_->AddFilter(new SuicideOnChannelErrorFilter()); 453 channel_->AddFilter(new SuicideOnChannelErrorFilter());
454 #endif 454 #endif
455 455
456 // Add filters passed here via options. 456 // Add filters passed here via options.
457 for (auto startup_filter : options.startup_filters) { 457 for (auto startup_filter : options.startup_filters) {
458 channel_->AddFilter(startup_filter); 458 channel_->AddFilter(startup_filter);
459 } 459 }
460 460
461 IPC::AttachmentBroker* broker = IPC::AttachmentBroker::GetGlobal();
462 if (broker && !broker->IsPrivilegedBroker())
463 broker->RegisterBrokerCommunicationChannel(channel_.get());
461 ConnectChannel( 464 ConnectChannel(
462 options.use_mojo_channel, 465 options.use_mojo_channel,
463 mojo::MakeScopedHandle(options.in_process_message_pipe_handle)); 466 mojo::MakeScopedHandle(options.in_process_message_pipe_handle));
464 IPC::AttachmentBroker* broker = IPC::AttachmentBroker::GetGlobal();
465 if (broker && !broker->IsPrivilegedBroker())
466 broker->RegisterBrokerCommunicationChannel(channel_.get());
467 467
468 int connection_timeout = kConnectionTimeoutS; 468 int connection_timeout = kConnectionTimeoutS;
469 std::string connection_override = 469 std::string connection_override =
470 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( 470 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
471 switches::kIPCConnectionTimeout); 471 switches::kIPCConnectionTimeout);
472 if (!connection_override.empty()) { 472 if (!connection_override.empty()) {
473 int temp; 473 int temp;
474 if (base::StringToInt(connection_override, &temp)) 474 if (base::StringToInt(connection_override, &temp))
475 connection_timeout = temp; 475 connection_timeout = temp;
476 } 476 }
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
712 void ChildThreadImpl::EnsureConnected() { 712 void ChildThreadImpl::EnsureConnected() {
713 VLOG(0) << "ChildThreadImpl::EnsureConnected()"; 713 VLOG(0) << "ChildThreadImpl::EnsureConnected()";
714 base::Process::Current().Terminate(0, false); 714 base::Process::Current().Terminate(0, false);
715 } 715 }
716 716
717 bool ChildThreadImpl::IsInBrowserProcess() const { 717 bool ChildThreadImpl::IsInBrowserProcess() const {
718 return browser_process_io_runner_; 718 return browser_process_io_runner_;
719 } 719 }
720 720
721 } // namespace content 721 } // 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