| 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 "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" |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 // PPB_Audio_Impl -------------------------------------------------------------- | 213 // PPB_Audio_Impl -------------------------------------------------------------- |
| 214 | 214 |
| 215 PPB_Audio_Impl::PPB_Audio_Impl(PluginInstance* instance) | 215 PPB_Audio_Impl::PPB_Audio_Impl(PluginInstance* instance) |
| 216 : Resource(instance), | 216 : Resource(instance), |
| 217 audio_(NULL), | 217 audio_(NULL), |
| 218 create_callback_pending_(false) { | 218 create_callback_pending_(false) { |
| 219 create_callback_ = PP_MakeCompletionCallback(NULL, NULL); | 219 create_callback_ = PP_MakeCompletionCallback(NULL, NULL); |
| 220 } | 220 } |
| 221 | 221 |
| 222 PPB_Audio_Impl::~PPB_Audio_Impl() { | 222 PPB_Audio_Impl::~PPB_Audio_Impl() { |
| 223 // Calling ShutDown() makes sure StreamCreated cannot be called anymore. | 223 // Calling ShutDown() makes sure StreamCreated cannot be called anymore and |
| 224 // releases the audio data associated with the pointer. Note however, that |
| 225 // until ShutDown returns, StreamCreated may still be called. This will be |
| 226 // OK since we'll just immediately clean up the data it stored later in this |
| 227 // destructor. |
| 224 if (audio_) { | 228 if (audio_) { |
| 225 audio_->ShutDown(); | 229 audio_->ShutDown(); |
| 226 audio_ = NULL; | 230 audio_ = NULL; |
| 227 } | 231 } |
| 228 | 232 |
| 229 // If the completion callback hasn't fired yet, do so here | 233 // If the completion callback hasn't fired yet, do so here |
| 230 // with an error condition. | 234 // with an error condition. |
| 231 if (create_callback_pending_) { | 235 if (create_callback_pending_) { |
| 232 PP_RunCompletionCallback(&create_callback_, PP_ERROR_ABORTED); | 236 PP_RunCompletionCallback(&create_callback_, PP_ERROR_ABORTED); |
| 233 create_callback_pending_ = false; | 237 create_callback_pending_ = false; |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 // the I/O thread and back, but this extra complexity doesn't seem worth it | 367 // the I/O thread and back, but this extra complexity doesn't seem worth it |
| 364 // just to clean up these handles faster. | 368 // just to clean up these handles faster. |
| 365 } else { | 369 } else { |
| 366 SetStreamInfo(shared_memory_handle, shared_memory_size, socket_handle); | 370 SetStreamInfo(shared_memory_handle, shared_memory_size, socket_handle); |
| 367 } | 371 } |
| 368 } | 372 } |
| 369 | 373 |
| 370 } // namespace ppapi | 374 } // namespace ppapi |
| 371 } // namespace webkit | 375 } // namespace webkit |
| 372 | 376 |
| OLD | NEW |