Skip to content

Commit

Permalink
media: Migrate callers of message_loop_proxy() to task_runner()
Browse files Browse the repository at this point in the history
Migrate callers of {MessageLoop,Thread}::message_loop_proxy() to
{MessageLoop,Thread}::task_runner(). Since the types at the call sites
have already been updated, this is just a bulk rename.

BUG=465354

Review URL: https://codereview.chromium.org/1182123003

Cr-Commit-Position: refs/heads/master@{#334841}
  • Loading branch information
skyostil authored and Commit bot committed Jun 17, 2015
1 parent 8a033aa commit 6f5f140
Show file tree
Hide file tree
Showing 38 changed files with 72 additions and 72 deletions.
2 changes: 1 addition & 1 deletion media/audio/alsa/alsa_output_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class MockAudioManagerAlsa : public AudioManagerAlsa {
// We don't mock this method since all tests will do the same thing
// and use the current task runner.
scoped_refptr<base::SingleThreadTaskRunner> GetTaskRunner() override {
return base::MessageLoop::current()->message_loop_proxy();
return base::MessageLoop::current()->task_runner();
}

private:
Expand Down
4 changes: 2 additions & 2 deletions media/audio/audio_input_controller_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ TEST_F(AudioInputControllerTest, RecordAndClose) {
EXPECT_CALL(event_handler, OnData(NotNull(), NotNull()))
.Times(AtLeast(10))
.WillRepeatedly(CheckCountAndPostQuitTask(
&count, 10, message_loop_.message_loop_proxy()));
&count, 10, message_loop_.task_runner()));

scoped_ptr<AudioManager> audio_manager(AudioManager::CreateForTesting());
AudioParameters params(AudioParameters::AUDIO_FAKE, kChannelLayout,
Expand Down Expand Up @@ -166,7 +166,7 @@ TEST_F(AudioInputControllerTest, DISABLED_RecordAndError) {
EXPECT_CALL(event_handler, OnData(NotNull(), NotNull()))
.Times(AtLeast(10))
.WillRepeatedly(CheckCountAndPostQuitTask(
&count, 10, message_loop_.message_loop_proxy()));
&count, 10, message_loop_.task_runner()));

// OnError() will be called after the data stream stops while the
// controller is in a recording state.
Expand Down
2 changes: 1 addition & 1 deletion media/audio/audio_low_latency_input_output_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class MockAudioManager : public AudioManagerAnyPlatform {
~MockAudioManager() override {}

scoped_refptr<base::SingleThreadTaskRunner> GetTaskRunner() override {
return base::MessageLoop::current()->message_loop_proxy();
return base::MessageLoop::current()->task_runner();
}

private:
Expand Down
4 changes: 2 additions & 2 deletions media/audio/audio_manager_base.cc
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ AudioManagerBase::AudioManagerBase(AudioLogFactory* audio_log_factory)
#endif

CHECK(audio_thread_.Start());
task_runner_ = audio_thread_.message_loop_proxy();
task_runner_ = audio_thread_.task_runner();
}

AudioManagerBase::~AudioManagerBase() {
Expand Down Expand Up @@ -129,7 +129,7 @@ AudioManagerBase::GetWorkerTaskRunner() {
if (!audio_thread_.IsRunning())
CHECK(audio_thread_.Start());

return audio_thread_.message_loop_proxy();
return audio_thread_.task_runner();
}

AudioOutputStream* AudioManagerBase::MakeAudioOutputStream(
Expand Down
4 changes: 2 additions & 2 deletions media/audio/audio_output_proxy_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,9 @@ class AudioOutputProxyTest : public testing::Test {
protected:
void SetUp() override {
EXPECT_CALL(manager_, GetTaskRunner())
.WillRepeatedly(Return(message_loop_.message_loop_proxy()));
.WillRepeatedly(Return(message_loop_.task_runner()));
EXPECT_CALL(manager_, GetWorkerTaskRunner())
.WillRepeatedly(Return(message_loop_.message_loop_proxy()));
.WillRepeatedly(Return(message_loop_.task_runner()));
// Use a low sample rate and large buffer size when testing otherwise the
// FakeAudioOutputStream will keep the message loop busy indefinitely; i.e.,
// RunUntilIdle() will never terminate.
Expand Down
12 changes: 6 additions & 6 deletions media/audio/fake_audio_worker_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class FakeAudioWorkerTest : public testing::Test {
FakeAudioWorkerTest()
: params_(
AudioParameters::AUDIO_FAKE, CHANNEL_LAYOUT_STEREO, 44100, 8, 128),
fake_worker_(message_loop_.message_loop_proxy(), params_),
fake_worker_(message_loop_.task_runner(), params_),
seen_callbacks_(0) {
time_between_callbacks_ = base::TimeDelta::FromMicroseconds(
params_.frames_per_buffer() * base::Time::kMicrosecondsPerSecond /
Expand All @@ -33,13 +33,13 @@ class FakeAudioWorkerTest : public testing::Test {
}

void RunOnAudioThread() {
ASSERT_TRUE(message_loop_.message_loop_proxy()->BelongsToCurrentThread());
ASSERT_TRUE(message_loop_.task_runner()->BelongsToCurrentThread());
fake_worker_.Start(base::Bind(
&FakeAudioWorkerTest::CalledByFakeWorker, base::Unretained(this)));
}

void RunOnceOnAudioThread() {
ASSERT_TRUE(message_loop_.message_loop_proxy()->BelongsToCurrentThread());
ASSERT_TRUE(message_loop_.task_runner()->BelongsToCurrentThread());
RunOnAudioThread();
// Start() should immediately post a task to run the callback, so we
// should end up with only a single callback being run.
Expand All @@ -48,13 +48,13 @@ class FakeAudioWorkerTest : public testing::Test {
}

void StopStartOnAudioThread() {
ASSERT_TRUE(message_loop_.message_loop_proxy()->BelongsToCurrentThread());
ASSERT_TRUE(message_loop_.task_runner()->BelongsToCurrentThread());
fake_worker_.Stop();
RunOnAudioThread();
}

void TimeCallbacksOnAudioThread(int callbacks) {
ASSERT_TRUE(message_loop_.message_loop_proxy()->BelongsToCurrentThread());
ASSERT_TRUE(message_loop_.task_runner()->BelongsToCurrentThread());

if (seen_callbacks_ == 0) {
RunOnAudioThread();
Expand All @@ -73,7 +73,7 @@ class FakeAudioWorkerTest : public testing::Test {
}

void EndTest(int callbacks) {
ASSERT_TRUE(message_loop_.message_loop_proxy()->BelongsToCurrentThread());
ASSERT_TRUE(message_loop_.task_runner()->BelongsToCurrentThread());
fake_worker_.Stop();
EXPECT_LE(callbacks, seen_callbacks_);
message_loop_.PostTask(FROM_HERE, base::MessageLoop::QuitClosure());
Expand Down
4 changes: 2 additions & 2 deletions media/audio/virtual_audio_input_stream_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class VirtualAudioInputStreamTest : public testing::TestWithParam<bool> {
stream_(NULL),
closed_stream_(false, false) {
audio_thread_->Start();
audio_task_runner_ = audio_thread_->message_loop_proxy();
audio_task_runner_ = audio_thread_->task_runner();
}

virtual ~VirtualAudioInputStreamTest() {
Expand Down Expand Up @@ -206,7 +206,7 @@ class VirtualAudioInputStreamTest : public testing::TestWithParam<bool> {
if (worker_is_separate_thread) {
if (!worker_thread_->IsRunning()) {
worker_thread_->Start();
worker_task_runner_ = worker_thread_->message_loop_proxy();
worker_task_runner_ = worker_thread_->task_runner();
}
return worker_task_runner_;
} else {
Expand Down
2 changes: 1 addition & 1 deletion media/audio/virtual_audio_output_stream_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class VirtualAudioOutputStreamTest : public testing::Test {
VirtualAudioOutputStreamTest()
: audio_thread_(new base::Thread("AudioThread")) {
audio_thread_->Start();
audio_task_runner_ = audio_thread_->message_loop_proxy();
audio_task_runner_ = audio_thread_->task_runner();
}

const scoped_refptr<base::SingleThreadTaskRunner>& audio_task_runner() const {
Expand Down
2 changes: 1 addition & 1 deletion media/base/android/audio_decoder_job.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ base::LazyInstance<AudioDecoderThread>::Leaky
AudioDecoderJob::AudioDecoderJob(
const base::Closure& request_data_cb,
const base::Closure& on_demuxer_config_changed_cb)
: MediaDecoderJob(g_audio_decoder_thread.Pointer()->message_loop_proxy(),
: MediaDecoderJob(g_audio_decoder_thread.Pointer()->task_runner(),
request_data_cb,
on_demuxer_config_changed_cb),
audio_codec_(kUnknownAudioCodec),
Expand Down
2 changes: 1 addition & 1 deletion media/base/android/video_decoder_job.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ VideoDecoderJob::VideoDecoderJob(
const base::Closure& request_data_cb,
const base::Closure& request_resources_cb,
const base::Closure& on_demuxer_config_changed_cb)
: MediaDecoderJob(g_video_decoder_thread.Pointer()->message_loop_proxy(),
: MediaDecoderJob(g_video_decoder_thread.Pointer()->task_runner(),
request_data_cb,
on_demuxer_config_changed_cb),
video_codec_(kUnknownVideoCodec),
Expand Down
2 changes: 1 addition & 1 deletion media/base/demuxer_perftest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ static void RunDemuxerBenchmark(const std::string& filename) {

Demuxer::EncryptedMediaInitDataCB encrypted_media_init_data_cb =
base::Bind(&OnEncryptedMediaInitData);
FFmpegDemuxer demuxer(message_loop.message_loop_proxy(), &data_source,
FFmpegDemuxer demuxer(message_loop.task_runner(), &data_source,
encrypted_media_init_data_cb, new MediaLog());

demuxer.Initialize(&demuxer_host,
Expand Down
2 changes: 1 addition & 1 deletion media/base/pipeline_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class PipelineTest : public ::testing::Test {
};

PipelineTest()
: pipeline_(new Pipeline(message_loop_.message_loop_proxy(),
: pipeline_(new Pipeline(message_loop_.task_runner(),
new MediaLog())),
demuxer_(new StrictMock<MockDemuxer>()),
scoped_renderer_(new StrictMock<MockRenderer>()),
Expand Down
4 changes: 2 additions & 2 deletions media/base/text_renderer_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class TextRendererTest : public testing::Test {
DCHECK(!text_renderer_);

text_renderer_.reset(
new TextRenderer(message_loop_.message_loop_proxy(),
new TextRenderer(message_loop_.task_runner(),
base::Bind(&TextRendererTest::OnAddTextTrack,
base::Unretained(this))));
text_renderer_->Initialize(base::Bind(&TextRendererTest::OnEnd,
Expand Down Expand Up @@ -214,7 +214,7 @@ class TextRendererTest : public testing::Test {

TEST_F(TextRendererTest, CreateTextRendererNoInit) {
text_renderer_.reset(
new TextRenderer(message_loop_.message_loop_proxy(),
new TextRenderer(message_loop_.task_runner(),
base::Bind(&TextRendererTest::OnAddTextTrack,
base::Unretained(this))));
text_renderer_.reset();
Expand Down
2 changes: 1 addition & 1 deletion media/base/user_input_monitor_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ TEST(UserInputMonitorTest, CreatePlatformSpecific) {

base::RunLoop run_loop;
scoped_ptr<UserInputMonitor> monitor = UserInputMonitor::Create(
message_loop.message_loop_proxy(), message_loop.message_loop_proxy());
message_loop.task_runner(), message_loop.task_runner());

if (!monitor)
return;
Expand Down
2 changes: 1 addition & 1 deletion media/blink/buffered_data_source_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ class BufferedDataSourceTest : public testing::Test {
GURL gurl(url);
data_source_.reset(
new MockBufferedDataSource(gurl,
message_loop_.message_loop_proxy(),
message_loop_.task_runner(),
view_->mainFrame()->toWebLocalFrame(),
&host_));
data_source_->SetPreload(preload_);
Expand Down
4 changes: 2 additions & 2 deletions media/cast/net/udp_transport_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,13 @@ TEST(UdpTransport, SendAndReceive) {
net::ParseIPLiteralToNumber("0.0.0.0", &empty_addr_number);

UdpTransport send_transport(NULL,
message_loop.message_loop_proxy(),
message_loop.task_runner(),
free_local_port1,
free_local_port2,
65536,
base::Bind(&UpdateCastTransportStatus));
UdpTransport recv_transport(NULL,
message_loop.message_loop_proxy(),
message_loop.task_runner(),
free_local_port2,
net::IPEndPoint(empty_addr_number, 0),
65536,
Expand Down
4 changes: 2 additions & 2 deletions media/cast/sender/h264_vt_encoder_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,8 @@ class H264VideoToolboxEncoderTest : public ::testing::Test {

cast_environment_ = new CastEnvironment(
scoped_ptr<base::TickClock>(clock_).Pass(),
message_loop_.message_loop_proxy(), message_loop_.message_loop_proxy(),
message_loop_.message_loop_proxy());
message_loop_.task_runner(), message_loop_.task_runner(),
message_loop_.task_runner());
encoder_.reset(new H264VideoToolboxEncoder(
cast_environment_, video_sender_config_,
base::Bind(&SaveOperationalStatus, &operational_status_)));
Expand Down
14 changes: 7 additions & 7 deletions media/cast/test/sender.cc
Original file line number Diff line number Diff line change
Expand Up @@ -244,13 +244,13 @@ int main(int argc, char** argv) {
scoped_refptr<media::cast::CastEnvironment> cast_environment(
new media::cast::CastEnvironment(
make_scoped_ptr<base::TickClock>(new base::DefaultTickClock()),
io_message_loop.message_loop_proxy(),
audio_thread.message_loop_proxy(),
video_thread.message_loop_proxy()));
io_message_loop.task_runner(),
audio_thread.task_runner(),
video_thread.task_runner()));

// SendProcess initialization.
scoped_ptr<media::cast::FakeMediaSource> fake_media_source(
new media::cast::FakeMediaSource(test_thread.message_loop_proxy(),
new media::cast::FakeMediaSource(test_thread.task_runner(),
cast_environment->Clock(),
audio_config,
video_config,
Expand Down Expand Up @@ -281,7 +281,7 @@ int main(int argc, char** argv) {
base::Bind(&LogRawEvents, cast_environment),
base::TimeDelta::FromSeconds(1),
media::cast::PacketReceiverCallback(),
io_message_loop.message_loop_proxy());
io_message_loop.task_runner());

// Set up event subscribers.
scoped_ptr<media::cast::EncodingEventSubscriber> video_event_subscriber;
Expand Down Expand Up @@ -329,7 +329,7 @@ int main(int argc, char** argv) {
}

const int logging_duration_seconds = 10;
io_message_loop.message_loop_proxy()->PostDelayedTask(
io_message_loop.task_runner()->PostDelayedTask(
FROM_HERE,
base::Bind(&WriteLogsToFileAndDestroySubscribers,
cast_environment,
Expand All @@ -339,7 +339,7 @@ int main(int argc, char** argv) {
base::Passed(&audio_log_file)),
base::TimeDelta::FromSeconds(logging_duration_seconds));

io_message_loop.message_loop_proxy()->PostDelayedTask(
io_message_loop.task_runner()->PostDelayedTask(
FROM_HERE,
base::Bind(&WriteStatsAndDestroySubscribers,
cast_environment,
Expand Down
2 changes: 1 addition & 1 deletion media/cast/test/utility/standalone_cast_environment.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ StandaloneCastEnvironment::StandaloneCastEnvironment()
video_thread_("StandaloneCastEnvironment Video") {
#define CREATE_TASK_RUNNER(name, options) \
name##_thread_.StartWithOptions(options); \
CastEnvironment::name##_thread_proxy_ = name##_thread_.message_loop_proxy()
CastEnvironment::name##_thread_proxy_ = name##_thread_.task_runner()

CREATE_TASK_RUNNER(main,
base::Thread::Options(base::MessageLoop::TYPE_IO, 0));
Expand Down
4 changes: 2 additions & 2 deletions media/cast/test/utility/udp_proxy.cc
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,7 @@ class UDPProxyImpl : public UDPProxy {
proxy_thread_.StartWithOptions(
base::Thread::Options(base::MessageLoop::TYPE_IO, 0));
base::WaitableEvent start_event(false, false);
proxy_thread_.message_loop_proxy()->PostTask(
proxy_thread_.task_runner()->PostTask(
FROM_HERE,
base::Bind(&UDPProxyImpl::Start,
base::Unretained(this),
Expand All @@ -693,7 +693,7 @@ class UDPProxyImpl : public UDPProxy {

~UDPProxyImpl() final {
base::WaitableEvent stop_event(false, false);
proxy_thread_.message_loop_proxy()->PostTask(
proxy_thread_.task_runner()->PostTask(
FROM_HERE,
base::Bind(&UDPProxyImpl::Stop,
base::Unretained(this),
Expand Down
2 changes: 1 addition & 1 deletion media/filters/audio_decoder_selector_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ class AudioDecoderSelectorTest : public ::testing::Test {
all_decoders_.begin() + num_decoders, all_decoders_.end());

decoder_selector_.reset(
new AudioDecoderSelector(message_loop_.message_loop_proxy(),
new AudioDecoderSelector(message_loop_.task_runner(),
all_decoders_.Pass(), new MediaLog()));
}

Expand Down
4 changes: 2 additions & 2 deletions media/filters/audio_decoder_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,11 @@ class AudioDecoderTest : public testing::TestWithParam<DecoderTestData> {
switch (GetParam().decoder_type) {
case FFMPEG:
decoder_.reset(new FFmpegAudioDecoder(
message_loop_.message_loop_proxy(), LogCB()));
message_loop_.task_runner(), LogCB()));
break;
case OPUS:
decoder_.reset(
new OpusAudioDecoder(message_loop_.message_loop_proxy()));
new OpusAudioDecoder(message_loop_.task_runner()));
break;
}
}
Expand Down
2 changes: 1 addition & 1 deletion media/filters/decrypting_audio_decoder_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class DecryptingAudioDecoderTest : public testing::Test {
public:
DecryptingAudioDecoderTest()
: decoder_(new DecryptingAudioDecoder(
message_loop_.message_loop_proxy(),
message_loop_.task_runner(),
new MediaLog(),
base::Bind(
&DecryptingAudioDecoderTest::RequestDecryptorNotification,
Expand Down
2 changes: 1 addition & 1 deletion media/filters/decrypting_demuxer_stream_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class DecryptingDemuxerStreamTest : public testing::Test {
public:
DecryptingDemuxerStreamTest()
: demuxer_stream_(new DecryptingDemuxerStream(
message_loop_.message_loop_proxy(),
message_loop_.task_runner(),
new MediaLog(),
base::Bind(
&DecryptingDemuxerStreamTest::RequestDecryptorNotification,
Expand Down
2 changes: 1 addition & 1 deletion media/filters/decrypting_video_decoder_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class DecryptingVideoDecoderTest : public testing::Test {
public:
DecryptingVideoDecoderTest()
: decoder_(new DecryptingVideoDecoder(
message_loop_.message_loop_proxy(),
message_loop_.task_runner(),
new MediaLog(),
base::Bind(
&DecryptingVideoDecoderTest::RequestDecryptorNotification,
Expand Down
8 changes: 4 additions & 4 deletions media/filters/ffmpeg_demuxer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,7 @@ void FFmpegDemuxer::Seek(base::TimeDelta time, const PipelineStatusCB& cb) {

pending_seek_ = true;
base::PostTaskAndReplyWithResult(
blocking_thread_.message_loop_proxy().get(),
blocking_thread_.task_runner().get(),
FROM_HERE,
base::Bind(&av_seek_frame,
glue_->format_context(),
Expand Down Expand Up @@ -696,7 +696,7 @@ void FFmpegDemuxer::Initialize(DemuxerHost* host,
// Open the AVFormatContext using our glue layer.
CHECK(blocking_thread_.Start());
base::PostTaskAndReplyWithResult(
blocking_thread_.message_loop_proxy().get(),
blocking_thread_.task_runner().get(),
FROM_HERE,
base::Bind(&FFmpegGlue::OpenContext, base::Unretained(glue_.get())),
base::Bind(&FFmpegDemuxer::OnOpenContextDone,
Expand Down Expand Up @@ -800,7 +800,7 @@ void FFmpegDemuxer::OnOpenContextDone(const PipelineStatusCB& status_cb,

// Fully initialize AVFormatContext by parsing the stream a little.
base::PostTaskAndReplyWithResult(
blocking_thread_.message_loop_proxy().get(),
blocking_thread_.task_runner().get(),
FROM_HERE,
base::Bind(&avformat_find_stream_info,
glue_->format_context(),
Expand Down Expand Up @@ -1137,7 +1137,7 @@ void FFmpegDemuxer::ReadFrameIfNeeded() {

pending_read_ = true;
base::PostTaskAndReplyWithResult(
blocking_thread_.message_loop_proxy().get(),
blocking_thread_.task_runner().get(),
FROM_HERE,
base::Bind(&av_read_frame, glue_->format_context(), packet_ptr),
base::Bind(&FFmpegDemuxer::OnReadFrameDone,
Expand Down
Loading

0 comments on commit 6f5f140

Please sign in to comment.