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

Side by Side Diff: ipc/mojo/ipc_channel_mojo.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, 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 | « ipc/ipc_test_base.h ('k') | remoting/host/desktop_process.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "ipc/mojo/ipc_channel_mojo.h" 5 #include "ipc/mojo/ipc_channel_mojo.h"
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 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 // Create MojoBootstrap after all members are set as it touches 232 // Create MojoBootstrap after all members are set as it touches
233 // ChannelMojo from a different thread. 233 // ChannelMojo from a different thread.
234 bootstrap_ = MojoBootstrap::Create(std::move(handle), mode, this); 234 bootstrap_ = MojoBootstrap::Create(std::move(handle), mode, this);
235 } 235 }
236 236
237 ChannelMojo::~ChannelMojo() { 237 ChannelMojo::~ChannelMojo() {
238 Close(); 238 Close();
239 } 239 }
240 240
241 bool ChannelMojo::Connect() { 241 bool ChannelMojo::Connect() {
242 WillConnect();
242 base::AutoLock lock(lock_); 243 base::AutoLock lock(lock_);
243 DCHECK(!task_runner_); 244 DCHECK(!task_runner_);
244 task_runner_ = base::ThreadTaskRunnerHandle::Get(); 245 task_runner_ = base::ThreadTaskRunnerHandle::Get();
245 DCHECK(!message_reader_); 246 DCHECK(!message_reader_);
246 bootstrap_->Connect(); 247 bootstrap_->Connect();
247 return true; 248 return true;
248 } 249 }
249 250
250 void ChannelMojo::Close() { 251 void ChannelMojo::Close() {
251 std::unique_ptr<internal::MessagePipeReader, ReaderDeleter> reader; 252 std::unique_ptr<internal::MessagePipeReader, ReaderDeleter> reader;
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 DCHECK(ok); 429 DCHECK(ok);
429 if (!ok) { 430 if (!ok) {
430 LOG(ERROR) << "Failed to add new Mojo handle."; 431 LOG(ERROR) << "Failed to add new Mojo handle.";
431 return MOJO_RESULT_UNKNOWN; 432 return MOJO_RESULT_UNKNOWN;
432 } 433 }
433 } 434 }
434 return MOJO_RESULT_OK; 435 return MOJO_RESULT_OK;
435 } 436 }
436 437
437 } // namespace IPC 438 } // namespace IPC
OLDNEW
« no previous file with comments | « ipc/ipc_test_base.h ('k') | remoting/host/desktop_process.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698