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

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

Issue 2065453004: Always leak the Mojo parent pipe handle on child process shutdown. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comment Created 4 years, 6 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/node_channel.h ('k') | mojo/edk/system/node_controller.cc » ('j') | 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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 relay->RemoveObserver(this); 201 relay->RemoveObserver(this);
202 #endif 202 #endif
203 203
204 base::AutoLock lock(channel_lock_); 204 base::AutoLock lock(channel_lock_);
205 if (channel_) { 205 if (channel_) {
206 channel_->ShutDown(); 206 channel_->ShutDown();
207 channel_ = nullptr; 207 channel_ = nullptr;
208 } 208 }
209 } 209 }
210 210
211 void NodeChannel::LeakHandleOnShutdown() {
212 base::AutoLock lock(channel_lock_);
213 if (channel_) {
214 channel_->LeakHandle();
215 }
216 }
217
211 void NodeChannel::NotifyBadMessage(const std::string& error) { 218 void NodeChannel::NotifyBadMessage(const std::string& error) {
212 if (!process_error_callback_.is_null()) 219 if (!process_error_callback_.is_null())
213 process_error_callback_.Run("Received bad user message: " + error); 220 process_error_callback_.Run("Received bad user message: " + error);
214 } 221 }
215 222
216 void NodeChannel::SetRemoteProcessHandle(base::ProcessHandle process_handle) { 223 void NodeChannel::SetRemoteProcessHandle(base::ProcessHandle process_handle) {
217 DCHECK(io_task_runner_->RunsTasksOnCurrentThread()); 224 DCHECK(io_task_runner_->RunsTasksOnCurrentThread());
218 base::AutoLock lock(remote_process_handle_lock_); 225 base::AutoLock lock(remote_process_handle_lock_);
219 CHECK_NE(remote_process_handle_, base::GetCurrentProcessHandle()); 226 CHECK_NE(remote_process_handle_, base::GetCurrentProcessHandle());
220 remote_process_handle_ = process_handle; 227 remote_process_handle_ = process_handle;
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after
837 844
838 base::AutoLock lock(channel_lock_); 845 base::AutoLock lock(channel_lock_);
839 if (!channel_) 846 if (!channel_)
840 DLOG(ERROR) << "Dropping message on closed channel."; 847 DLOG(ERROR) << "Dropping message on closed channel.";
841 else 848 else
842 channel_->Write(std::move(message)); 849 channel_->Write(std::move(message));
843 } 850 }
844 851
845 } // namespace edk 852 } // namespace edk
846 } // namespace mojo 853 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/edk/system/node_channel.h ('k') | mojo/edk/system/node_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698