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

Side by Side Diff: mojo/embedder/test_embedder.cc

Issue 216893005: Mojo: Move the handle table details out of CoreImpl into its own class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix compile assert Created 6 years, 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | mojo/mojo.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 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/embedder/test_embedder.h" 5 #include "mojo/embedder/test_embedder.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "mojo/system/core_impl.h" 9 #include "mojo/system/core_impl.h"
10 #include "mojo/system/handle_table.h"
10 11
11 namespace mojo { 12 namespace mojo {
12 13
13 namespace system { 14 namespace system {
14 namespace internal { 15 namespace internal {
15 16
16 bool ShutdownCheckNoLeaks(CoreImpl* core_impl) { 17 bool ShutdownCheckNoLeaks(CoreImpl* core_impl) {
17 // No point in taking the lock. 18 // No point in taking the lock.
18 if (core_impl->handle_table_.empty()) 19 const HandleTable::HandleToEntryMap& handle_to_entry_map =
20 core_impl->handle_table_.handle_to_entry_map_;
21
22 if (handle_to_entry_map.empty())
19 return true; 23 return true;
20 24
21 for (CoreImpl::HandleTableMap::const_iterator it = 25 for (HandleTable::HandleToEntryMap::const_iterator it =
22 core_impl->handle_table_.begin(); 26 handle_to_entry_map.begin();
23 it != core_impl->handle_table_.end(); 27 it != handle_to_entry_map.end();
24 ++it) { 28 ++it) {
25 LOG(ERROR) << "Mojo embedder shutdown: Leaking handle " << (*it).first; 29 LOG(ERROR) << "Mojo embedder shutdown: Leaking handle " << (*it).first;
26 } 30 }
27 return false; 31 return false;
28 } 32 }
29 33
30 } // namespace internal 34 } // namespace internal
31 } // namespace system 35 } // namespace system
32 36
33 namespace embedder { 37 namespace embedder {
34 namespace test { 38 namespace test {
35 39
36 bool Shutdown() { 40 bool Shutdown() {
37 system::CoreImpl* core_impl = static_cast<system::CoreImpl*>(Core::Get()); 41 system::CoreImpl* core_impl = static_cast<system::CoreImpl*>(Core::Get());
38 CHECK(core_impl); 42 CHECK(core_impl);
39 Core::Reset(); 43 Core::Reset();
40 44
41 bool rv = system::internal::ShutdownCheckNoLeaks(core_impl); 45 bool rv = system::internal::ShutdownCheckNoLeaks(core_impl);
42 delete core_impl; 46 delete core_impl;
43 return rv; 47 return rv;
44 } 48 }
45 49
46 } // namespace test 50 } // namespace test
47 } // namespace embedder 51 } // namespace embedder
48 52
49 } // namespace mojo 53 } // namespace mojo
OLDNEW
« no previous file with comments | « no previous file | mojo/mojo.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698