| OLD | NEW |
| 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/system/handle_table.h" | 5 #include "mojo/system/handle_table.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "mojo/system/constants.h" | 9 #include "mojo/system/constants.h" |
| 10 #include "mojo/system/dispatcher.h" | 10 #include "mojo/system/dispatcher.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 HandleTable::Entry::~Entry() { | 24 HandleTable::Entry::~Entry() { |
| 25 DCHECK(!busy); | 25 DCHECK(!busy); |
| 26 } | 26 } |
| 27 | 27 |
| 28 HandleTable::HandleTable() | 28 HandleTable::HandleTable() |
| 29 : next_handle_(MOJO_HANDLE_INVALID + 1) { | 29 : next_handle_(MOJO_HANDLE_INVALID + 1) { |
| 30 } | 30 } |
| 31 | 31 |
| 32 HandleTable::~HandleTable() { | 32 HandleTable::~HandleTable() { |
| 33 // This should usually not be reached (the only instance should be owned by | 33 // This should usually not be reached (the only instance should be owned by |
| 34 // the singleton |CoreImpl|, which lives forever), except in tests. | 34 // the singleton |Core|, which lives forever), except in tests. |
| 35 } | 35 } |
| 36 | 36 |
| 37 Dispatcher* HandleTable::GetDispatcher(MojoHandle handle) { | 37 Dispatcher* HandleTable::GetDispatcher(MojoHandle handle) { |
| 38 DCHECK_NE(handle, MOJO_HANDLE_INVALID); | 38 DCHECK_NE(handle, MOJO_HANDLE_INVALID); |
| 39 | 39 |
| 40 HandleToEntryMap::iterator it = handle_to_entry_map_.find(handle); | 40 HandleToEntryMap::iterator it = handle_to_entry_map_.find(handle); |
| 41 if (it == handle_to_entry_map_.end()) | 41 if (it == handle_to_entry_map_.end()) |
| 42 return NULL; | 42 return NULL; |
| 43 return it->second.dispatcher; | 43 return it->second.dispatcher; |
| 44 } | 44 } |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 for (uint32_t i = 0; i < num_handles; i++) { | 228 for (uint32_t i = 0; i < num_handles; i++) { |
| 229 HandleToEntryMap::iterator it = handle_to_entry_map_.find(handles[i]); | 229 HandleToEntryMap::iterator it = handle_to_entry_map_.find(handles[i]); |
| 230 DCHECK(it != handle_to_entry_map_.end()); | 230 DCHECK(it != handle_to_entry_map_.end()); |
| 231 DCHECK(it->second.busy); | 231 DCHECK(it->second.busy); |
| 232 it->second.busy = false; | 232 it->second.busy = false; |
| 233 } | 233 } |
| 234 } | 234 } |
| 235 | 235 |
| 236 } // namespace system | 236 } // namespace system |
| 237 } // namespace mojo | 237 } // namespace mojo |
| OLD | NEW |