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