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

Unified Diff: media/filters/ffmpeg_audio_decoder.cc

Issue 10855051: Use enum instead of string in MessageLoopFactory::GetMessageLoop* (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Resolve comments. Created 8 years, 4 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: media/filters/ffmpeg_audio_decoder.cc
diff --git a/media/filters/ffmpeg_audio_decoder.cc b/media/filters/ffmpeg_audio_decoder.cc
index 903edba437ee7484239326add7b4daebc30a0566..ec050fb1eba23e03c143787136d0fd03336c249e 100644
--- a/media/filters/ffmpeg_audio_decoder.cc
+++ b/media/filters/ffmpeg_audio_decoder.cc
@@ -6,6 +6,8 @@
#include "base/bind.h"
#include "base/callback_helpers.h"
+#include "base/location.h"
+#include "base/message_loop_proxy.h"
#include "media/base/audio_decoder_config.h"
#include "media/base/data_buffer.h"
#include "media/base/decoder_buffer.h"
@@ -25,8 +27,7 @@ static inline bool IsEndOfStream(int result, int decoded_size, Buffer* input) {
return result == 0 && decoded_size == 0 && input->IsEndOfStream();
}
-FFmpegAudioDecoder::FFmpegAudioDecoder(
- const base::Callback<MessageLoop*()>& message_loop_cb)
+FFmpegAudioDecoder::FFmpegAudioDecoder(const MessageLoopCB& message_loop_cb)
: message_loop_factory_cb_(message_loop_cb),
message_loop_(NULL),
codec_context_(NULL),
@@ -49,8 +50,7 @@ void FFmpegAudioDecoder::Initialize(
FFmpegGlue::GetInstance();
if (!message_loop_) {
- message_loop_ = message_loop_factory_cb_.Run();
- message_loop_factory_cb_.Reset();
+ message_loop_ = base::ResetAndReturn(&message_loop_factory_cb_).Run();
} else {
// TODO(scherkus): initialization currently happens more than once in
// PipelineIntegrationTest.BasicPlayback.
@@ -154,7 +154,7 @@ void FFmpegAudioDecoder::DoReset(const base::Closure& closure) {
}
void FFmpegAudioDecoder::DoRead(const ReadCB& read_cb) {
- DCHECK_EQ(MessageLoop::current(), message_loop_);
+ DCHECK(message_loop_->BelongsToCurrentThread());
DCHECK(!read_cb.is_null());
CHECK(read_cb_.is_null()) << "Overlapping decodes are not supported.";
@@ -165,7 +165,7 @@ void FFmpegAudioDecoder::DoRead(const ReadCB& read_cb) {
void FFmpegAudioDecoder::DoDecodeBuffer(
DemuxerStream::Status status,
const scoped_refptr<DecoderBuffer>& input) {
- DCHECK_EQ(MessageLoop::current(), message_loop_);
+ DCHECK(message_loop_->BelongsToCurrentThread());
DCHECK(!read_cb_.is_null());
if (status != DemuxerStream::kOk) {

Powered by Google App Engine
This is Rietveld 408576698