Index: mojo/system/embedder/test_embedder.cc |
diff --git a/mojo/system/embedder/test_embedder.cc b/mojo/system/embedder/test_embedder.cc |
index 6b6bb630c80dc09e3c307b700ce42ee29f9206d8..37c9e8b540dece8f37b657449f654a22873c80bf 100644 |
--- a/mojo/system/embedder/test_embedder.cc |
+++ b/mojo/system/embedder/test_embedder.cc |
@@ -5,22 +5,45 @@ |
#include "mojo/system/embedder/test_embedder.h" |
#include "base/logging.h" |
+#include "base/macros.h" |
#include "mojo/system/core_impl.h" |
namespace mojo { |
+ |
+namespace system { |
+namespace internal { |
+ |
+bool ShutdownCheckNoLeaks(CoreImpl* core_impl) { |
+ // No point in taking the lock. |
+ if (core_impl->handle_table_.empty()) |
+ return true; |
+ |
+ for (CoreImpl::HandleTableMap::const_iterator it = |
+ core_impl->handle_table_.begin(); |
+ it != core_impl->handle_table_.end(); |
+ ++it) { |
+ LOG(ERROR) << "Mojo embedder shutdown: Leaking handle " << (*it).first; |
+ } |
+ return false; |
+} |
+ |
+} // namespace internal |
+} // namespace system |
+ |
namespace embedder { |
namespace test { |
-void Shutdown() { |
+bool Shutdown() { |
system::CoreImpl* core_impl = static_cast<system::CoreImpl*>(Core::Get()); |
CHECK(core_impl); |
Core::Reset(); |
- // TODO(vtl): Check for leaks, etc. |
- |
+ bool rv = system::internal::ShutdownCheckNoLeaks(core_impl); |
delete core_impl; |
+ return rv; |
} |
} // namespace test |
} // namespace embedder |
+ |
} // namespace mojo |