| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ppapi/proxy/ppb_audio_config_proxy.h" | 5 #include "ppapi/proxy/ppb_audio_config_proxy.h" |
| 6 | 6 |
| 7 #include "ppapi/c/ppb_audio_config.h" | 7 #include "ppapi/c/ppb_audio_config.h" |
| 8 #include "ppapi/proxy/plugin_dispatcher.h" | 8 #include "ppapi/proxy/plugin_dispatcher.h" |
| 9 #include "ppapi/proxy/plugin_resource.h" | |
| 10 #include "ppapi/proxy/ppapi_messages.h" | 9 #include "ppapi/proxy/ppapi_messages.h" |
| 11 #include "ppapi/shared_impl/audio_config_impl.h" | 10 #include "ppapi/shared_impl/audio_config_impl.h" |
| 12 #include "ppapi/thunk/thunk.h" | 11 #include "ppapi/thunk/thunk.h" |
| 13 | 12 |
| 14 using ppapi::HostResource; | 13 using ppapi::HostResource; |
| 14 using ppapi::Resource; |
| 15 | 15 |
| 16 namespace pp { | 16 namespace pp { |
| 17 namespace proxy { | 17 namespace proxy { |
| 18 | 18 |
| 19 // The implementation is actually in AudioConfigImpl. | 19 // The implementation is actually in AudioConfigImpl. |
| 20 class AudioConfig : public PluginResource, | 20 class AudioConfig : public Resource, public ppapi::AudioConfigImpl { |
| 21 public ppapi::AudioConfigImpl { | |
| 22 public: | 21 public: |
| 23 // Note that you must call Init (on AudioConfigImpl) before using this class. | 22 // Note that you must call Init (on AudioConfigImpl) before using this class. |
| 24 AudioConfig(const HostResource& resource); | 23 AudioConfig(const HostResource& resource); |
| 25 virtual ~AudioConfig(); | 24 virtual ~AudioConfig(); |
| 26 | 25 |
| 27 // ResourceObjectBase overrides. | 26 // Resource overrides. |
| 28 virtual ::ppapi::thunk::PPB_AudioConfig_API* AsPPB_AudioConfig_API() OVERRIDE; | 27 virtual ::ppapi::thunk::PPB_AudioConfig_API* AsPPB_AudioConfig_API() OVERRIDE; |
| 29 | 28 |
| 30 private: | 29 private: |
| 31 DISALLOW_COPY_AND_ASSIGN(AudioConfig); | 30 DISALLOW_COPY_AND_ASSIGN(AudioConfig); |
| 32 }; | 31 }; |
| 33 | 32 |
| 34 AudioConfig::AudioConfig(const HostResource& resource) | 33 AudioConfig::AudioConfig(const HostResource& resource) : Resource(resource) { |
| 35 : PluginResource(resource) { | |
| 36 } | 34 } |
| 37 | 35 |
| 38 AudioConfig::~AudioConfig() { | 36 AudioConfig::~AudioConfig() { |
| 39 } | 37 } |
| 40 | 38 |
| 41 ::ppapi::thunk::PPB_AudioConfig_API* AudioConfig::AsPPB_AudioConfig_API() { | 39 ::ppapi::thunk::PPB_AudioConfig_API* AudioConfig::AsPPB_AudioConfig_API() { |
| 42 return this; | 40 return this; |
| 43 } | 41 } |
| 44 | 42 |
| 45 namespace { | 43 namespace { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 73 | 71 |
| 74 // static | 72 // static |
| 75 PP_Resource PPB_AudioConfig_Proxy::CreateProxyResource( | 73 PP_Resource PPB_AudioConfig_Proxy::CreateProxyResource( |
| 76 PP_Instance instance, | 74 PP_Instance instance, |
| 77 PP_AudioSampleRate sample_rate, | 75 PP_AudioSampleRate sample_rate, |
| 78 uint32_t sample_frame_count) { | 76 uint32_t sample_frame_count) { |
| 79 scoped_refptr<AudioConfig> object(new AudioConfig( | 77 scoped_refptr<AudioConfig> object(new AudioConfig( |
| 80 HostResource::MakeInstanceOnly(instance))); | 78 HostResource::MakeInstanceOnly(instance))); |
| 81 if (!object->Init(sample_rate, sample_frame_count)) | 79 if (!object->Init(sample_rate, sample_frame_count)) |
| 82 return 0; | 80 return 0; |
| 83 return PluginResourceTracker::GetInstance()->AddResource(object); | 81 return object->GetReference(); |
| 84 } | 82 } |
| 85 | 83 |
| 86 bool PPB_AudioConfig_Proxy::OnMessageReceived(const IPC::Message& msg) { | 84 bool PPB_AudioConfig_Proxy::OnMessageReceived(const IPC::Message& msg) { |
| 87 // There are no IPC messages for this interface. | 85 // There are no IPC messages for this interface. |
| 88 NOTREACHED(); | 86 NOTREACHED(); |
| 89 return false; | 87 return false; |
| 90 } | 88 } |
| 91 | 89 |
| 92 } // namespace proxy | 90 } // namespace proxy |
| 93 } // namespace pp | 91 } // namespace pp |
| OLD | NEW |