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

Side by Side Diff: mojo/edk/system/node_channel.cc

Issue 1940353002: [mojo-edk] Invalidate message handle when rewrite fails (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 | « mojo/edk/system/channel.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « mojo/edk/system/channel.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698