| 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_controller.h" | 5 #include "mojo/edk/system/node_controller.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 1175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1186 | 1186 |
| 1187 void NodeController::AttemptShutdownIfRequested() { | 1187 void NodeController::AttemptShutdownIfRequested() { |
| 1188 if (!shutdown_callback_flag_) | 1188 if (!shutdown_callback_flag_) |
| 1189 return; | 1189 return; |
| 1190 | 1190 |
| 1191 base::Closure callback; | 1191 base::Closure callback; |
| 1192 { | 1192 { |
| 1193 base::AutoLock lock(shutdown_lock_); | 1193 base::AutoLock lock(shutdown_lock_); |
| 1194 if (shutdown_callback_.is_null()) | 1194 if (shutdown_callback_.is_null()) |
| 1195 return; | 1195 return; |
| 1196 if (!node_->CanShutdownCleanly(true /* allow_local_ports */)) { | 1196 if (!node_->CanShutdownCleanly( |
| 1197 ports::Node::ShutdownPolicy::ALLOW_LOCAL_PORTS)) { |
| 1197 DVLOG(2) << "Unable to cleanly shut down node " << name_; | 1198 DVLOG(2) << "Unable to cleanly shut down node " << name_; |
| 1198 return; | 1199 return; |
| 1199 } | 1200 } |
| 1200 | 1201 |
| 1201 callback = shutdown_callback_; | 1202 callback = shutdown_callback_; |
| 1202 shutdown_callback_.Reset(); | 1203 shutdown_callback_.Reset(); |
| 1203 shutdown_callback_flag_.Set(false); | 1204 shutdown_callback_flag_.Set(false); |
| 1204 } | 1205 } |
| 1205 | 1206 |
| 1206 DCHECK(!callback.is_null()); | 1207 DCHECK(!callback.is_null()); |
| 1207 | 1208 |
| 1208 callback.Run(); | 1209 callback.Run(); |
| 1209 } | 1210 } |
| 1210 | 1211 |
| 1211 } // namespace edk | 1212 } // namespace edk |
| 1212 } // namespace mojo | 1213 } // namespace mojo |
| OLD | NEW |