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

Unified Diff: chrome/renderer/pepper_plugin_delegate_impl.cc

Issue 5202002: changes for proxy audio (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 1 month 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 | « no previous file | ppapi/c/dev/ppb_audio_trusted_dev.h » ('j') | ppapi/c/dev/ppb_audio_trusted_dev.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/pepper_plugin_delegate_impl.cc
===================================================================
--- chrome/renderer/pepper_plugin_delegate_impl.cc (revision 67163)
+++ chrome/renderer/pepper_plugin_delegate_impl.cc (working copy)
@@ -123,10 +123,12 @@
class PlatformAudioImpl
: public pepper::PluginDelegate::PlatformAudio,
- public AudioMessageFilter::Delegate {
+ public AudioMessageFilter::Delegate,
+ public base::RefCountedThreadSafe<PlatformAudioImpl> {
public:
explicit PlatformAudioImpl(scoped_refptr<AudioMessageFilter> filter)
- : client_(NULL), filter_(filter), stream_id_(0) {
+ : client_(NULL), filter_(filter), stream_id_(0),
+ main_message_loop_(MessageLoop::current()) {
DCHECK(filter_);
}
@@ -177,6 +179,8 @@
// Our ID on the MessageFilter.
int32 stream_id_;
+ MessageLoop* main_message_loop_;
+
DISALLOW_COPY_AND_ASSIGN(PlatformAudioImpl);
};
@@ -297,7 +301,15 @@
#endif
DCHECK(length);
- client_->StreamCreated(handle, length, socket_handle);
+ if (MessageLoop::current() == main_message_loop_) {
+ if (client_) {
+ client_->StreamCreated(handle, length, socket_handle);
+ }
+ } else {
+ main_message_loop_->PostTask(FROM_HERE,
+ NewRunnableMethod(this, &PlatformAudioImpl::OnLowLatencyCreated,
+ handle, socket_handle, length));
+ }
}
void PlatformAudioImpl::ShutDown() {
@@ -309,6 +321,9 @@
filter_->RemoveDelegate(stream_id_);
stream_id_ = 0;
client_ = NULL;
+ // Release on the IO thread so that we avoid race problems with
darin (slow to review) 2010/11/24 20:34:35 As Brett commented on the other file, please put a
nfullagar 2010/11/24 23:01:05 Done.
+ // OnLowLatencyCreated.
+ filter_->message_loop()->ReleaseSoon(FROM_HERE, this);
}
// Implements the VideoDecoder.
@@ -560,7 +575,7 @@
pepper::PluginDelegate::PlatformAudio* PepperPluginDelegateImpl::CreateAudio(
uint32_t sample_rate, uint32_t sample_count,
pepper::PluginDelegate::PlatformAudio::Client* client) {
- scoped_ptr<PlatformAudioImpl> audio(
+ scoped_refptr<PlatformAudioImpl> audio(
new PlatformAudioImpl(render_view_->audio_message_filter()));
if (audio->Initialize(sample_rate, sample_count, client)) {
return audio.release();
darin (slow to review) 2010/11/24 20:34:35 I recommend inserting a comment here indicating th
nfullagar 2010/11/24 23:01:05 Done.
« no previous file with comments | « no previous file | ppapi/c/dev/ppb_audio_trusted_dev.h » ('j') | ppapi/c/dev/ppb_audio_trusted_dev.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698