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

Unified Diff: media/mojo/common/mojo_decoder_buffer_converter.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 | « media/mojo/common/mojo_decoder_buffer_converter.h ('k') | media/remoting/demuxer_stream_adapter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/mojo/common/mojo_decoder_buffer_converter.cc
diff --git a/media/mojo/common/mojo_decoder_buffer_converter.cc b/media/mojo/common/mojo_decoder_buffer_converter.cc
index d47e5f56a67644b34719a05660029b385dd34a8a..32080d3af4458ff28707a811c51bec9e38035b8f 100644
--- a/media/mojo/common/mojo_decoder_buffer_converter.cc
+++ b/media/mojo/common/mojo_decoder_buffer_converter.cc
@@ -64,20 +64,18 @@
MojoDecoderBufferReader::MojoDecoderBufferReader(
mojo::ScopedDataPipeConsumerHandle consumer_handle)
: consumer_handle_(std::move(consumer_handle)),
- pipe_watcher_(FROM_HERE, mojo::SimpleWatcher::ArmingPolicy::MANUAL),
+ pipe_watcher_(FROM_HERE),
bytes_read_(0) {
DVLOG(1) << __func__;
MojoResult result =
- pipe_watcher_.Watch(consumer_handle_.get(), MOJO_HANDLE_SIGNAL_READABLE,
+ pipe_watcher_.Start(consumer_handle_.get(), MOJO_HANDLE_SIGNAL_READABLE,
base::Bind(&MojoDecoderBufferReader::OnPipeReadable,
base::Unretained(this)));
if (result != MOJO_RESULT_OK) {
DVLOG(1) << __func__
<< ": Failed to start watching the pipe. result=" << result;
consumer_handle_.reset();
- } else {
- pipe_watcher_.ArmOrNotify();
}
}
@@ -161,16 +159,13 @@
if (IsPipeReadWriteError(result)) {
OnPipeError(result);
- } else {
- pipe_watcher_.ArmOrNotify();
- if (result == MOJO_RESULT_OK) {
- DCHECK_GT(num_bytes, 0u);
- bytes_read_ += num_bytes;
- if (bytes_read_ == buffer_size) {
- DCHECK(read_cb_);
- bytes_read_ = 0;
- std::move(read_cb_).Run(std::move(media_buffer_));
- }
+ } else if (result == MOJO_RESULT_OK) {
+ DCHECK_GT(num_bytes, 0u);
+ bytes_read_ += num_bytes;
+ if (bytes_read_ == buffer_size) {
+ DCHECK(read_cb_);
+ bytes_read_ = 0;
+ std::move(read_cb_).Run(std::move(media_buffer_));
}
}
}
@@ -191,20 +186,18 @@
MojoDecoderBufferWriter::MojoDecoderBufferWriter(
mojo::ScopedDataPipeProducerHandle producer_handle)
: producer_handle_(std::move(producer_handle)),
- pipe_watcher_(FROM_HERE, mojo::SimpleWatcher::ArmingPolicy::MANUAL),
+ pipe_watcher_(FROM_HERE),
bytes_written_(0) {
DVLOG(1) << __func__;
MojoResult result =
- pipe_watcher_.Watch(producer_handle_.get(), MOJO_HANDLE_SIGNAL_WRITABLE,
+ pipe_watcher_.Start(producer_handle_.get(), MOJO_HANDLE_SIGNAL_WRITABLE,
base::Bind(&MojoDecoderBufferWriter::OnPipeWritable,
base::Unretained(this)));
if (result != MOJO_RESULT_OK) {
DVLOG(1) << __func__
<< ": Failed to start watching the pipe. result=" << result;
producer_handle_.reset();
- } else {
- pipe_watcher_.ArmOrNotify();
}
}
@@ -280,15 +273,12 @@
if (IsPipeReadWriteError(result)) {
OnPipeError(result);
- } else {
- pipe_watcher_.ArmOrNotify();
- if (result == MOJO_RESULT_OK) {
- DCHECK_GT(num_bytes, 0u);
- bytes_written_ += num_bytes;
- if (bytes_written_ == buffer_size) {
- media_buffer_ = nullptr;
- bytes_written_ = 0;
- }
+ } else if (result == MOJO_RESULT_OK) {
+ DCHECK_GT(num_bytes, 0u);
+ bytes_written_ += num_bytes;
+ if (bytes_written_ == buffer_size) {
+ media_buffer_ = nullptr;
+ bytes_written_ = 0;
}
}
« no previous file with comments | « media/mojo/common/mojo_decoder_buffer_converter.h ('k') | media/remoting/demuxer_stream_adapter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698