OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/cpp/dev/audio_dev.h" | 5 #include "ppapi/cpp/dev/audio_dev.h" |
6 | 6 |
7 #include "ppapi/cpp/module_impl.h" | 7 #include "ppapi/cpp/module_impl.h" |
8 | 8 |
9 namespace pp { | 9 namespace pp { |
10 | 10 |
11 namespace { | 11 namespace { |
12 | 12 |
13 template <> const char* interface_name<PPB_Audio_Dev>() { | 13 template <> const char* interface_name<PPB_Audio_Dev>() { |
14 return PPB_AUDIO_DEV_INTERFACE; | 14 return PPB_AUDIO_DEV_INTERFACE; |
15 } | 15 } |
16 | 16 |
17 } // namespace | 17 } // namespace |
18 | 18 |
19 Audio_Dev::Audio_Dev(const Instance& instance, | 19 Audio_Dev::Audio_Dev(Instance* instance, |
20 const AudioConfig_Dev& config, | 20 const AudioConfig_Dev& config, |
21 PPB_Audio_Callback callback, | 21 PPB_Audio_Callback callback, |
22 void* user_data) | 22 void* user_data) |
23 : config_(config) { | 23 : config_(config) { |
24 if (has_interface<PPB_Audio_Dev>()) { | 24 if (has_interface<PPB_Audio_Dev>()) { |
25 PassRefFromConstructor(get_interface<PPB_Audio_Dev>()->Create( | 25 PassRefFromConstructor(get_interface<PPB_Audio_Dev>()->Create( |
26 instance.pp_instance(), config.pp_resource(), callback, user_data)); | 26 instance->pp_instance(), config.pp_resource(), callback, user_data)); |
27 } | 27 } |
28 } | 28 } |
29 | 29 |
30 bool Audio_Dev::StartPlayback() { | 30 bool Audio_Dev::StartPlayback() { |
31 return has_interface<PPB_Audio_Dev>() && | 31 return has_interface<PPB_Audio_Dev>() && |
32 get_interface<PPB_Audio_Dev>()->StartPlayback(pp_resource()); | 32 get_interface<PPB_Audio_Dev>()->StartPlayback(pp_resource()); |
33 } | 33 } |
34 | 34 |
35 bool Audio_Dev::StopPlayback() { | 35 bool Audio_Dev::StopPlayback() { |
36 return has_interface<PPB_Audio_Dev>() && | 36 return has_interface<PPB_Audio_Dev>() && |
37 get_interface<PPB_Audio_Dev>()->StopPlayback(pp_resource()); | 37 get_interface<PPB_Audio_Dev>()->StopPlayback(pp_resource()); |
38 } | 38 } |
39 | 39 |
40 } // namespace pp | 40 } // namespace pp |
41 | 41 |
OLD | NEW |