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

Unified Diff: content/renderer/pepper_plugin_delegate_impl.cc

Issue 7157001: Implements AudioMessageFilter as member in RenderThread (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Fixed nits in AudioRenderImpl unit test Created 9 years, 5 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 | « content/renderer/media/audio_renderer_impl_unittest.cc ('k') | content/renderer/render_thread.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/pepper_plugin_delegate_impl.cc
===================================================================
--- content/renderer/pepper_plugin_delegate_impl.cc (revision 92113)
+++ content/renderer/pepper_plugin_delegate_impl.cc (working copy)
@@ -17,6 +17,7 @@
#include "base/task.h"
#include "base/time.h"
#include "content/common/child_process_messages.h"
+#include "content/common/child_process.h"
#include "content/common/child_thread.h"
#include "content/common/content_switches.h"
#include "content/common/file_system/file_system_dispatcher.h"
@@ -159,10 +160,10 @@
public AudioMessageFilter::Delegate,
public base::RefCountedThreadSafe<PlatformAudioImpl> {
public:
- explicit PlatformAudioImpl(scoped_refptr<AudioMessageFilter> filter)
- : client_(NULL), filter_(filter), stream_id_(0),
+ PlatformAudioImpl()
+ : client_(NULL), stream_id_(0),
main_message_loop_(MessageLoop::current()) {
- DCHECK(filter_);
+ filter_ = RenderThread::current()->audio_message_filter();
}
virtual ~PlatformAudioImpl() {
@@ -239,7 +240,8 @@
params.bits_per_sample = 16;
params.samples_per_packet = sample_count;
- filter_->message_loop()->PostTask(FROM_HERE,
+ ChildProcess::current()->io_message_loop()->PostTask(
+ FROM_HERE,
NewRunnableMethod(this, &PlatformAudioImpl::InitializeOnIOThread,
params));
return true;
@@ -247,7 +249,8 @@
bool PlatformAudioImpl::StartPlayback() {
if (filter_) {
- filter_->message_loop()->PostTask(FROM_HERE,
+ ChildProcess::current()->io_message_loop()->PostTask(
+ FROM_HERE,
NewRunnableMethod(this, &PlatformAudioImpl::StartPlaybackOnIOThread));
return true;
}
@@ -256,7 +259,8 @@
bool PlatformAudioImpl::StopPlayback() {
if (filter_) {
- filter_->message_loop()->PostTask(FROM_HERE,
+ ChildProcess::current()->io_message_loop()->PostTask(
+ FROM_HERE,
NewRunnableMethod(this, &PlatformAudioImpl::StopPlaybackOnIOThread));
return true;
}
@@ -267,23 +271,24 @@
// 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;
- filter_->message_loop()->PostTask(FROM_HERE,
+ ChildProcess::current()->io_message_loop()->PostTask(
+ FROM_HERE,
NewRunnableMethod(this, &PlatformAudioImpl::ShutDownOnIOThread));
}
void PlatformAudioImpl::InitializeOnIOThread(const AudioParameters& params) {
stream_id_ = filter_->AddDelegate(this);
- filter_->Send(new AudioHostMsg_CreateStream(0, stream_id_, params, true));
+ filter_->Send(new AudioHostMsg_CreateStream(stream_id_, params, true));
}
void PlatformAudioImpl::StartPlaybackOnIOThread() {
if (stream_id_)
- filter_->Send(new AudioHostMsg_PlayStream(0, stream_id_));
+ filter_->Send(new AudioHostMsg_PlayStream(stream_id_));
}
void PlatformAudioImpl::StopPlaybackOnIOThread() {
if (stream_id_)
- filter_->Send(new AudioHostMsg_PauseStream(0, stream_id_));
+ filter_->Send(new AudioHostMsg_PauseStream(stream_id_));
}
void PlatformAudioImpl::ShutDownOnIOThread() {
@@ -291,7 +296,7 @@
if (!stream_id_)
return;
- filter_->Send(new AudioHostMsg_CloseStream(0, stream_id_));
+ filter_->Send(new AudioHostMsg_CloseStream(stream_id_));
filter_->RemoveDelegate(stream_id_);
stream_id_ = 0;
@@ -851,8 +856,7 @@
PepperPluginDelegateImpl::CreateAudio(
uint32_t sample_rate, uint32_t sample_count,
webkit::ppapi::PluginDelegate::PlatformAudio::Client* client) {
- scoped_refptr<PlatformAudioImpl> audio(
- new PlatformAudioImpl(render_view_->audio_message_filter()));
+ scoped_refptr<PlatformAudioImpl> audio(new PlatformAudioImpl());
if (audio->Initialize(sample_rate, sample_count, client)) {
// Balanced by Release invoked in PlatformAudioImpl::ShutDownOnIOThread().
return audio.release();
@@ -991,9 +995,9 @@
return file_system_dispatcher->ReadDirectory(directory_path, dispatcher);
}
-class AsyncOpenFileSystemURLCallbackTranslator :
- public fileapi::FileSystemCallbackDispatcher {
-public:
+class AsyncOpenFileSystemURLCallbackTranslator
+ : public fileapi::FileSystemCallbackDispatcher {
+ public:
AsyncOpenFileSystemURLCallbackTranslator(
webkit::ppapi::PluginDelegate::AsyncOpenFileCallback* callback)
: callback_(callback) {
« no previous file with comments | « content/renderer/media/audio_renderer_impl_unittest.cc ('k') | content/renderer/render_thread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698