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

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

Issue 1942423002: EDK: Move DispatcherTransport to handle_transport.*. (Closed) Base URL: https://github.com/domokit/mojo.git@work789_edk_handle_9
Patch Set: rebased 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef MOJO_EDK_SYSTEM_HANDLE_TRANSPORT_H_
6 #define MOJO_EDK_SYSTEM_HANDLE_TRANSPORT_H_
7
8 #include "mojo/edk/system/dispatcher.h"
9 #include "mojo/edk/util/ref_ptr.h"
10 #include "mojo/edk/util/thread_annotations.h"
11
12 namespace mojo {
13 namespace system {
14
15 class MessagePipe;
16
17 // Wrapper around a |Dispatcher| pointer, while it's being processed to be
18 // passed in a message pipe. See the comment about
19 // |Dispatcher::HandleTableAccess| for more details.
20 //
21 // Note: This class is deliberately "thin" -- no more expensive than a
22 // |Dispatcher*|.
23 //
24 // TODO(vtl): Add handle rights to this, and rename it to HandleTransport.
25 class DispatcherTransport final {
26 public:
27 DispatcherTransport() : dispatcher_(nullptr) {}
28
29 void End() MOJO_NOT_THREAD_SAFE;
30
31 Dispatcher::Type GetType() const { return dispatcher_->GetType(); }
32 bool IsBusy() const MOJO_NOT_THREAD_SAFE {
33 return dispatcher_->IsBusyNoLock();
34 }
35 void Close() MOJO_NOT_THREAD_SAFE { dispatcher_->CloseNoLock(); }
36 util::RefPtr<Dispatcher> CreateEquivalentDispatcherAndClose(
37 MessagePipe* message_pipe,
38 unsigned port) MOJO_NOT_THREAD_SAFE {
39 return dispatcher_->CreateEquivalentDispatcherAndCloseNoLock(message_pipe,
40 port);
41 }
42
43 bool is_valid() const { return !!dispatcher_; }
44
45 private:
46 friend class Dispatcher::HandleTableAccess;
47
48 explicit DispatcherTransport(Dispatcher* dispatcher)
49 : dispatcher_(dispatcher) {}
50
51 Dispatcher* dispatcher_;
52
53 // Copy and assign allowed.
54 };
55
56 } // namespace system
57 } // namespace mojo
58
59 #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