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" | 9 #include "ppapi/proxy/plugin_resource.h" |
10 #include "ppapi/proxy/ppapi_messages.h" | 10 #include "ppapi/proxy/ppapi_messages.h" |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 } | 88 } |
89 | 89 |
90 const PPB_AudioConfig audio_config_interface = { | 90 const PPB_AudioConfig audio_config_interface = { |
91 &CreateStereo16bit, | 91 &CreateStereo16bit, |
92 &RecommendSampleFrameCount, | 92 &RecommendSampleFrameCount, |
93 &IsAudioConfig, | 93 &IsAudioConfig, |
94 &GetSampleRate, | 94 &GetSampleRate, |
95 &GetSampleFrameCount | 95 &GetSampleFrameCount |
96 }; | 96 }; |
97 | 97 |
| 98 InterfaceProxy* CreateAudioConfigProxy(Dispatcher* dispatcher, |
| 99 const void* target_interface) { |
| 100 return new PPB_AudioConfig_Proxy(dispatcher, target_interface); |
| 101 } |
| 102 |
98 } // namespace | 103 } // namespace |
99 | 104 |
100 PPB_AudioConfig_Proxy::PPB_AudioConfig_Proxy(Dispatcher* dispatcher, | 105 PPB_AudioConfig_Proxy::PPB_AudioConfig_Proxy(Dispatcher* dispatcher, |
101 const void* target_interface) | 106 const void* target_interface) |
102 : InterfaceProxy(dispatcher, target_interface) { | 107 : InterfaceProxy(dispatcher, target_interface) { |
103 } | 108 } |
104 | 109 |
105 PPB_AudioConfig_Proxy::~PPB_AudioConfig_Proxy() { | 110 PPB_AudioConfig_Proxy::~PPB_AudioConfig_Proxy() { |
106 } | 111 } |
107 | 112 |
108 const void* PPB_AudioConfig_Proxy::GetSourceInterface() const { | 113 // static |
109 return &audio_config_interface; | 114 const InterfaceProxy::Info* PPB_AudioConfig_Proxy::GetInfo() { |
110 } | 115 static const Info info = { |
111 | 116 &audio_config_interface, |
112 InterfaceID PPB_AudioConfig_Proxy::GetInterfaceId() const { | 117 PPB_AUDIO_CONFIG_INTERFACE, |
113 return INTERFACE_ID_PPB_AUDIO_CONFIG; | 118 INTERFACE_ID_PPB_AUDIO_CONFIG, |
| 119 false, |
| 120 &CreateAudioConfigProxy, |
| 121 }; |
| 122 return &info; |
114 } | 123 } |
115 | 124 |
116 bool PPB_AudioConfig_Proxy::OnMessageReceived(const IPC::Message& msg) { | 125 bool PPB_AudioConfig_Proxy::OnMessageReceived(const IPC::Message& msg) { |
117 bool handled = true; | 126 bool handled = true; |
118 IPC_BEGIN_MESSAGE_MAP(PPB_AudioConfig_Proxy, msg) | 127 IPC_BEGIN_MESSAGE_MAP(PPB_AudioConfig_Proxy, msg) |
119 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBAudioConfig_Create, | 128 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBAudioConfig_Create, |
120 OnMsgCreateStereo16Bit) | 129 OnMsgCreateStereo16Bit) |
121 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBAudioConfig_RecommendSampleFrameCount, | 130 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBAudioConfig_RecommendSampleFrameCount, |
122 OnMsgRecommendSampleFrameCount) | 131 OnMsgRecommendSampleFrameCount) |
123 IPC_MESSAGE_UNHANDLED(handled = false) | 132 IPC_MESSAGE_UNHANDLED(handled = false) |
(...skipping 15 matching lines...) Expand all Loading... |
139 int32_t sample_rate, | 148 int32_t sample_rate, |
140 uint32_t requested_sample_frame_count, | 149 uint32_t requested_sample_frame_count, |
141 uint32_t* result) { | 150 uint32_t* result) { |
142 *result = ppb_audio_config_target()->RecommendSampleFrameCount( | 151 *result = ppb_audio_config_target()->RecommendSampleFrameCount( |
143 static_cast<PP_AudioSampleRate>(sample_rate), | 152 static_cast<PP_AudioSampleRate>(sample_rate), |
144 requested_sample_frame_count); | 153 requested_sample_frame_count); |
145 } | 154 } |
146 | 155 |
147 } // namespace proxy | 156 } // namespace proxy |
148 } // namespace pp | 157 } // namespace pp |
OLD | NEW |