| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/dispatcher.h" | 5 #include "mojo/system/dispatcher.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "mojo/system/constants.h" | 8 #include "mojo/system/constants.h" |
| 9 #include "mojo/system/message_pipe_dispatcher.h" | 9 #include "mojo/system/message_pipe_dispatcher.h" |
| 10 | 10 |
| 11 namespace mojo { | 11 namespace mojo { |
| 12 namespace system { | 12 namespace system { |
| 13 | 13 |
| 14 namespace test { | 14 namespace test { |
| 15 | 15 |
| 16 // TODO(vtl): Maybe this should be defined in a test-only file instead. | 16 // TODO(vtl): Maybe this should be defined in a test-only file instead. |
| 17 DispatcherTransport DispatcherTryStartTransport( | 17 DispatcherTransport DispatcherTryStartTransport( |
| 18 Dispatcher* dispatcher) { | 18 Dispatcher* dispatcher) { |
| 19 return Dispatcher::CoreImplAccess::TryStartTransport(dispatcher); | 19 return Dispatcher::HandleTableAccess::TryStartTransport(dispatcher); |
| 20 } | 20 } |
| 21 | 21 |
| 22 } // namespace test | 22 } // namespace test |
| 23 | 23 |
| 24 // Dispatcher ------------------------------------------------------------------ | 24 // Dispatcher ------------------------------------------------------------------ |
| 25 | 25 |
| 26 // static | 26 // static |
| 27 DispatcherTransport Dispatcher::CoreImplAccess::TryStartTransport( | 27 DispatcherTransport Dispatcher::HandleTableAccess::TryStartTransport( |
| 28 Dispatcher* dispatcher) { | 28 Dispatcher* dispatcher) { |
| 29 DCHECK(dispatcher); | 29 DCHECK(dispatcher); |
| 30 | 30 |
| 31 if (!dispatcher->lock_.Try()) | 31 if (!dispatcher->lock_.Try()) |
| 32 return DispatcherTransport(); | 32 return DispatcherTransport(); |
| 33 | 33 |
| 34 // We shouldn't race with things that close dispatchers, since closing can | 34 // We shouldn't race with things that close dispatchers, since closing can |
| 35 // only take place either under |handle_table_lock_| or when the handle is | 35 // only take place either under |handle_table_lock_| or when the handle is |
| 36 // marked as busy. | 36 // marked as busy. |
| 37 DCHECK(!dispatcher->is_closed_); | 37 DCHECK(!dispatcher->is_closed_); |
| (...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 440 // DispatcherTransport --------------------------------------------------------- | 440 // DispatcherTransport --------------------------------------------------------- |
| 441 | 441 |
| 442 void DispatcherTransport::End() { | 442 void DispatcherTransport::End() { |
| 443 DCHECK(dispatcher_); | 443 DCHECK(dispatcher_); |
| 444 dispatcher_->lock_.Release(); | 444 dispatcher_->lock_.Release(); |
| 445 dispatcher_ = NULL; | 445 dispatcher_ = NULL; |
| 446 } | 446 } |
| 447 | 447 |
| 448 } // namespace system | 448 } // namespace system |
| 449 } // namespace mojo | 449 } // namespace mojo |
| OLD | NEW |