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; |
} |
} |