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

Side by Side Diff: ppapi/shared_impl/ppb_audio_config_shared.cc

Issue 9391013: Make a global enum to differentiate impl & proxy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 10 months 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/shared_impl/ppb_audio_config_shared.h" 5 #include "ppapi/shared_impl/ppb_audio_config_shared.h"
6 6
7 namespace ppapi { 7 namespace ppapi {
8 8
9 PPB_AudioConfig_Shared::PPB_AudioConfig_Shared(PP_Instance instance) 9 PPB_AudioConfig_Shared::PPB_AudioConfig_Shared(ResourceObjectType type,
10 : Resource(instance), 10 PP_Instance instance)
11 : Resource(type, instance),
11 sample_rate_(PP_AUDIOSAMPLERATE_NONE), 12 sample_rate_(PP_AUDIOSAMPLERATE_NONE),
12 sample_frame_count_(0) { 13 sample_frame_count_(0) {
13 } 14 }
14
15 PPB_AudioConfig_Shared::PPB_AudioConfig_Shared(
16 const HostResource& host_resource)
17 : Resource(host_resource),
18 sample_rate_(PP_AUDIOSAMPLERATE_NONE),
19 sample_frame_count_(0) {
20 }
21 15
22 PPB_AudioConfig_Shared::~PPB_AudioConfig_Shared() { 16 PPB_AudioConfig_Shared::~PPB_AudioConfig_Shared() {
23 } 17 }
24 18
25 // static 19 PP_Resource PPB_AudioConfig_Shared::Create(
26 PP_Resource PPB_AudioConfig_Shared::CreateAsImpl( 20 ResourceObjectType type,
27 PP_Instance instance, 21 PP_Instance instance,
28 PP_AudioSampleRate sample_rate, 22 PP_AudioSampleRate sample_rate,
29 uint32_t sample_frame_count) { 23 uint32_t sample_frame_count) {
30 scoped_refptr<PPB_AudioConfig_Shared> object( 24 scoped_refptr<PPB_AudioConfig_Shared> object(
31 new PPB_AudioConfig_Shared(instance)); 25 new PPB_AudioConfig_Shared(type, instance));
32 if (!object->Init(sample_rate, sample_frame_count)) 26 if (!object->Init(sample_rate, sample_frame_count))
33 return 0; 27 return 0;
34 return object->GetReference(); 28 return object->GetReference();
35 }
36
37 // static
38 PP_Resource PPB_AudioConfig_Shared::CreateAsProxy(
39 PP_Instance instance,
40 PP_AudioSampleRate sample_rate,
41 uint32_t sample_frame_count) {
42 scoped_refptr<PPB_AudioConfig_Shared> object(new PPB_AudioConfig_Shared(
43 HostResource::MakeInstanceOnly(instance)));
44 if (!object->Init(sample_rate, sample_frame_count))
45 return 0;
46 return object->GetReference();
47 } 29 }
48 30
49 thunk::PPB_AudioConfig_API* PPB_AudioConfig_Shared::AsPPB_AudioConfig_API() { 31 thunk::PPB_AudioConfig_API* PPB_AudioConfig_Shared::AsPPB_AudioConfig_API() {
50 return this; 32 return this;
51 } 33 }
52 34
53 PP_AudioSampleRate PPB_AudioConfig_Shared::GetSampleRate() { 35 PP_AudioSampleRate PPB_AudioConfig_Shared::GetSampleRate() {
54 return sample_rate_; 36 return sample_rate_;
55 } 37 }
56 38
(...skipping 14 matching lines...) Expand all
71 if (sample_frame_count > PP_AUDIOMAXSAMPLEFRAMECOUNT || 53 if (sample_frame_count > PP_AUDIOMAXSAMPLEFRAMECOUNT ||
72 sample_frame_count < PP_AUDIOMINSAMPLEFRAMECOUNT) 54 sample_frame_count < PP_AUDIOMINSAMPLEFRAMECOUNT)
73 return false; 55 return false;
74 56
75 sample_rate_ = sample_rate; 57 sample_rate_ = sample_rate;
76 sample_frame_count_ = sample_frame_count; 58 sample_frame_count_ = sample_frame_count;
77 return true; 59 return true;
78 } 60 }
79 61
80 } // namespace ppapi 62 } // namespace ppapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698