| 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 962 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 973 void NodeController::DestroyOnIOThreadShutdown() { | 973 void NodeController::DestroyOnIOThreadShutdown() { |
| 974 destroy_on_io_thread_shutdown_ = true; | 974 destroy_on_io_thread_shutdown_ = true; |
| 975 } | 975 } |
| 976 | 976 |
| 977 void NodeController::AttemptShutdownIfRequested() { | 977 void NodeController::AttemptShutdownIfRequested() { |
| 978 base::Closure callback; | 978 base::Closure callback; |
| 979 { | 979 { |
| 980 base::AutoLock lock(shutdown_lock_); | 980 base::AutoLock lock(shutdown_lock_); |
| 981 if (shutdown_callback_.is_null()) | 981 if (shutdown_callback_.is_null()) |
| 982 return; | 982 return; |
| 983 if (!node_->CanShutdownCleanly(true /* allow_local_ports */)) { | 983 |
| 984 DVLOG(2) << "Unable to cleanly shut down node " << name_ << "."; | 984 // TODO(rockot): We should return here if clean shutdown of |node_| is not |
| 985 return; | 985 // yet possible. See http://crbug.com/589864 for why we don't. |
| 986 } | 986 |
| 987 callback = shutdown_callback_; | 987 callback = shutdown_callback_; |
| 988 shutdown_callback_.Reset(); | 988 shutdown_callback_.Reset(); |
| 989 } | 989 } |
| 990 | 990 |
| 991 DCHECK(!callback.is_null()); | 991 DCHECK(!callback.is_null()); |
| 992 | 992 |
| 993 callback.Run(); | 993 callback.Run(); |
| 994 } | 994 } |
| 995 | 995 |
| 996 } // namespace edk | 996 } // namespace edk |
| 997 } // namespace mojo | 997 } // namespace mojo |
| OLD | NEW |