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 "webkit/plugins/ppapi/ppb_audio_impl.h" | 5 #include "webkit/plugins/ppapi/ppb_audio_impl.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "ppapi/c/pp_completion_callback.h" | 8 #include "ppapi/c/pp_completion_callback.h" |
9 #include "ppapi/c/ppb_audio.h" | 9 #include "ppapi/c/ppb_audio.h" |
10 #include "ppapi/c/ppb_audio_config.h" | 10 #include "ppapi/c/ppb_audio_config.h" |
11 #include "ppapi/c/trusted/ppb_audio_trusted.h" | 11 #include "ppapi/c/trusted/ppb_audio_trusted.h" |
12 #include "ppapi/thunk/enter.h" | 12 #include "ppapi/thunk/enter.h" |
13 #include "ppapi/thunk/ppb_audio_config_api.h" | 13 #include "ppapi/thunk/ppb_audio_config_api.h" |
14 #include "ppapi/thunk/thunk.h" | 14 #include "ppapi/thunk/thunk.h" |
15 #include "webkit/plugins/ppapi/common.h" | 15 #include "webkit/plugins/ppapi/common.h" |
16 | 16 |
17 namespace webkit { | 17 namespace webkit { |
18 namespace ppapi { | 18 namespace ppapi { |
19 | 19 |
20 // PPB_AudioConfig ------------------------------------------------------------- | 20 // PPB_AudioConfig ------------------------------------------------------------- |
21 | 21 |
22 PPB_AudioConfig_Impl::PPB_AudioConfig_Impl(PluginInstance* instance) | 22 PPB_AudioConfig_Impl::PPB_AudioConfig_Impl(PluginInstance* instance) |
23 : Resource(instance) { | 23 : Resource(instance) { |
24 } | 24 } |
25 | 25 |
26 PPB_AudioConfig_Impl::~PPB_AudioConfig_Impl() { | 26 PPB_AudioConfig_Impl::~PPB_AudioConfig_Impl() { |
27 } | 27 } |
28 | 28 |
29 ::ppapi::thunk::PPB_AudioConfig_API* PPB_AudioConfig_Impl::AsAudioConfig_API() { | 29 ::ppapi::thunk::PPB_AudioConfig_API* |
| 30 PPB_AudioConfig_Impl::AsPPB_AudioConfig_API() { |
30 return this; | 31 return this; |
31 } | 32 } |
32 | 33 |
33 // PPB_Audio_Impl -------------------------------------------------------------- | 34 // PPB_Audio_Impl -------------------------------------------------------------- |
34 | 35 |
35 PPB_Audio_Impl::PPB_Audio_Impl(PluginInstance* instance) | 36 PPB_Audio_Impl::PPB_Audio_Impl(PluginInstance* instance) |
36 : Resource(instance), | 37 : Resource(instance), |
37 config_id_(0), | 38 config_id_(0), |
38 audio_(NULL), | 39 audio_(NULL), |
39 create_callback_pending_(false) { | 40 create_callback_pending_(false) { |
(...skipping 15 matching lines...) Expand all Loading... |
55 } | 56 } |
56 | 57 |
57 // If the completion callback hasn't fired yet, do so here | 58 // If the completion callback hasn't fired yet, do so here |
58 // with an error condition. | 59 // with an error condition. |
59 if (create_callback_pending_) { | 60 if (create_callback_pending_) { |
60 PP_RunCompletionCallback(&create_callback_, PP_ERROR_ABORTED); | 61 PP_RunCompletionCallback(&create_callback_, PP_ERROR_ABORTED); |
61 create_callback_pending_ = false; | 62 create_callback_pending_ = false; |
62 } | 63 } |
63 } | 64 } |
64 | 65 |
65 ::ppapi::thunk::PPB_Audio_API* PPB_Audio_Impl::AsAudio_API() { | 66 ::ppapi::thunk::PPB_Audio_API* PPB_Audio_Impl::AsPPB_Audio_API() { |
66 return this; | 67 return this; |
67 } | 68 } |
68 | 69 |
69 ::ppapi::thunk::PPB_AudioTrusted_API* PPB_Audio_Impl::AsAudioTrusted_API() { | 70 ::ppapi::thunk::PPB_AudioTrusted_API* PPB_Audio_Impl::AsPPB_AudioTrusted_API() { |
70 return this; | 71 return this; |
71 } | 72 } |
72 | 73 |
73 bool PPB_Audio_Impl::Init(PP_Resource config_id, | 74 bool PPB_Audio_Impl::Init(PP_Resource config_id, |
74 PPB_Audio_Callback callback, void* user_data) { | 75 PPB_Audio_Callback callback, void* user_data) { |
75 // Validate the config and keep a reference to it. | 76 // Validate the config and keep a reference to it. |
76 ::ppapi::thunk::EnterResourceNoLock< ::ppapi::thunk::PPB_AudioConfig_API> | 77 ::ppapi::thunk::EnterResourceNoLock< ::ppapi::thunk::PPB_AudioConfig_API> |
77 enter(config_id, true); | 78 enter(config_id, true); |
78 if (enter.failed()) | 79 if (enter.failed()) |
79 return false; | 80 return false; |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 // something more elaborate like an ACK from the plugin or post a task to | 201 // something more elaborate like an ACK from the plugin or post a task to |
201 // the I/O thread and back, but this extra complexity doesn't seem worth it | 202 // the I/O thread and back, but this extra complexity doesn't seem worth it |
202 // just to clean up these handles faster. | 203 // just to clean up these handles faster. |
203 } else { | 204 } else { |
204 SetStreamInfo(shared_memory_handle, shared_memory_size, socket_handle); | 205 SetStreamInfo(shared_memory_handle, shared_memory_size, socket_handle); |
205 } | 206 } |
206 } | 207 } |
207 | 208 |
208 } // namespace ppapi | 209 } // namespace ppapi |
209 } // namespace webkit | 210 } // namespace webkit |
OLD | NEW |