Index: content/renderer/pepper_plugin_delegate_impl.cc |
=================================================================== |
--- content/renderer/pepper_plugin_delegate_impl.cc (revision 89645) |
+++ content/renderer/pepper_plugin_delegate_impl.cc (working copy) |
@@ -159,10 +159,20 @@ |
public AudioMessageFilter::Delegate, |
public base::RefCountedThreadSafe<PlatformAudioImpl> { |
public: |
- explicit PlatformAudioImpl(scoped_refptr<AudioMessageFilter> filter) |
+ enum RoutingID { |
+ DEFAULT_ROUTING_ID = 2, |
+ }; |
+ |
+ explicit PlatformAudioImpl(AudioMessageFilter* filter) |
: client_(NULL), filter_(filter), stream_id_(0), |
main_message_loop_(MessageLoop::current()) { |
DCHECK(filter_); |
+ if (!filter_->RoutingIDHasBeenSet()) { |
+ // Ensure that first user sets a valid routing ID. |
+ // This routing ID will remain during the lifetime of the audio message |
+ // filter (which is a singleton). |
+ filter_->SetRoutingID(DEFAULT_ROUTING_ID); |
jam
2011/06/21 19:02:04
you can't just pick a routing a id in the renderer
|
+ } |
} |
virtual ~PlatformAudioImpl() { |
@@ -211,7 +221,8 @@ |
// MessageFilter used to send/receive IPC. THIS MUST ONLY BE ACCESSED ON THE |
// I/O thread except to send messages and get the message loop. |
- scoped_refptr<AudioMessageFilter> filter_; |
+ // Cached result of Singleton<AudioMessageFilter>::get() to reduce overhead. |
+ AudioMessageFilter* filter_; |
// Our ID on the MessageFilter. THIS MUST ONLY BE ACCESSED ON THE I/O THREAD |
// or else you could race with the initialize function which sets it. |
@@ -850,7 +861,7 @@ |
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())); |
+ new PlatformAudioImpl(AudioMessageFilter::GetInstance())); |
scherkus (not reviewing)
2011/06/21 17:24:00
since you have render_view object, why not use its
|
if (audio->Initialize(sample_rate, sample_count, client)) { |
// Balanced by Release invoked in PlatformAudioImpl::ShutDownOnIOThread(). |
return audio.release(); |
@@ -989,9 +1000,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) { |