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

Side by Side Diff: remoting/host/remoting_me2me_host.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, 7 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
« no previous file with comments | « remoting/host/ipc_util_win.cc ('k') | remoting/host/win/unprivileged_process_delegate.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // This file implements a standalone host process for Me2Me. 5 // This file implements a standalone host process for Me2Me.
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 520
521 #if defined(OS_WIN) 521 #if defined(OS_WIN)
522 base::win::ScopedHandle pipe(reinterpret_cast<HANDLE>(pipe_handle)); 522 base::win::ScopedHandle pipe(reinterpret_cast<HANDLE>(pipe_handle));
523 IPC::ChannelHandle channel_handle(pipe.Get()); 523 IPC::ChannelHandle channel_handle(pipe.Get());
524 #elif defined(OS_POSIX) 524 #elif defined(OS_POSIX)
525 base::FileDescriptor pipe(pipe_handle, true); 525 base::FileDescriptor pipe(pipe_handle, true);
526 IPC::ChannelHandle channel_handle(channel_name, pipe); 526 IPC::ChannelHandle channel_handle(channel_name, pipe);
527 #endif // defined(OS_POSIX) 527 #endif // defined(OS_POSIX)
528 528
529 // Connect to the daemon process. 529 // Connect to the daemon process.
530 daemon_channel_ = IPC::ChannelProxy::Create(channel_handle, 530 daemon_channel_.reset(
531 IPC::Channel::MODE_CLIENT, 531 new IPC::ChannelProxy(this, context_->network_task_runner()));
532 this,
533 context_->network_task_runner());
534
535 IPC::AttachmentBrokerUnprivileged::CreateBrokerIfNeeded(); 532 IPC::AttachmentBrokerUnprivileged::CreateBrokerIfNeeded();
536 IPC::AttachmentBroker* broker = IPC::AttachmentBroker::GetGlobal(); 533 IPC::AttachmentBroker* broker = IPC::AttachmentBroker::GetGlobal();
537 if (broker && !broker->IsPrivilegedBroker()) 534 if (broker && !broker->IsPrivilegedBroker())
538 broker->RegisterBrokerCommunicationChannel(daemon_channel_.get()); 535 broker->RegisterBrokerCommunicationChannel(daemon_channel_.get());
536 daemon_channel_->Init(channel_handle, IPC::Channel::MODE_CLIENT, true);
539 537
540 #else // !defined(REMOTING_MULTI_PROCESS) 538 #else // !defined(REMOTING_MULTI_PROCESS)
541 if (cmd_line->HasSwitch(kHostConfigSwitchName)) { 539 if (cmd_line->HasSwitch(kHostConfigSwitchName)) {
542 host_config_path_ = cmd_line->GetSwitchValuePath(kHostConfigSwitchName); 540 host_config_path_ = cmd_line->GetSwitchValuePath(kHostConfigSwitchName);
543 541
544 // Read config from stdin if necessary. 542 // Read config from stdin if necessary.
545 if (host_config_path_ == base::FilePath(kStdinConfigPath)) { 543 if (host_config_path_ == base::FilePath(kStdinConfigPath)) {
546 const size_t kBufferSize = 4096; 544 const size_t kBufferSize = 4096;
547 std::unique_ptr<char[]> buf(new char[kBufferSize]); 545 std::unique_ptr<char[]> buf(new char[kBufferSize]);
548 size_t len; 546 size_t len;
(...skipping 1169 matching lines...) Expand 10 before | Expand all | Expand 10 after
1718 base::TimeDelta::FromSeconds(kShutdownTimeoutSeconds)); 1716 base::TimeDelta::FromSeconds(kShutdownTimeoutSeconds));
1719 new HostProcess(std::move(context), &exit_code, &shutdown_watchdog); 1717 new HostProcess(std::move(context), &exit_code, &shutdown_watchdog);
1720 1718
1721 // Run the main (also UI) message loop until the host no longer needs it. 1719 // Run the main (also UI) message loop until the host no longer needs it.
1722 message_loop.Run(); 1720 message_loop.Run();
1723 1721
1724 return exit_code; 1722 return exit_code;
1725 } 1723 }
1726 1724
1727 } // namespace remoting 1725 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/ipc_util_win.cc ('k') | remoting/host/win/unprivileged_process_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698