Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(56)

Side by Side Diff: mojo/edk/system/handle_transport.h

Issue 1947733002: EDK: Rename DispatcherTransport to HandleTransport. (Closed) Base URL: https://github.com/domokit/mojo.git@work790_edk_handle_11-x-work788_edk_handle_10
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « mojo/edk/system/handle_table.cc ('k') | mojo/edk/system/handle_transport.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "mojo/edk/util/thread_annotations.h" 11 #include "mojo/edk/util/thread_annotations.h"
12 #include "mojo/public/c/system/handle.h" 12 #include "mojo/public/c/system/handle.h"
13 13
14 namespace mojo { 14 namespace mojo {
15 namespace system { 15 namespace system {
16 16
17 class MessagePipe; 17 class MessagePipe;
18 18
19 // Like |Handle|, but non-owning, for use while a handle is being processed to 19 // Like |Handle|, but non-owning, for use while a handle is being processed to
20 // be passed in a message pipe (note this is only *during* the "write message" 20 // be passed in a message pipe (note this is only *during* the "write message"
21 // call). (I.e., this is a wrapper around a |Dispatcher*| and a 21 // call). (I.e., this is a wrapper around a |Dispatcher*| and a
22 // |MojoHandleRights|.) See the comment about |Dispatcher::HandleTableAccess| 22 // |MojoHandleRights|.) See the comment about |Dispatcher::HandleTableAccess|
23 // for more details. 23 // for more details.
24 // 24 //
25 // Note: This class is deliberately "thin" -- no more expensive than a struct 25 // Note: This class is deliberately "thin" -- no more expensive than a struct
26 // containing a |Dispatcher*| and a |MojoHandleRights|. 26 // containing a |Dispatcher*| and a |MojoHandleRights|.
27 // 27 class HandleTransport final {
28 // TODO(vtl): Rename this class to HandleTransport.
29 class DispatcherTransport final {
30 public: 28 public:
31 DispatcherTransport() 29 HandleTransport() : dispatcher_(nullptr), rights_(MOJO_HANDLE_RIGHT_NONE) {}
32 : dispatcher_(nullptr), rights_(MOJO_HANDLE_RIGHT_NONE) {}
33 30
34 void End() MOJO_NOT_THREAD_SAFE; 31 void End() MOJO_NOT_THREAD_SAFE;
35 32
36 Dispatcher::Type GetType() const { return dispatcher_->GetType(); } 33 Dispatcher::Type GetType() const { return dispatcher_->GetType(); }
37 bool IsBusy() const MOJO_NOT_THREAD_SAFE { 34 bool IsBusy() const MOJO_NOT_THREAD_SAFE {
38 return dispatcher_->IsBusyNoLock(); 35 return dispatcher_->IsBusyNoLock();
39 } 36 }
40 void Close() MOJO_NOT_THREAD_SAFE { dispatcher_->CloseNoLock(); } 37 void Close() MOJO_NOT_THREAD_SAFE { dispatcher_->CloseNoLock(); }
41 util::RefPtr<Dispatcher> CreateEquivalentDispatcherAndClose( 38 util::RefPtr<Dispatcher> CreateEquivalentDispatcherAndClose(
42 MessagePipe* message_pipe, 39 MessagePipe* message_pipe,
43 unsigned port) MOJO_NOT_THREAD_SAFE { 40 unsigned port) MOJO_NOT_THREAD_SAFE {
44 return dispatcher_->CreateEquivalentDispatcherAndCloseNoLock(message_pipe, 41 return dispatcher_->CreateEquivalentDispatcherAndCloseNoLock(message_pipe,
45 port); 42 port);
46 } 43 }
47 44
48 bool is_valid() const { return !!dispatcher_; } 45 bool is_valid() const { return !!dispatcher_; }
49 46
50 private: 47 private:
51 friend class Dispatcher::HandleTableAccess; 48 friend class Dispatcher::HandleTableAccess;
52 49
53 explicit DispatcherTransport(const Handle& handle) 50 explicit HandleTransport(const Handle& handle)
54 : dispatcher_(handle.dispatcher.get()), rights_(handle.rights) {} 51 : dispatcher_(handle.dispatcher.get()), rights_(handle.rights) {}
55 52
56 Dispatcher* dispatcher_; 53 Dispatcher* dispatcher_;
57 MojoHandleRights rights_; 54 MojoHandleRights rights_;
58 55
59 // Copy and assign allowed. 56 // Copy and assign allowed.
60 }; 57 };
61 58
62 } // namespace system 59 } // namespace system
63 } // namespace mojo 60 } // namespace mojo
64 61
65 #endif // MOJO_EDK_SYSTEM_HANDLE_TRANSPORT_H_ 62 #endif // MOJO_EDK_SYSTEM_HANDLE_TRANSPORT_H_
OLDNEW
« no previous file with comments | « mojo/edk/system/handle_table.cc ('k') | mojo/edk/system/handle_transport.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698