diff options
Diffstat (limited to 'content/renderer/pepper')
9 files changed, 49 insertions, 52 deletions
diff --git a/content/renderer/pepper/pepper_hung_plugin_filter.cc b/content/renderer/pepper/pepper_hung_plugin_filter.cc index 942dd6e..b43606c 100644 --- a/content/renderer/pepper/pepper_hung_plugin_filter.cc +++ b/content/renderer/pepper/pepper_hung_plugin_filter.cc @@ -32,10 +32,11 @@ PepperHungPluginFilter::PepperHungPluginFilter( frame_routing_id_(frame_routing_id), plugin_child_id_(plugin_child_id), filter_(RenderThread::Get()->GetSyncMessageFilter()), - io_loop_(ChildProcess::current()->io_message_loop_proxy()), + io_task_runner_(ChildProcess::current()->io_task_runner()), pending_sync_message_count_(0), hung_plugin_showing_(false), - timer_task_pending_(false) {} + timer_task_pending_(false) { +} void PepperHungPluginFilter::BeginBlockOnSyncMessage() { base::AutoLock lock(lock_); @@ -83,9 +84,8 @@ void PepperHungPluginFilter::EnsureTimerScheduled() { return; timer_task_pending_ = true; - io_loop_->PostDelayedTask( - FROM_HERE, - base::Bind(&PepperHungPluginFilter::OnHangTimer, this), + io_task_runner_->PostDelayedTask( + FROM_HERE, base::Bind(&PepperHungPluginFilter::OnHangTimer, this), base::TimeDelta::FromSeconds(kHungThresholdSec)); } @@ -140,9 +140,8 @@ void PepperHungPluginFilter::OnHangTimer() { // would not have scheduled one (we only have one out-standing timer at // a time). timer_task_pending_ = true; - io_loop_->PostDelayedTask( - FROM_HERE, - base::Bind(&PepperHungPluginFilter::OnHangTimer, this), + io_task_runner_->PostDelayedTask( + FROM_HERE, base::Bind(&PepperHungPluginFilter::OnHangTimer, this), delay); return; } diff --git a/content/renderer/pepper/pepper_hung_plugin_filter.h b/content/renderer/pepper/pepper_hung_plugin_filter.h index 286fdfa..9da4f5a 100644 --- a/content/renderer/pepper/pepper_hung_plugin_filter.h +++ b/content/renderer/pepper/pepper_hung_plugin_filter.h @@ -84,7 +84,7 @@ class PepperHungPluginFilter // We don't actually use the "sync" feature of this filter. scoped_refptr<IPC::SyncMessageFilter> filter_; - scoped_refptr<base::MessageLoopProxy> io_loop_; + scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; // The time when we start being blocked on a sync message. If there are // nested ones, this is the time of the outermost one. diff --git a/content/renderer/pepper/pepper_media_stream_video_track_host.cc b/content/renderer/pepper/pepper_media_stream_video_track_host.cc index 14c6731..779ab10 100644 --- a/content/renderer/pepper/pepper_media_stream_video_track_host.cc +++ b/content/renderer/pepper/pepper_media_stream_video_track_host.cc @@ -182,9 +182,8 @@ namespace content { class PepperMediaStreamVideoTrackHost::FrameDeliverer : public base::RefCountedThreadSafe<FrameDeliverer> { public: - FrameDeliverer( - const scoped_refptr<base::MessageLoopProxy>& io_message_loop_proxy, - const VideoCaptureDeliverFrameCB& new_frame_callback); + FrameDeliverer(scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, + const VideoCaptureDeliverFrameCB& new_frame_callback); void DeliverVideoFrame(const scoped_refptr<media::VideoFrame>& frame); @@ -194,17 +193,16 @@ class PepperMediaStreamVideoTrackHost::FrameDeliverer void DeliverFrameOnIO(const scoped_refptr<media::VideoFrame>& frame); - scoped_refptr<base::MessageLoopProxy> io_message_loop_; + scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; VideoCaptureDeliverFrameCB new_frame_callback_; DISALLOW_COPY_AND_ASSIGN(FrameDeliverer); }; PepperMediaStreamVideoTrackHost::FrameDeliverer::FrameDeliverer( - const scoped_refptr<base::MessageLoopProxy>& io_message_loop_proxy, + scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, const VideoCaptureDeliverFrameCB& new_frame_callback) - : io_message_loop_(io_message_loop_proxy), - new_frame_callback_(new_frame_callback) { + : io_task_runner_(io_task_runner), new_frame_callback_(new_frame_callback) { } PepperMediaStreamVideoTrackHost::FrameDeliverer::~FrameDeliverer() { @@ -212,14 +210,13 @@ PepperMediaStreamVideoTrackHost::FrameDeliverer::~FrameDeliverer() { void PepperMediaStreamVideoTrackHost::FrameDeliverer::DeliverVideoFrame( const scoped_refptr<media::VideoFrame>& frame) { - io_message_loop_->PostTask( - FROM_HERE, - base::Bind(&FrameDeliverer::DeliverFrameOnIO, this, frame)); + io_task_runner_->PostTask( + FROM_HERE, base::Bind(&FrameDeliverer::DeliverFrameOnIO, this, frame)); } void PepperMediaStreamVideoTrackHost::FrameDeliverer::DeliverFrameOnIO( const scoped_refptr<media::VideoFrame>& frame) { - DCHECK(io_message_loop_->BelongsToCurrentThread()); + DCHECK(io_task_runner_->BelongsToCurrentThread()); // The time when this frame is generated is unknown so give a null value to // |estimated_capture_time|. new_frame_callback_.Run(frame, base::TimeTicks()); @@ -436,7 +433,7 @@ void PepperMediaStreamVideoTrackHost::StartSourceImpl( const blink::WebMediaConstraints& constraints, const VideoCaptureDeliverFrameCB& frame_callback) { output_started_ = true; - frame_deliverer_ = new FrameDeliverer(io_message_loop(), frame_callback); + frame_deliverer_ = new FrameDeliverer(io_task_runner(), frame_callback); } void PepperMediaStreamVideoTrackHost::StopSourceImpl() { diff --git a/content/renderer/pepper/pepper_platform_audio_input.cc b/content/renderer/pepper/pepper_platform_audio_input.cc index 04c14a7..28919df 100644 --- a/content/renderer/pepper/pepper_platform_audio_input.cc +++ b/content/renderer/pepper/pepper_platform_audio_input.cc @@ -48,7 +48,7 @@ PepperPlatformAudioInput* PepperPlatformAudioInput::Create( void PepperPlatformAudioInput::StartCapture() { DCHECK(main_message_loop_proxy_->BelongsToCurrentThread()); - io_message_loop_proxy_->PostTask( + io_task_runner_->PostTask( FROM_HERE, base::Bind(&PepperPlatformAudioInput::StartCaptureOnIOThread, this)); } @@ -56,7 +56,7 @@ void PepperPlatformAudioInput::StartCapture() { void PepperPlatformAudioInput::StopCapture() { DCHECK(main_message_loop_proxy_->BelongsToCurrentThread()); - io_message_loop_proxy_->PostTask( + io_task_runner_->PostTask( FROM_HERE, base::Bind(&PepperPlatformAudioInput::StopCaptureOnIOThread, this)); } @@ -71,7 +71,7 @@ void PepperPlatformAudioInput::ShutDown() { // Called on the main thread to stop all audio callbacks. We must only change // the client on the main thread, and the delegates from the I/O thread. client_ = NULL; - io_message_loop_proxy_->PostTask( + io_task_runner_->PostTask( FROM_HERE, base::Bind(&PepperPlatformAudioInput::ShutDownOnIOThread, this)); } @@ -139,11 +139,12 @@ PepperPlatformAudioInput::~PepperPlatformAudioInput() { PepperPlatformAudioInput::PepperPlatformAudioInput() : client_(NULL), main_message_loop_proxy_(base::MessageLoopProxy::current()), - io_message_loop_proxy_(ChildProcess::current()->io_message_loop_proxy()), + io_task_runner_(ChildProcess::current()->io_task_runner()), render_frame_id_(MSG_ROUTING_NONE), create_stream_sent_(false), pending_open_device_(false), - pending_open_device_id_(-1) {} + pending_open_device_id_(-1) { +} bool PepperPlatformAudioInput::Initialize( int render_frame_id, @@ -189,7 +190,7 @@ bool PepperPlatformAudioInput::Initialize( } void PepperPlatformAudioInput::InitializeOnIOThread(int session_id) { - DCHECK(io_message_loop_proxy_->BelongsToCurrentThread()); + DCHECK(io_task_runner_->BelongsToCurrentThread()); if (!ipc_) return; @@ -200,14 +201,14 @@ void PepperPlatformAudioInput::InitializeOnIOThread(int session_id) { } void PepperPlatformAudioInput::StartCaptureOnIOThread() { - DCHECK(io_message_loop_proxy_->BelongsToCurrentThread()); + DCHECK(io_task_runner_->BelongsToCurrentThread()); if (ipc_) ipc_->RecordStream(); } void PepperPlatformAudioInput::StopCaptureOnIOThread() { - DCHECK(io_message_loop_proxy_->BelongsToCurrentThread()); + DCHECK(io_task_runner_->BelongsToCurrentThread()); // TODO(yzshen): We cannot re-start capturing if the stream is closed. if (ipc_ && create_stream_sent_) { @@ -217,7 +218,7 @@ void PepperPlatformAudioInput::StopCaptureOnIOThread() { } void PepperPlatformAudioInput::ShutDownOnIOThread() { - DCHECK(io_message_loop_proxy_->BelongsToCurrentThread()); + DCHECK(io_task_runner_->BelongsToCurrentThread()); StopCaptureOnIOThread(); @@ -244,11 +245,9 @@ void PepperPlatformAudioInput::OnDeviceOpened(int request_id, if (client_) { int session_id = device_manager->GetSessionID( PP_DEVICETYPE_DEV_AUDIOCAPTURE, label); - io_message_loop_proxy_->PostTask( - FROM_HERE, - base::Bind(&PepperPlatformAudioInput::InitializeOnIOThread, - this, - session_id)); + io_task_runner_->PostTask( + FROM_HERE, base::Bind(&PepperPlatformAudioInput::InitializeOnIOThread, + this, session_id)); } else { // Shutdown has occurred. CloseDevice(); diff --git a/content/renderer/pepper/pepper_platform_audio_input.h b/content/renderer/pepper/pepper_platform_audio_input.h index a567ed4..ae5a610 100644 --- a/content/renderer/pepper/pepper_platform_audio_input.h +++ b/content/renderer/pepper/pepper_platform_audio_input.h @@ -18,6 +18,7 @@ class GURL; namespace base { +class SingleThreadTaskRunner; class MessageLoopProxy; } @@ -104,7 +105,7 @@ class PepperPlatformAudioInput scoped_ptr<media::AudioInputIPC> ipc_; scoped_refptr<base::MessageLoopProxy> main_message_loop_proxy_; - scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_; + scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; // The frame containing the Pepper widget. int render_frame_id_; diff --git a/content/renderer/pepper/pepper_platform_audio_output.cc b/content/renderer/pepper/pepper_platform_audio_output.cc index ce18f86..e0a990a 100644 --- a/content/renderer/pepper/pepper_platform_audio_output.cc +++ b/content/renderer/pepper/pepper_platform_audio_output.cc @@ -40,7 +40,7 @@ PepperPlatformAudioOutput* PepperPlatformAudioOutput::Create( bool PepperPlatformAudioOutput::StartPlayback() { if (ipc_) { - io_message_loop_proxy_->PostTask( + io_task_runner_->PostTask( FROM_HERE, base::Bind(&PepperPlatformAudioOutput::StartPlaybackOnIOThread, this)); return true; @@ -50,7 +50,7 @@ bool PepperPlatformAudioOutput::StartPlayback() { bool PepperPlatformAudioOutput::StopPlayback() { if (ipc_) { - io_message_loop_proxy_->PostTask( + io_task_runner_->PostTask( FROM_HERE, base::Bind(&PepperPlatformAudioOutput::StopPlaybackOnIOThread, this)); return true; @@ -62,7 +62,7 @@ void PepperPlatformAudioOutput::ShutDown() { // Called on the main thread to stop all audio callbacks. We must only change // the client on the main thread, and the delegates from the I/O thread. client_ = NULL; - io_message_loop_proxy_->PostTask( + io_task_runner_->PostTask( FROM_HERE, base::Bind(&PepperPlatformAudioOutput::ShutDownOnIOThread, this)); } @@ -112,7 +112,7 @@ PepperPlatformAudioOutput::~PepperPlatformAudioOutput() { PepperPlatformAudioOutput::PepperPlatformAudioOutput() : client_(NULL), main_message_loop_proxy_(base::MessageLoopProxy::current()), - io_message_loop_proxy_(ChildProcess::current()->io_message_loop_proxy()) { + io_task_runner_(ChildProcess::current()->io_task_runner()) { } bool PepperPlatformAudioOutput::Initialize(int sample_rate, @@ -133,35 +133,34 @@ bool PepperPlatformAudioOutput::Initialize(int sample_rate, ppapi::kBitsPerAudioOutputSample, frames_per_buffer); - io_message_loop_proxy_->PostTask( - FROM_HERE, - base::Bind( - &PepperPlatformAudioOutput::InitializeOnIOThread, this, params)); + io_task_runner_->PostTask( + FROM_HERE, base::Bind(&PepperPlatformAudioOutput::InitializeOnIOThread, + this, params)); return true; } void PepperPlatformAudioOutput::InitializeOnIOThread( const media::AudioParameters& params) { - DCHECK(io_message_loop_proxy_->BelongsToCurrentThread()); + DCHECK(io_task_runner_->BelongsToCurrentThread()); const int kSessionId = 0; if (ipc_) ipc_->CreateStream(this, params, kSessionId); } void PepperPlatformAudioOutput::StartPlaybackOnIOThread() { - DCHECK(io_message_loop_proxy_->BelongsToCurrentThread()); + DCHECK(io_task_runner_->BelongsToCurrentThread()); if (ipc_) ipc_->PlayStream(); } void PepperPlatformAudioOutput::StopPlaybackOnIOThread() { - DCHECK(io_message_loop_proxy_->BelongsToCurrentThread()); + DCHECK(io_task_runner_->BelongsToCurrentThread()); if (ipc_) ipc_->PauseStream(); } void PepperPlatformAudioOutput::ShutDownOnIOThread() { - DCHECK(io_message_loop_proxy_->BelongsToCurrentThread()); + DCHECK(io_task_runner_->BelongsToCurrentThread()); // Make sure we don't call shutdown more than once. if (!ipc_) diff --git a/content/renderer/pepper/pepper_platform_audio_output.h b/content/renderer/pepper/pepper_platform_audio_output.h index c0f455b..91b922b 100644 --- a/content/renderer/pepper/pepper_platform_audio_output.h +++ b/content/renderer/pepper/pepper_platform_audio_output.h @@ -16,6 +16,7 @@ class AudioParameters; namespace base { class MessageLoopProxy; +class SingleThreadTaskRunner; } namespace content { @@ -81,7 +82,7 @@ class PepperPlatformAudioOutput scoped_ptr<media::AudioOutputIPC> ipc_; scoped_refptr<base::MessageLoopProxy> main_message_loop_proxy_; - scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_; + scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; DISALLOW_COPY_AND_ASSIGN(PepperPlatformAudioOutput); }; diff --git a/content/renderer/pepper/pepper_proxy_channel_delegate_impl.cc b/content/renderer/pepper/pepper_proxy_channel_delegate_impl.cc index f48e732..3cada30 100644 --- a/content/renderer/pepper/pepper_proxy_channel_delegate_impl.cc +++ b/content/renderer/pepper/pepper_proxy_channel_delegate_impl.cc @@ -11,10 +11,11 @@ namespace content { PepperProxyChannelDelegateImpl::~PepperProxyChannelDelegateImpl() {} -base::MessageLoopProxy* PepperProxyChannelDelegateImpl::GetIPCMessageLoop() { +base::SingleThreadTaskRunner* +PepperProxyChannelDelegateImpl::GetIPCTaskRunner() { // This is called only in the renderer so we know we have a child process. DCHECK(ChildProcess::current()) << "Must be in the renderer."; - return ChildProcess::current()->io_message_loop_proxy(); + return ChildProcess::current()->io_task_runner(); } base::WaitableEvent* PepperProxyChannelDelegateImpl::GetShutdownEvent() { diff --git a/content/renderer/pepper/pepper_proxy_channel_delegate_impl.h b/content/renderer/pepper/pepper_proxy_channel_delegate_impl.h index e6b9cd5..b017be1 100644 --- a/content/renderer/pepper/pepper_proxy_channel_delegate_impl.h +++ b/content/renderer/pepper/pepper_proxy_channel_delegate_impl.h @@ -16,7 +16,7 @@ class PepperProxyChannelDelegateImpl ~PepperProxyChannelDelegateImpl() override; // ProxyChannel::Delegate implementation. - base::MessageLoopProxy* GetIPCMessageLoop() override; + base::SingleThreadTaskRunner* GetIPCTaskRunner() override; base::WaitableEvent* GetShutdownEvent() override; IPC::PlatformFileForTransit ShareHandleWithRemote( base::PlatformFile handle, |