Save errno for logging before potentially overwriting it.
[chromium-blink-merge.git] / ppapi / shared_impl / ppb_audio_config_shared.h
blob77826be75b74c711d5745f9dd1a6cc10595991ad
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef PPAPI_SHARED_IMPL_PPB_AUDIO_CONFIG_SHARED_H_
6 #define PPAPI_SHARED_IMPL_PPB_AUDIO_CONFIG_SHARED_H_
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "ppapi/shared_impl/resource.h"
11 #include "ppapi/thunk/ppb_audio_config_api.h"
13 namespace ppapi {
15 class PPAPI_SHARED_EXPORT PPB_AudioConfig_Shared
16 : public Resource,
17 public thunk::PPB_AudioConfig_API {
18 public:
19 virtual ~PPB_AudioConfig_Shared();
21 static PP_Resource Create(ResourceObjectType type,
22 PP_Instance instance,
23 PP_AudioSampleRate sample_rate,
24 uint32_t sample_frame_count);
25 static uint32_t RecommendSampleFrameCount_1_0(PP_AudioSampleRate sample_rate,
26 uint32_t request_sample_frame_count);
27 static uint32_t RecommendSampleFrameCount_1_1(PP_Instance instance,
28 PP_AudioSampleRate sample_rate,
29 uint32_t request_sample_frame_count);
30 static PP_AudioSampleRate RecommendSampleRate(PP_Instance);
32 // Resource overrides.
33 virtual thunk::PPB_AudioConfig_API* AsPPB_AudioConfig_API() OVERRIDE;
35 // PPB_AudioConfig_API implementation.
36 virtual PP_AudioSampleRate GetSampleRate() OVERRIDE;
37 virtual uint32_t GetSampleFrameCount() OVERRIDE;
39 private:
40 // You must call Init before using this object.
41 PPB_AudioConfig_Shared(ResourceObjectType type, PP_Instance instance);
43 // Returns false if the arguments are invalid, the object should not be
44 // used in this case.
45 bool Init(PP_AudioSampleRate sample_rate, uint32_t sample_frame_count);
47 PP_AudioSampleRate sample_rate_;
48 uint32_t sample_frame_count_;
50 DISALLOW_COPY_AND_ASSIGN(PPB_AudioConfig_Shared);
53 } // namespace ppapi
55 #endif // PPAPI_SHARED_IMPL_PPB_AUDIO_CONFIG_SHARED_H_