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

Side by Side Diff: mojo/system/message_pipe_dispatcher.h

Issue 23621056: Initial in-process implementation of some Mojo primitives. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: build fix Created 7 years, 2 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 | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef MOJO_SYSTEM_MESSAGE_PIPE_DISPATCHER_H_
6 #define MOJO_SYSTEM_MESSAGE_PIPE_DISPATCHER_H_
7
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "base/memory/ref_counted.h"
11 #include "mojo/system/dispatcher.h"
12
13 namespace mojo {
14 namespace system {
15
16 class MessagePipe;
17
18 // This is the |Dispatcher| implementation for message pipes (created by the
19 // Mojo primitive |MojoCreateMessagePipe()|). This class is thread-safe.
20 class MessagePipeDispatcher : public Dispatcher {
21 public:
22 MessagePipeDispatcher();
23
24 // Must be called before any other methods. (This method is not thread-safe.)
25 void Init(scoped_refptr<MessagePipe> message_pipe, unsigned port);
26
27 private:
28 friend class base::RefCountedThreadSafe<MessagePipeDispatcher>;
29 virtual ~MessagePipeDispatcher();
30
31 // |Dispatcher| implementation/overrides:
32 virtual void CancelAllWaitersNoLock() OVERRIDE;
33 virtual MojoResult CloseImplNoLock() OVERRIDE;
34 virtual MojoResult WriteMessageImplNoLock(
35 const void* bytes,
36 uint32_t num_bytes,
37 const MojoHandle* handles,
38 uint32_t num_handles,
39 MojoWriteMessageFlags flags) OVERRIDE;
40 virtual MojoResult ReadMessageImplNoLock(
41 void* bytes,
42 uint32_t* num_bytes,
43 MojoHandle* handles,
44 uint32_t* num_handles,
45 MojoReadMessageFlags flags) OVERRIDE;
46 virtual MojoResult AddWaiterImplNoLock(Waiter* waiter,
47 MojoWaitFlags flags,
48 MojoResult wake_result) OVERRIDE;
49 virtual void RemoveWaiterImplNoLock(Waiter* waiter) OVERRIDE;
50
51 // Protected by |lock()|:
52 scoped_refptr<MessagePipe> message_pipe_; // This will be null if closed.
53 unsigned port_;
54
55 DISALLOW_COPY_AND_ASSIGN(MessagePipeDispatcher);
56 };
57
58 } // namespace system
59 } // namespace mojo
60
61 #endif // MOJO_SYSTEM_MESSAGE_PIPE_DISPATCHER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698