| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "mojo/edk/system/node_channel.h" | 5 #include "mojo/edk/system/node_channel.h" |
| 6 | 6 |
| 7 #include <cstring> | 7 #include <cstring> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <sstream> | 9 #include <sstream> |
| 10 | 10 |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 base::AutoLock lock(channel_lock_); | 180 base::AutoLock lock(channel_lock_); |
| 181 if (channel_) { | 181 if (channel_) { |
| 182 channel_->ShutDown(); | 182 channel_->ShutDown(); |
| 183 channel_ = nullptr; | 183 channel_ = nullptr; |
| 184 } | 184 } |
| 185 } | 185 } |
| 186 | 186 |
| 187 void NodeChannel::SetRemoteProcessHandle(base::ProcessHandle process_handle) { | 187 void NodeChannel::SetRemoteProcessHandle(base::ProcessHandle process_handle) { |
| 188 DCHECK(io_task_runner_->RunsTasksOnCurrentThread()); | 188 DCHECK(io_task_runner_->RunsTasksOnCurrentThread()); |
| 189 base::AutoLock lock(remote_process_handle_lock_); | 189 base::AutoLock lock(remote_process_handle_lock_); |
| 190 CHECK_NE(remote_process_handle_, base::GetCurrentProcessHandle()); |
| 190 remote_process_handle_ = process_handle; | 191 remote_process_handle_ = process_handle; |
| 191 } | 192 } |
| 192 | 193 |
| 193 bool NodeChannel::HasRemoteProcessHandle() { | 194 bool NodeChannel::HasRemoteProcessHandle() { |
| 194 base::AutoLock lock(remote_process_handle_lock_); | 195 base::AutoLock lock(remote_process_handle_lock_); |
| 195 return remote_process_handle_ != base::kNullProcessHandle; | 196 return remote_process_handle_ != base::kNullProcessHandle; |
| 196 } | 197 } |
| 197 | 198 |
| 198 base::ProcessHandle NodeChannel::CopyRemoteProcessHandle() { | 199 base::ProcessHandle NodeChannel::CopyRemoteProcessHandle() { |
| 199 base::AutoLock lock(remote_process_handle_lock_); | 200 base::AutoLock lock(remote_process_handle_lock_); |
| (...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 720 | 721 |
| 721 base::AutoLock lock(channel_lock_); | 722 base::AutoLock lock(channel_lock_); |
| 722 if (!channel_) | 723 if (!channel_) |
| 723 DLOG(ERROR) << "Dropping message on closed channel."; | 724 DLOG(ERROR) << "Dropping message on closed channel."; |
| 724 else | 725 else |
| 725 channel_->Write(std::move(message)); | 726 channel_->Write(std::move(message)); |
| 726 } | 727 } |
| 727 | 728 |
| 728 } // namespace edk | 729 } // namespace edk |
| 729 } // namespace mojo | 730 } // namespace mojo |
| OLD | NEW |