| 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 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |