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

Unified Diff: mojo/edk/system/node_controller.cc

Issue 1808233003: [mojo-edk] Shutdown a node's bootstrap parent channel outside its lock. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/edk/system/node_controller.cc
diff --git a/mojo/edk/system/node_controller.cc b/mojo/edk/system/node_controller.cc
index 3733c6cc42285d2b308904e6afd5ca76cb5e7dd4..30b331f080fbffab9e76d81fe3356c5c35e18d87 100644
--- a/mojo/edk/system/node_controller.cc
+++ b/mojo/edk/system/node_controller.cc
@@ -500,15 +500,20 @@ void NodeController::AcceptIncomingMessages() {
void NodeController::DropAllPeers() {
DCHECK(io_task_runner_->RunsTasksOnCurrentThread());
+ std::vector<scoped_refptr<NodeChannel>> all_peers;
{
base::AutoLock lock(parent_lock_);
if (bootstrap_parent_channel_) {
- bootstrap_parent_channel_->ShutDown();
- bootstrap_parent_channel_ = nullptr;
+ // |bootstrap_parent_channel_| isn't null'd here becuase we rely on its
+ // existence to determine whether or not this is the root node. Once
+ // bootstrap_parent_channel_->ShutDown() has been called,
+ // |bootstrap_parent_channel_| is essentially a dead object and it doesn't
+ // matter if it's deleted now or when |this| is deleted.
+ // Note: |bootstrap_parent_channel_| is only modified on the IO thread.
+ all_peers.push_back(bootstrap_parent_channel_);
}
}
- std::vector<scoped_refptr<NodeChannel>> all_peers;
{
base::AutoLock lock(peers_lock_);
for (const auto& peer : peers_)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698