| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #ifndef MOJO_EDK_SYSTEM_HANDLE_TRANSPORT_H_ | 5 #ifndef MOJO_EDK_SYSTEM_HANDLE_TRANSPORT_H_ |
| 6 #define MOJO_EDK_SYSTEM_HANDLE_TRANSPORT_H_ | 6 #define MOJO_EDK_SYSTEM_HANDLE_TRANSPORT_H_ |
| 7 | 7 |
| 8 #include "mojo/edk/system/dispatcher.h" | 8 #include "mojo/edk/system/dispatcher.h" |
| 9 #include "mojo/edk/system/handle.h" | 9 #include "mojo/edk/system/handle.h" |
| 10 #include "mojo/edk/util/ref_ptr.h" | 10 #include "mojo/edk/util/ref_ptr.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 public: | 28 public: |
| 29 HandleTransport() : dispatcher_(nullptr), rights_(MOJO_HANDLE_RIGHT_NONE) {} | 29 HandleTransport() : dispatcher_(nullptr), rights_(MOJO_HANDLE_RIGHT_NONE) {} |
| 30 | 30 |
| 31 void End() MOJO_NOT_THREAD_SAFE; | 31 void End() MOJO_NOT_THREAD_SAFE; |
| 32 | 32 |
| 33 Dispatcher::Type GetType() const { return dispatcher_->GetType(); } | 33 Dispatcher::Type GetType() const { return dispatcher_->GetType(); } |
| 34 bool IsBusy() const MOJO_NOT_THREAD_SAFE { | 34 bool IsBusy() const MOJO_NOT_THREAD_SAFE { |
| 35 return dispatcher_->IsBusyNoLock(); | 35 return dispatcher_->IsBusyNoLock(); |
| 36 } | 36 } |
| 37 void Close() MOJO_NOT_THREAD_SAFE { dispatcher_->CloseNoLock(); } | 37 void Close() MOJO_NOT_THREAD_SAFE { dispatcher_->CloseNoLock(); } |
| 38 util::RefPtr<Dispatcher> CreateEquivalentDispatcherAndClose( | 38 Handle CreateEquivalentHandleAndClose(MessagePipe* message_pipe, |
| 39 MessagePipe* message_pipe, | 39 unsigned port) MOJO_NOT_THREAD_SAFE { |
| 40 unsigned port) MOJO_NOT_THREAD_SAFE { | 40 return Handle(dispatcher_->CreateEquivalentDispatcherAndCloseNoLock( |
| 41 return dispatcher_->CreateEquivalentDispatcherAndCloseNoLock(message_pipe, | 41 message_pipe, port), |
| 42 port); | 42 rights_); |
| 43 } | 43 } |
| 44 | 44 |
| 45 bool is_valid() const { return !!dispatcher_; } | 45 bool is_valid() const { return !!dispatcher_; } |
| 46 | 46 |
| 47 private: | 47 private: |
| 48 friend class Dispatcher::HandleTableAccess; | 48 friend class Dispatcher::HandleTableAccess; |
| 49 | 49 |
| 50 explicit HandleTransport(const Handle& handle) | 50 explicit HandleTransport(const Handle& handle) |
| 51 : dispatcher_(handle.dispatcher.get()), rights_(handle.rights) {} | 51 : dispatcher_(handle.dispatcher.get()), rights_(handle.rights) {} |
| 52 | 52 |
| 53 Dispatcher* dispatcher_; | 53 Dispatcher* dispatcher_; |
| 54 MojoHandleRights rights_; | 54 MojoHandleRights rights_; |
| 55 | 55 |
| 56 // Copy and assign allowed. | 56 // Copy and assign allowed. |
| 57 }; | 57 }; |
| 58 | 58 |
| 59 } // namespace system | 59 } // namespace system |
| 60 } // namespace mojo | 60 } // namespace mojo |
| 61 | 61 |
| 62 #endif // MOJO_EDK_SYSTEM_HANDLE_TRANSPORT_H_ | 62 #endif // MOJO_EDK_SYSTEM_HANDLE_TRANSPORT_H_ |
| OLD | NEW |