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

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

Issue 60103005: Mojo: First stab at making MessagePipes work across OS pipes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 7 years, 1 month 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
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/system/message_pipe_endpoint.h" 14 #include "mojo/system/message_pipe_endpoint.h"
14 #include "mojo/system/waiter_list.h" 15 #include "mojo/system/waiter_list.h"
15 16
16 namespace mojo { 17 namespace mojo {
17 namespace system { 18 namespace system {
18 19
19 class MessageInTransit; 20 class MOJO_SYSTEM_EXPORT LocalMessagePipeEndpoint : public MessagePipeEndpoint {
20
21 class LocalMessagePipeEndpoint : public MessagePipeEndpoint {
22 public: 21 public:
23 LocalMessagePipeEndpoint(); 22 LocalMessagePipeEndpoint();
24 virtual ~LocalMessagePipeEndpoint(); 23 virtual ~LocalMessagePipeEndpoint();
25 24
26 // |MessagePipeEndpoint| implementation: 25 // |MessagePipeEndpoint| implementation:
27 virtual void OnPeerClose() OVERRIDE; 26 virtual void Close() OVERRIDE;
28 virtual MojoResult EnqueueMessage( 27 virtual bool OnPeerClose() OVERRIDE;
29 const void* bytes, uint32_t num_bytes, 28 virtual MojoResult EnqueueMessage(MessageInTransit* message) OVERRIDE;
30 const MojoHandle* handles, uint32_t num_handles,
31 MojoWriteMessageFlags flags) OVERRIDE;
32 29
33 // There's a dispatcher for |LocalMessagePipeEndpoint|s, so we have to 30 // There's a dispatcher for |LocalMessagePipeEndpoint|s, so we have to
34 // implement/override these: 31 // implement/override these:
35 virtual void CancelAllWaiters() OVERRIDE; 32 virtual void CancelAllWaiters() OVERRIDE;
36 virtual void Close() OVERRIDE;
37 virtual MojoResult ReadMessage(void* bytes, uint32_t* num_bytes, 33 virtual MojoResult ReadMessage(void* bytes, uint32_t* num_bytes,
38 MojoHandle* handles, uint32_t* num_handles, 34 MojoHandle* handles, uint32_t* num_handles,
39 MojoReadMessageFlags flags) OVERRIDE; 35 MojoReadMessageFlags flags) OVERRIDE;
40 virtual MojoResult AddWaiter(Waiter* waiter, 36 virtual MojoResult AddWaiter(Waiter* waiter,
41 MojoWaitFlags flags, 37 MojoWaitFlags flags,
42 MojoResult wake_result) OVERRIDE; 38 MojoResult wake_result) OVERRIDE;
43 virtual void RemoveWaiter(Waiter* waiter) OVERRIDE; 39 virtual void RemoveWaiter(Waiter* waiter) OVERRIDE;
44 40
45 private: 41 private:
46 MojoWaitFlags SatisfiedFlags(); 42 MojoWaitFlags SatisfiedFlags();
47 MojoWaitFlags SatisfiableFlags(); 43 MojoWaitFlags SatisfiableFlags();
48 44
49 bool is_open_; 45 bool is_open_;
50 bool is_peer_open_; 46 bool is_peer_open_;
51 47
52 std::deque<MessageInTransit*> message_queue_; 48 std::deque<MessageInTransit*> message_queue_;
53 WaiterList waiter_list_; 49 WaiterList waiter_list_;
54 50
55 DISALLOW_COPY_AND_ASSIGN(LocalMessagePipeEndpoint); 51 DISALLOW_COPY_AND_ASSIGN(LocalMessagePipeEndpoint);
56 }; 52 };
57 53
58 } // namespace system 54 } // namespace system
59 } // namespace mojo 55 } // namespace mojo
60 56
61 #endif // MOJO_SYSTEM_LOCAL_MESSAGE_PIPE_ENDPOINT_H_ 57 #endif // MOJO_SYSTEM_LOCAL_MESSAGE_PIPE_ENDPOINT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698