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

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

Issue 1475983004: Revert making HandleWatcher block until no longer waiting on pipe (r285266). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update comment (undo change in r283888 Created 5 years 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 | « mojo/message_pump/handle_watcher.cc ('k') | mojo/public/c/environment/async_waiter.h » ('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 #include "mojo/message_pump/message_pump_mojo.h" 5 #include "mojo/message_pump/message_pump_mojo.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/debug/alias.h" 10 #include "base/debug/alias.h"
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 handlers_.end()); 195 handlers_.end());
196 WillSignalHandler(); 196 WillSignalHandler();
197 handlers_[wait_state.handles[wait_many_result.index]] 197 handlers_[wait_state.handles[wait_many_result.index]]
198 .handler->OnHandleReady(wait_state.handles[wait_many_result.index]); 198 .handler->OnHandleReady(wait_state.handles[wait_many_result.index]);
199 DidSignalHandler(); 199 DidSignalHandler();
200 } 200 }
201 } else { 201 } else {
202 switch (result) { 202 switch (result) {
203 case MOJO_RESULT_CANCELLED: 203 case MOJO_RESULT_CANCELLED:
204 case MOJO_RESULT_FAILED_PRECONDITION: 204 case MOJO_RESULT_FAILED_PRECONDITION:
205 case MOJO_RESULT_INVALID_ARGUMENT:
205 RemoveInvalidHandle(wait_state, result, wait_many_result.index); 206 RemoveInvalidHandle(wait_state, result, wait_many_result.index);
206 break; 207 break;
207 case MOJO_RESULT_DEADLINE_EXCEEDED: 208 case MOJO_RESULT_DEADLINE_EXCEEDED:
208 did_work = false; 209 did_work = false;
209 break; 210 break;
210 default: 211 default:
211 base::debug::Alias(&result); 212 base::debug::Alias(&result);
212 // Unexpected result is likely fatal, crash so we can determine cause. 213 // Unexpected result is likely fatal, crash so we can determine cause.
213 CHECK(false); 214 CHECK(false);
214 } 215 }
(...skipping 27 matching lines...) Expand all
242 did_work = true; 243 did_work = true;
243 } 244 }
244 } 245 }
245 return did_work; 246 return did_work;
246 } 247 }
247 248
248 void MessagePumpMojo::RemoveInvalidHandle(const WaitState& wait_state, 249 void MessagePumpMojo::RemoveInvalidHandle(const WaitState& wait_state,
249 MojoResult result, 250 MojoResult result,
250 uint32_t index) { 251 uint32_t index) {
251 // TODO(sky): deal with control pipe going bad. 252 // TODO(sky): deal with control pipe going bad.
252 CHECK(result == MOJO_RESULT_FAILED_PRECONDITION || 253 CHECK(result == MOJO_RESULT_INVALID_ARGUMENT ||
254 result == MOJO_RESULT_FAILED_PRECONDITION ||
253 result == MOJO_RESULT_CANCELLED); 255 result == MOJO_RESULT_CANCELLED);
254 CHECK_NE(index, 0u); // Indicates the control pipe went bad. 256 CHECK_NE(index, 0u); // Indicates the control pipe went bad.
255 257
256 // Remove the handle first, this way if OnHandleError() tries to remove the 258 // Remove the handle first, this way if OnHandleError() tries to remove the
257 // handle our iterator isn't invalidated. 259 // handle our iterator isn't invalidated.
258 Handle handle = wait_state.handles[index]; 260 Handle handle = wait_state.handles[index];
259 CHECK(handlers_.find(handle) != handlers_.end()); 261 CHECK(handlers_.find(handle) != handlers_.end());
260 MessagePumpMojoHandler* handler = handlers_[handle].handler; 262 MessagePumpMojoHandler* handler = handlers_[handle].handler;
261 RemoveHandler(handle); 263 RemoveHandler(handle);
262 WillSignalHandler(); 264 WillSignalHandler();
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 void MessagePumpMojo::WillSignalHandler() { 311 void MessagePumpMojo::WillSignalHandler() {
310 FOR_EACH_OBSERVER(Observer, observers_, WillSignalHandler()); 312 FOR_EACH_OBSERVER(Observer, observers_, WillSignalHandler());
311 } 313 }
312 314
313 void MessagePumpMojo::DidSignalHandler() { 315 void MessagePumpMojo::DidSignalHandler() {
314 FOR_EACH_OBSERVER(Observer, observers_, DidSignalHandler()); 316 FOR_EACH_OBSERVER(Observer, observers_, DidSignalHandler());
315 } 317 }
316 318
317 } // namespace common 319 } // namespace common
318 } // namespace mojo 320 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/message_pump/handle_watcher.cc ('k') | mojo/public/c/environment/async_waiter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698