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

Unified Diff: remoting/host/ipc_util_posix.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/host/ipc_util.h ('k') | remoting/host/ipc_util_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/ipc_util_posix.cc
diff --git a/remoting/host/ipc_util_posix.cc b/remoting/host/ipc_util_posix.cc
index 3747c1dad3ca0dd81a345107295405d85dc4963f..54aa5bff5fb073926f9f8b70ff031341650214ab 100644
--- a/remoting/host/ipc_util_posix.cc
+++ b/remoting/host/ipc_util_posix.cc
@@ -13,6 +13,7 @@
#include "base/logging.h"
#include "base/posix/eintr_wrapper.h"
#include "base/single_thread_task_runner.h"
+#include "ipc/attachment_broker.h"
#include "ipc/ipc_channel.h"
#include "ipc/ipc_channel_proxy.h"
@@ -45,10 +46,14 @@ bool CreateConnectedIpcChannel(
// Wrap the pipe into an IPC channel.
base::FileDescriptor fd(pipe_fds[0], false);
- IPC::ChannelHandle handle(socket_name, fd);
- *server_out = IPC::ChannelProxy::Create(IPC::ChannelHandle(socket_name, fd),
- IPC::Channel::MODE_SERVER, listener,
- io_task_runner.get());
+ server_out->reset(new IPC::ChannelProxy(listener, io_task_runner));
+ if (IPC::AttachmentBroker::GetGlobal()) {
+ IPC::AttachmentBroker::GetGlobal()->RegisterCommunicationChannel(
+ server_out->get(), io_task_runner);
+ }
+ (*server_out)
+ ->Init(IPC::ChannelHandle(socket_name, fd), IPC::Channel::MODE_SERVER,
+ true);
*client_out = base::File(pipe_fds[1]);
return true;
« no previous file with comments | « remoting/host/ipc_util.h ('k') | remoting/host/ipc_util_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698