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

Unified Diff: content/child/web_data_consumer_handle_impl.cc

Issue 2741033003: Mojo EDK: Introduce MojoQueryHandleSignalsState API (Closed)
Patch Set: rebase Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: content/child/web_data_consumer_handle_impl.cc
diff --git a/content/child/web_data_consumer_handle_impl.cc b/content/child/web_data_consumer_handle_impl.cc
index b40f479861e1ba145c80e339da7f8bb6dd80d81c..5d2ac1d520b48d15e5f969f24cbf43ea86c828a7 100644
--- a/content/child/web_data_consumer_handle_impl.cc
+++ b/content/child/web_data_consumer_handle_impl.cc
@@ -62,20 +62,13 @@ Result WebDataConsumerHandleImpl::ReaderImpl::read(void* data,
// Even if there is unread data available, mojo::ReadDataRaw() returns
// FAILED_PRECONDITION when |size| is 0 and the producer handle was closed.
// But in this case, WebDataConsumerHandle::Reader::read() must return Ok.
- // So we use mojo::Wait() with 0 deadline to check whether readable or not.
- MojoResult wait_result = mojo::Wait(
- context_->handle().get(), MOJO_HANDLE_SIGNAL_READABLE, 0, nullptr);
- switch (wait_result) {
- case MOJO_RESULT_OK:
- return Ok;
- case MOJO_RESULT_FAILED_PRECONDITION:
- return Done;
- case MOJO_RESULT_DEADLINE_EXCEEDED:
- return ShouldWait;
- default:
- NOTREACHED();
- return UnexpectedError;
- }
+ // So we query the signals state directly.
+ mojo::HandleSignalsState state = context_->handle()->QuerySignalsState();
+ if (state.readable())
+ return Ok;
+ else if (state.never_readable())
yzshen1 2017/03/14 18:20:44 nit: I think the style guide says we don't need "e
Ken Rockot(use gerrit already) 2017/03/14 19:16:18 Ah right, done
+ return Done;
+ return ShouldWait;
}
uint32_t size_to_pass = size;
« no previous file with comments | « no previous file | mojo/android/javatests/src/org/chromium/mojo/HandleMock.java » ('j') | mojo/edk/test/mojo_test_base.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698