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/edk/system/handle_table.h" | 5 #include "mojo/edk/system/handle_table.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 if (entries[i]->busy) { | 143 if (entries[i]->busy) { |
144 error_result = MOJO_RESULT_BUSY; | 144 error_result = MOJO_RESULT_BUSY; |
145 break; | 145 break; |
146 } | 146 } |
147 // Note: By marking the handle as busy here, we're also preventing the | 147 // Note: By marking the handle as busy here, we're also preventing the |
148 // same handle from being sent multiple times in the same message. | 148 // same handle from being sent multiple times in the same message. |
149 entries[i]->busy = true; | 149 entries[i]->busy = true; |
150 | 150 |
151 // Try to start the transport. | 151 // Try to start the transport. |
152 DispatcherTransport transport = | 152 DispatcherTransport transport = |
153 Dispatcher::HandleTableAccess::TryStartTransport( | 153 Dispatcher::HandleTableAccess::TryStartTransport(entries[i]->handle); |
154 entries[i]->handle.dispatcher.get()); | |
155 if (!transport.is_valid()) { | 154 if (!transport.is_valid()) { |
156 // Only log for Debug builds, since this is not a problem with the system | 155 // Only log for Debug builds, since this is not a problem with the system |
157 // code, but with user code. | 156 // code, but with user code. |
158 DLOG(WARNING) << "Likely race condition in user code detected: attempt " | 157 DLOG(WARNING) << "Likely race condition in user code detected: attempt " |
159 "to transfer handle " | 158 "to transfer handle " |
160 << handle_values[i] | 159 << handle_values[i] |
161 << " while it is in use on a different thread"; | 160 << " while it is in use on a different thread"; |
162 | 161 |
163 // Unset the busy flag (since it won't be unset below). | 162 // Unset the busy flag (since it won't be unset below). |
164 entries[i]->busy = false; | 163 entries[i]->busy = false; |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 for (uint32_t i = 0; i < num_handles; i++) { | 240 for (uint32_t i = 0; i < num_handles; i++) { |
242 HandleToEntryMap::iterator it = handle_to_entry_map_.find(handle_values[i]); | 241 HandleToEntryMap::iterator it = handle_to_entry_map_.find(handle_values[i]); |
243 DCHECK(it != handle_to_entry_map_.end()); | 242 DCHECK(it != handle_to_entry_map_.end()); |
244 DCHECK(it->second.busy); | 243 DCHECK(it->second.busy); |
245 it->second.busy = false; | 244 it->second.busy = false; |
246 } | 245 } |
247 } | 246 } |
248 | 247 |
249 } // namespace system | 248 } // namespace system |
250 } // namespace mojo | 249 } // namespace mojo |
OLD | NEW |