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

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: Comments from tsepez. 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 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 #include <memory> 9 #include <memory>
10 #include <utility> 10 #include <utility>
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 // Create MojoBootstrap after all members are set as it touches 230 // Create MojoBootstrap after all members are set as it touches
231 // ChannelMojo from a different thread. 231 // ChannelMojo from a different thread.
232 bootstrap_ = MojoBootstrap::Create(std::move(handle), mode, this); 232 bootstrap_ = MojoBootstrap::Create(std::move(handle), mode, this);
233 } 233 }
234 234
235 ChannelMojo::~ChannelMojo() { 235 ChannelMojo::~ChannelMojo() {
236 Close(); 236 Close();
237 } 237 }
238 238
239 bool ChannelMojo::Connect() { 239 bool ChannelMojo::Connect() {
240 WillConnect();
240 base::AutoLock lock(lock_); 241 base::AutoLock lock(lock_);
241 DCHECK(!task_runner_); 242 DCHECK(!task_runner_);
242 task_runner_ = base::ThreadTaskRunnerHandle::Get(); 243 task_runner_ = base::ThreadTaskRunnerHandle::Get();
243 DCHECK(!message_reader_); 244 DCHECK(!message_reader_);
244 bootstrap_->Connect(); 245 bootstrap_->Connect();
245 return true; 246 return true;
246 } 247 }
247 248
248 void ChannelMojo::Close() { 249 void ChannelMojo::Close() {
249 scoped_ptr<internal::MessagePipeReader, ReaderDeleter> reader; 250 scoped_ptr<internal::MessagePipeReader, ReaderDeleter> reader;
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 DCHECK(ok); 427 DCHECK(ok);
427 if (!ok) { 428 if (!ok) {
428 LOG(ERROR) << "Failed to add new Mojo handle."; 429 LOG(ERROR) << "Failed to add new Mojo handle.";
429 return MOJO_RESULT_UNKNOWN; 430 return MOJO_RESULT_UNKNOWN;
430 } 431 }
431 } 432 }
432 return MOJO_RESULT_OK; 433 return MOJO_RESULT_OK;
433 } 434 }
434 435
435 } // namespace IPC 436 } // namespace IPC
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698