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

Side by Side Diff: mojo/message_pump/message_pump_mojo.h

Issue 1573383002: Couple of small cleanups to MessagePumpMojo. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 | « no previous file | mojo/message_pump/message_pump_mojo.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_MESSAGE_PUMP_MESSAGE_PUMP_MOJO_H_ 5 #ifndef MOJO_MESSAGE_PUMP_MESSAGE_PUMP_MOJO_H_
6 #define MOJO_MESSAGE_PUMP_MESSAGE_PUMP_MOJO_H_ 6 #define MOJO_MESSAGE_PUMP_MESSAGE_PUMP_MOJO_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 // Waits for handles in the wait set to become ready. Returns |true| if ready 96 // Waits for handles in the wait set to become ready. Returns |true| if ready
97 // handles may be available, or |false| if the wait's deadline was exceeded. 97 // handles may be available, or |false| if the wait's deadline was exceeded.
98 // Note, ready handles may be unavailable, even though |true| was returned. 98 // Note, ready handles may be unavailable, even though |true| was returned.
99 bool WaitForReadyHandles(const RunState& run_state) const; 99 bool WaitForReadyHandles(const RunState& run_state) const;
100 100
101 // Retrieves any 'ready' handles from the wait set, and runs the handler's 101 // Retrieves any 'ready' handles from the wait set, and runs the handler's
102 // OnHandleReady() or OnHandleError() functions as necessary. Returns |true| 102 // OnHandleReady() or OnHandleError() functions as necessary. Returns |true|
103 // if any handles were ready and processed. 103 // if any handles were ready and processed.
104 bool ProcessReadyHandles(); 104 bool ProcessReadyHandles();
105 105
106 // Removes the given invalid handle. This is called if MojoGetReadyHandles
107 // finds an invalid or closed handle.
108 void RemoveInvalidHandle(MojoResult result, Handle handle);
109
110 // Removes any handles that have expired their deadline. Runs the handler's 106 // Removes any handles that have expired their deadline. Runs the handler's
111 // OnHandleError() function with |MOJO_RESULT_DEADLINE_EXCEEDED| as the 107 // OnHandleError() function with |MOJO_RESULT_DEADLINE_EXCEEDED| as the
112 // result. Returns |true| if any handles were removed. 108 // result. Returns |true| if any handles were removed.
113 bool RemoveExpiredHandles(); 109 bool RemoveExpiredHandles();
114 110
115 void SignalControlPipe(); 111 void SignalControlPipe();
116 112
117 // Returns the deadline for the call to MojoWait(). 113 // Returns the deadline for the call to MojoWait().
118 MojoDeadline GetDeadlineForWait(const RunState& run_state) const; 114 MojoDeadline GetDeadlineForWait(const RunState& run_state) const;
119 115
120 // Run |OnHandleReady()| for the handler registered with |handle|. |handle| 116 // Run |OnHandleReady()| for the handler registered with |handle|. |handle|
121 // must be registered. 117 // must be registered.
122 void SignalHandleReady(Handle handle); 118 void SignalHandleReady(Handle handle);
123 119
120 // Run |OnHandleError()| for the handler registered with |handle| and the
121 // error code |result|. |handle| must be registered, and will be removed
122 // before calling |OnHandleError()|.
123 void SignalHandleError(Handle handle, MojoResult result);
124
124 void WillSignalHandler(); 125 void WillSignalHandler();
125 void DidSignalHandler(); 126 void DidSignalHandler();
126 127
127 // If non-NULL we're running (inside Run()). Member is reference to value on 128 // If non-NULL we're running (inside Run()). Member is reference to value on
128 // stack. 129 // stack.
129 RunState* run_state_; 130 RunState* run_state_;
130 131
131 // Lock for accessing |run_state_|. In general the only method that we have to 132 // Lock for accessing |run_state_|. In general the only method that we have to
132 // worry about is ScheduleWork(). All other methods are invoked on the same 133 // worry about is ScheduleWork(). All other methods are invoked on the same
133 // thread. 134 // thread.
(...skipping 20 matching lines...) Expand all
154 ScopedMessagePipeHandle read_handle_; 155 ScopedMessagePipeHandle read_handle_;
155 ScopedMessagePipeHandle write_handle_; 156 ScopedMessagePipeHandle write_handle_;
156 157
157 DISALLOW_COPY_AND_ASSIGN(MessagePumpMojo); 158 DISALLOW_COPY_AND_ASSIGN(MessagePumpMojo);
158 }; 159 };
159 160
160 } // namespace common 161 } // namespace common
161 } // namespace mojo 162 } // namespace mojo
162 163
163 #endif // MOJO_MESSAGE_PUMP_MESSAGE_PUMP_MOJO_H_ 164 #endif // MOJO_MESSAGE_PUMP_MESSAGE_PUMP_MOJO_H_
OLDNEW
« no previous file with comments | « no previous file | mojo/message_pump/message_pump_mojo.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698