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

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

Issue 240133005: Mojo: Make some attempts towards fixing remote message pipe closure. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix some locking issues Created 6 years, 8 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
« no previous file with comments | « mojo/system/message_pipe_dispatcher.cc ('k') | mojo/system/message_pipe_endpoint.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 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_MESSAGE_PIPE_ENDPOINT_H_ 5 #ifndef MOJO_SYSTEM_MESSAGE_PIPE_ENDPOINT_H_
6 #define MOJO_SYSTEM_MESSAGE_PIPE_ENDPOINT_H_ 6 #define MOJO_SYSTEM_MESSAGE_PIPE_ENDPOINT_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <vector> 10 #include <vector>
(...skipping 24 matching lines...) Expand all
35 public: 35 public:
36 virtual ~MessagePipeEndpoint() {} 36 virtual ~MessagePipeEndpoint() {}
37 37
38 enum Type { 38 enum Type {
39 kTypeLocal, 39 kTypeLocal,
40 kTypeProxy 40 kTypeProxy
41 }; 41 };
42 virtual Type GetType() const = 0; 42 virtual Type GetType() const = 0;
43 43
44 // All implementations must implement these. 44 // All implementations must implement these.
45 virtual void Close() = 0; 45 // Returns false if the endpoint should be closed and destroyed, else true.
46 virtual void OnPeerClose() = 0; 46 virtual bool OnPeerClose() = 0;
47 // Implements |MessagePipe::EnqueueMessage()|. The major differences are that: 47 // Implements |MessagePipe::EnqueueMessage()|. The major differences are that:
48 // a) Dispatchers have been vetted and cloned/attached to the message. 48 // a) Dispatchers have been vetted and cloned/attached to the message.
49 // b) At this point, we cannot report failure (if, e.g., a channel is torn 49 // b) At this point, we cannot report failure (if, e.g., a channel is torn
50 // down at this point, we should silently swallow the message). 50 // down at this point, we should silently swallow the message).
51 virtual void EnqueueMessage(scoped_ptr<MessageInTransit> message) = 0; 51 virtual void EnqueueMessage(scoped_ptr<MessageInTransit> message) = 0;
52 52
53 // Implementations must override these if they represent a local endpoint, 53 // Implementations must override these if they represent a local endpoint,
54 // i.e., one for which there's a |MessagePipeDispatcher| (and thus a handle). 54 // i.e., one for which there's a |MessagePipeDispatcher| (and thus a handle).
55 // An implementation for a proxy endpoint (for which there's no dispatcher) 55 // An implementation for a proxy endpoint (for which there's no dispatcher)
56 // needs not override these methods, since they should never be called. 56 // needs not override these methods, since they should never be called.
57 // 57 //
58 // These methods implement the methods of the same name in |MessagePipe|, 58 // These methods implement the methods of the same name in |MessagePipe|,
59 // though |MessagePipe|'s implementation may have to do a little more if the 59 // though |MessagePipe|'s implementation may have to do a little more if the
60 // operation involves both endpoints. 60 // operation involves both endpoints.
61 virtual void Close();
61 virtual void CancelAllWaiters(); 62 virtual void CancelAllWaiters();
62 virtual MojoResult ReadMessage( 63 virtual MojoResult ReadMessage(
63 void* bytes, uint32_t* num_bytes, 64 void* bytes, uint32_t* num_bytes,
64 std::vector<scoped_refptr<Dispatcher> >* dispatchers, 65 std::vector<scoped_refptr<Dispatcher> >* dispatchers,
65 uint32_t* num_dispatchers, 66 uint32_t* num_dispatchers,
66 MojoReadMessageFlags flags); 67 MojoReadMessageFlags flags);
67 virtual MojoResult AddWaiter(Waiter* waiter, 68 virtual MojoResult AddWaiter(Waiter* waiter,
68 MojoWaitFlags flags, 69 MojoWaitFlags flags,
69 MojoResult wake_result); 70 MojoResult wake_result);
70 virtual void RemoveWaiter(Waiter* waiter); 71 virtual void RemoveWaiter(Waiter* waiter);
71 72
72 // Implementations must override these if they represent a proxy endpoint. An 73 // Implementations must override these if they represent a proxy endpoint. An
73 // implementation for a local endpoint needs not override these methods, since 74 // implementation for a local endpoint needs not override these methods, since
74 // they should never be called. 75 // they should never be called.
75 virtual void Attach(scoped_refptr<Channel> channel, 76 virtual void Attach(scoped_refptr<Channel> channel,
76 MessageInTransit::EndpointId local_id); 77 MessageInTransit::EndpointId local_id);
77 virtual void Run(MessageInTransit::EndpointId remote_id); 78 // Returns false if the endpoint should be closed and destroyed, else true.
79 virtual bool Run(MessageInTransit::EndpointId remote_id);
80 virtual void OnRemove();
78 81
79 protected: 82 protected:
80 MessagePipeEndpoint() {} 83 MessagePipeEndpoint() {}
81 84
82 private: 85 private:
83 DISALLOW_COPY_AND_ASSIGN(MessagePipeEndpoint); 86 DISALLOW_COPY_AND_ASSIGN(MessagePipeEndpoint);
84 }; 87 };
85 88
86 } // namespace system 89 } // namespace system
87 } // namespace mojo 90 } // namespace mojo
88 91
89 #endif // MOJO_SYSTEM_MESSAGE_PIPE_ENDPOINT_H_ 92 #endif // MOJO_SYSTEM_MESSAGE_PIPE_ENDPOINT_H_
OLDNEW
« no previous file with comments | « mojo/system/message_pipe_dispatcher.cc ('k') | mojo/system/message_pipe_endpoint.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698