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

Unified Diff: content/child/url_response_body_consumer.cc

Issue 2750373002: Revert of Mojo: Armed Watchers (Closed)
Patch Set: 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
« no previous file with comments | « content/child/url_response_body_consumer.h ('k') | content/child/web_data_consumer_handle_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/url_response_body_consumer.cc
diff --git a/content/child/url_response_body_consumer.cc b/content/child/url_response_body_consumer.cc
index 1095ea15c3eee1a6e9bfc273a85289ac30b74618..a51b4f70a36bb43616203c12e30743193268423c 100644
--- a/content/child/url_response_body_consumer.cc
+++ b/content/child/url_response_body_consumer.cc
@@ -48,15 +48,15 @@
: request_id_(request_id),
resource_dispatcher_(resource_dispatcher),
handle_(std::move(handle)),
- handle_watcher_(FROM_HERE,
- mojo::SimpleWatcher::ArmingPolicy::MANUAL,
- task_runner),
+ handle_watcher_(FROM_HERE, task_runner),
task_runner_(task_runner),
has_seen_end_of_data_(!handle_.is_valid()) {
- handle_watcher_.Watch(
+ handle_watcher_.Start(
handle_.get(), MOJO_HANDLE_SIGNAL_READABLE,
base::Bind(&URLResponseBodyConsumer::OnReadable, base::Unretained(this)));
- handle_watcher_.ArmOrNotify();
+ task_runner_->PostTask(
+ FROM_HERE, base::Bind(&URLResponseBodyConsumer::OnReadable, AsWeakPtr(),
+ MOJO_RESULT_OK));
}
URLResponseBodyConsumer::~URLResponseBodyConsumer() {}
@@ -91,7 +91,9 @@
if (is_in_on_readable_)
return;
- handle_watcher_.ArmOrNotify();
+ task_runner_->PostTask(
+ FROM_HERE, base::Bind(&URLResponseBodyConsumer::OnReadable, AsWeakPtr(),
+ MOJO_RESULT_OK));
}
void URLResponseBodyConsumer::OnReadable(MojoResult unused) {
@@ -110,11 +112,7 @@
uint32_t available = 0;
MojoResult result = mojo::BeginReadDataRaw(
handle_.get(), &buffer, &available, MOJO_READ_DATA_FLAG_NONE);
- if (result == MOJO_RESULT_SHOULD_WAIT) {
- handle_watcher_.ArmOrNotify();
- return;
- }
- if (result == MOJO_RESULT_BUSY)
+ if (result == MOJO_RESULT_SHOULD_WAIT || result == MOJO_RESULT_BUSY)
return;
if (result == MOJO_RESULT_FAILED_PRECONDITION) {
has_seen_end_of_data_ = true;
@@ -136,7 +134,9 @@
// to the next task.
result = mojo::EndReadDataRaw(handle_.get(), 0);
DCHECK_EQ(result, MOJO_RESULT_OK);
- handle_watcher_.ArmOrNotify();
+ task_runner_->PostTask(FROM_HERE,
+ base::Bind(&URLResponseBodyConsumer::OnReadable,
+ AsWeakPtr(), MOJO_RESULT_OK));
return;
}
num_bytes_consumed += available;
« no previous file with comments | « content/child/url_response_body_consumer.h ('k') | content/child/web_data_consumer_handle_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698