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

Unified Diff: content/child/web_data_consumer_handle_impl.cc

Issue 2930573002: [Merge to M60] Use MANUAL arming policy for WebDataConsumerHandleImpl (Closed)
Patch Set: Created 3 years, 6 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
« no previous file with comments | « no previous file | content/child/web_data_consumer_handle_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 66f50752b52beb226205446af3302ae69ccdd763..8d00e993cd7035903e92ac039e6e35f40ae37295 100644
--- a/content/child/web_data_consumer_handle_impl.cc
+++ b/content/child/web_data_consumer_handle_impl.cc
@@ -38,7 +38,7 @@ WebDataConsumerHandleImpl::ReaderImpl::ReaderImpl(
scoped_refptr<Context> context,
Client* client)
: context_(context),
- handle_watcher_(FROM_HERE, mojo::SimpleWatcher::ArmingPolicy::AUTOMATIC),
+ handle_watcher_(FROM_HERE, mojo::SimpleWatcher::ArmingPolicy::MANUAL),
client_(client) {
if (client_)
StartWatching();
@@ -77,6 +77,8 @@ Result WebDataConsumerHandleImpl::ReaderImpl::Read(void* data,
&size_to_pass, flags_to_pass);
if (rv == MOJO_RESULT_OK)
*read_size = size_to_pass;
+ if (rv == MOJO_RESULT_OK || rv == MOJO_RESULT_SHOULD_WAIT)
+ handle_watcher_.ArmOrNotify();
return HandleReadResult(rv);
}
@@ -103,6 +105,8 @@ Result WebDataConsumerHandleImpl::ReaderImpl::BeginRead(const void** buffer,
Result WebDataConsumerHandleImpl::ReaderImpl::EndRead(size_t read_size) {
MojoResult rv = mojo::EndReadDataRaw(context_->handle().get(), read_size);
+ if (rv == MOJO_RESULT_OK)
+ handle_watcher_.ArmOrNotify();
return rv == MOJO_RESULT_OK ? kOk : kUnexpectedError;
}
@@ -128,6 +132,7 @@ void WebDataConsumerHandleImpl::ReaderImpl::StartWatching() {
handle_watcher_.Watch(
context_->handle().get(), MOJO_HANDLE_SIGNAL_READABLE,
base::Bind(&ReaderImpl::OnHandleGotReadable, base::Unretained(this)));
+ handle_watcher_.ArmOrNotify();
}
void WebDataConsumerHandleImpl::ReaderImpl::OnHandleGotReadable(MojoResult) {
« no previous file with comments | « no previous file | content/child/web_data_consumer_handle_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698