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 #ifndef MOJO_SYSTEM_LOCAL_MESSAGE_PIPE_ENDPOINT_H_ | 5 #ifndef MOJO_SYSTEM_LOCAL_MESSAGE_PIPE_ENDPOINT_H_ |
6 #define MOJO_SYSTEM_LOCAL_MESSAGE_PIPE_ENDPOINT_H_ | 6 #define MOJO_SYSTEM_LOCAL_MESSAGE_PIPE_ENDPOINT_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "mojo/public/system/core.h" | 12 #include "mojo/public/system/core.h" |
13 #include "mojo/public/system/system_export.h" | 13 #include "mojo/public/system/system_export.h" |
14 #include "mojo/system/message_pipe_endpoint.h" | 14 #include "mojo/system/message_pipe_endpoint.h" |
15 #include "mojo/system/waiter_list.h" | 15 #include "mojo/system/waiter_list.h" |
16 | 16 |
17 namespace mojo { | 17 namespace mojo { |
18 namespace system { | 18 namespace system { |
19 | 19 |
20 class MOJO_SYSTEM_EXPORT LocalMessagePipeEndpoint : public MessagePipeEndpoint { | 20 class MOJO_SYSTEM_EXPORT LocalMessagePipeEndpoint : public MessagePipeEndpoint { |
21 public: | 21 public: |
22 LocalMessagePipeEndpoint(); | 22 LocalMessagePipeEndpoint(); |
23 virtual ~LocalMessagePipeEndpoint(); | 23 virtual ~LocalMessagePipeEndpoint(); |
24 | 24 |
25 // |MessagePipeEndpoint| implementation: | 25 // |MessagePipeEndpoint| implementation: |
26 virtual void Close() OVERRIDE; | 26 virtual void Close() OVERRIDE; |
27 virtual bool OnPeerClose() OVERRIDE; | 27 virtual bool OnPeerClose() OVERRIDE; |
28 virtual MojoResult EnqueueMessage(MessageInTransit* message) OVERRIDE; | 28 virtual MojoResult EnqueueMessage( |
| 29 MessageInTransit* message, |
| 30 const std::vector<Dispatcher*>* dispatchers) OVERRIDE; |
29 | 31 |
30 // There's a dispatcher for |LocalMessagePipeEndpoint|s, so we have to | 32 // There's a dispatcher for |LocalMessagePipeEndpoint|s, so we have to |
31 // implement/override these: | 33 // implement/override these: |
32 virtual void CancelAllWaiters() OVERRIDE; | 34 virtual void CancelAllWaiters() OVERRIDE; |
33 virtual MojoResult ReadMessage(void* bytes, uint32_t* num_bytes, | 35 virtual MojoResult ReadMessage( |
34 MojoHandle* handles, uint32_t* num_handles, | 36 void* bytes, uint32_t* num_bytes, |
35 MojoReadMessageFlags flags) OVERRIDE; | 37 uint32_t max_num_dispatchers, |
| 38 std::vector<scoped_refptr<Dispatcher> >* dispatchers, |
| 39 MojoReadMessageFlags flags) OVERRIDE; |
36 virtual MojoResult AddWaiter(Waiter* waiter, | 40 virtual MojoResult AddWaiter(Waiter* waiter, |
37 MojoWaitFlags flags, | 41 MojoWaitFlags flags, |
38 MojoResult wake_result) OVERRIDE; | 42 MojoResult wake_result) OVERRIDE; |
39 virtual void RemoveWaiter(Waiter* waiter) OVERRIDE; | 43 virtual void RemoveWaiter(Waiter* waiter) OVERRIDE; |
40 | 44 |
41 private: | 45 private: |
42 MojoWaitFlags SatisfiedFlags(); | 46 MojoWaitFlags SatisfiedFlags(); |
43 MojoWaitFlags SatisfiableFlags(); | 47 MojoWaitFlags SatisfiableFlags(); |
44 | 48 |
45 bool is_open_; | 49 bool is_open_; |
46 bool is_peer_open_; | 50 bool is_peer_open_; |
47 | 51 |
48 std::deque<MessageInTransit*> message_queue_; | 52 std::deque<MessageInTransit*> message_queue_; |
49 WaiterList waiter_list_; | 53 WaiterList waiter_list_; |
50 | 54 |
51 DISALLOW_COPY_AND_ASSIGN(LocalMessagePipeEndpoint); | 55 DISALLOW_COPY_AND_ASSIGN(LocalMessagePipeEndpoint); |
52 }; | 56 }; |
53 | 57 |
54 } // namespace system | 58 } // namespace system |
55 } // namespace mojo | 59 } // namespace mojo |
56 | 60 |
57 #endif // MOJO_SYSTEM_LOCAL_MESSAGE_PIPE_ENDPOINT_H_ | 61 #endif // MOJO_SYSTEM_LOCAL_MESSAGE_PIPE_ENDPOINT_H_ |
OLD | NEW |