| OLD | NEW |
| (Empty) |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "mojo/system/embedder/test_embedder.h" | |
| 6 | |
| 7 #include "base/logging.h" | |
| 8 #include "base/macros.h" | |
| 9 #include "mojo/system/core_impl.h" | |
| 10 | |
| 11 namespace mojo { | |
| 12 | |
| 13 namespace system { | |
| 14 namespace internal { | |
| 15 | |
| 16 bool ShutdownCheckNoLeaks(CoreImpl* core_impl) { | |
| 17 // No point in taking the lock. | |
| 18 if (core_impl->handle_table_.empty()) | |
| 19 return true; | |
| 20 | |
| 21 for (CoreImpl::HandleTableMap::const_iterator it = | |
| 22 core_impl->handle_table_.begin(); | |
| 23 it != core_impl->handle_table_.end(); | |
| 24 ++it) { | |
| 25 LOG(ERROR) << "Mojo embedder shutdown: Leaking handle " << (*it).first; | |
| 26 } | |
| 27 return false; | |
| 28 } | |
| 29 | |
| 30 } // namespace internal | |
| 31 } // namespace system | |
| 32 | |
| 33 namespace embedder { | |
| 34 namespace test { | |
| 35 | |
| 36 bool Shutdown() { | |
| 37 system::CoreImpl* core_impl = static_cast<system::CoreImpl*>(Core::Get()); | |
| 38 CHECK(core_impl); | |
| 39 Core::Reset(); | |
| 40 | |
| 41 bool rv = system::internal::ShutdownCheckNoLeaks(core_impl); | |
| 42 delete core_impl; | |
| 43 return rv; | |
| 44 } | |
| 45 | |
| 46 } // namespace test | |
| 47 } // namespace embedder | |
| 48 | |
| 49 } // namespace mojo | |
| OLD | NEW |