Chromium Code Reviews| 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 #ifndef PPAPI_SHARED_IMPL_AUDIO_CONFIG_IMPL_H_ | 5 #ifndef PPAPI_SHARED_IMPL_AUDIO_CONFIG_IMPL_H_ |
| 6 #define PPAPI_SHARED_IMPL_AUDIO_CONFIG_IMPL_H_ | 6 #define PPAPI_SHARED_IMPL_AUDIO_CONFIG_IMPL_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "ppapi/shared_impl/resource.h" | 10 #include "ppapi/shared_impl/resource.h" |
| 11 #include "ppapi/thunk/ppb_audio_config_api.h" | 11 #include "ppapi/thunk/ppb_audio_config_api.h" |
| 12 | 12 |
| 13 namespace ppapi { | 13 namespace ppapi { |
| 14 | 14 |
| 15 class AudioConfigImpl : public thunk::PPB_AudioConfig_API { | 15 class AudioConfigImpl : public Resource, |
| 16 public thunk::PPB_AudioConfig_API { | |
| 16 public: | 17 public: |
| 17 // You must call Init before using this object. | |
| 18 AudioConfigImpl(); | |
| 19 virtual ~AudioConfigImpl(); | 18 virtual ~AudioConfigImpl(); |
| 20 | 19 |
| 21 // Returns false if the arguments are invalid, the object should not be | 20 static PP_Resource CreateAsImpl(PP_Instance instance, |
| 22 // used in this case. | 21 PP_AudioSampleRate sample_rate, |
| 23 bool Init(PP_AudioSampleRate sample_rate, uint32_t sample_frame_count); | 22 uint32_t sample_frame_count); |
| 23 static PP_Resource CreateAsProxy(PP_Instance instance, | |
| 24 PP_AudioSampleRate sample_rate, | |
| 25 uint32_t sample_frame_count); | |
| 26 | |
| 27 // Resource overrides. | |
| 28 virtual thunk::PPB_AudioConfig_API* AsPPB_AudioConfig_API() OVERRIDE; | |
| 24 | 29 |
| 25 // PPB_AudioConfig_API implementation. | 30 // PPB_AudioConfig_API implementation. |
| 26 virtual PP_AudioSampleRate GetSampleRate() OVERRIDE; | 31 virtual PP_AudioSampleRate GetSampleRate() OVERRIDE; |
| 27 virtual uint32_t GetSampleFrameCount() OVERRIDE; | 32 virtual uint32_t GetSampleFrameCount() OVERRIDE; |
| 28 | 33 |
| 29 private: | 34 private: |
| 35 // You must call Init before using this object. | |
| 36 AudioConfigImpl(PP_Instance instance); // Impl constructor. | |
| 37 AudioConfigImpl(const HostResource& host_resource); // Proxy constructor. | |
|
yzshen1
2011/08/22 17:37:00
It may be good to mark them as 'explicit'.
| |
| 38 | |
| 39 // Returns false if the arguments are invalid, the object should not be | |
| 40 // used in this case. | |
| 41 bool Init(PP_AudioSampleRate sample_rate, uint32_t sample_frame_count); | |
| 42 | |
| 30 PP_AudioSampleRate sample_rate_; | 43 PP_AudioSampleRate sample_rate_; |
| 31 uint32_t sample_frame_count_; | 44 uint32_t sample_frame_count_; |
| 32 | 45 |
| 33 DISALLOW_COPY_AND_ASSIGN(AudioConfigImpl); | 46 DISALLOW_COPY_AND_ASSIGN(AudioConfigImpl); |
| 34 }; | 47 }; |
| 35 | 48 |
| 36 } // namespace ppapi | 49 } // namespace ppapi |
| 37 | 50 |
| 38 #endif // PPAPI_SHARED_IMPL_AUDIO_CONFIG_IMPL_H_ | 51 #endif // PPAPI_SHARED_IMPL_AUDIO_CONFIG_IMPL_H_ |
| OLD | NEW |