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

Unified Diff: content/child/web_data_consumer_handle_impl.cc

Issue 2363963002: Make WebDataConsumerHandleImpl return OK while zero-length reading of closed pipe. (Closed)
Patch Set: Created 4 years, 3 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 c111cca36035cb5863d525749d0a6bbf71930bf9..efb4f47084592ab01ab4b192644fc6aadc9df078 100644
--- a/content/child/web_data_consumer_handle_impl.cc
+++ b/content/child/web_data_consumer_handle_impl.cc
@@ -63,6 +63,12 @@ Result WebDataConsumerHandleImpl::ReaderImpl::read(void* data,
if (rv == MOJO_RESULT_OK)
*read_size = size_to_pass;
+ // 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.
+ if (!size && rv == MOJO_RESULT_FAILED_PRECONDITION)
+ return Ok;
+
return HandleReadResult(rv);
}

Powered by Google App Engine
This is Rietveld 408576698