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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 DCHECK(entries[j]->busy); | 174 DCHECK(entries[j]->busy); |
175 entries[j]->busy = false; | 175 entries[j]->busy = false; |
176 (*transports)[j].End(); | 176 (*transports)[j].End(); |
177 } | 177 } |
178 return error_result; | 178 return error_result; |
179 } | 179 } |
180 | 180 |
181 return MOJO_RESULT_OK; | 181 return MOJO_RESULT_OK; |
182 } | 182 } |
183 | 183 |
184 | |
185 ////////////// | |
186 | |
187 MojoHandle HandleTable::AddDispatcherNoSizeCheck( | 184 MojoHandle HandleTable::AddDispatcherNoSizeCheck( |
188 const scoped_refptr<Dispatcher>& dispatcher) { | 185 const scoped_refptr<Dispatcher>& dispatcher) { |
189 DCHECK(dispatcher); | 186 DCHECK(dispatcher); |
190 DCHECK_LT(handle_to_entry_map_.size(), kMaxHandleTableSize); | 187 DCHECK_LT(handle_to_entry_map_.size(), kMaxHandleTableSize); |
191 DCHECK_NE(next_handle_, MOJO_HANDLE_INVALID); | 188 DCHECK_NE(next_handle_, MOJO_HANDLE_INVALID); |
192 | 189 |
193 // TODO(vtl): Maybe we want to do something different/smarter. (Or maybe try | 190 // TODO(vtl): Maybe we want to do something different/smarter. (Or maybe try |
194 // assigning randomly?) | 191 // assigning randomly?) |
195 while (handle_to_entry_map_.find(next_handle_) != | 192 while (handle_to_entry_map_.find(next_handle_) != |
196 handle_to_entry_map_.end()) { | 193 handle_to_entry_map_.end()) { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 for (uint32_t i = 0; i < num_handles; i++) { | 228 for (uint32_t i = 0; i < num_handles; i++) { |
232 HandleToEntryMap::iterator it = handle_to_entry_map_.find(handles[i]); | 229 HandleToEntryMap::iterator it = handle_to_entry_map_.find(handles[i]); |
233 DCHECK(it != handle_to_entry_map_.end()); | 230 DCHECK(it != handle_to_entry_map_.end()); |
234 DCHECK(it->second.busy); | 231 DCHECK(it->second.busy); |
235 it->second.busy = false; | 232 it->second.busy = false; |
236 } | 233 } |
237 } | 234 } |
238 | 235 |
239 } // namespace system | 236 } // namespace system |
240 } // namespace mojo | 237 } // namespace mojo |
OLD | NEW |