OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |