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/shared_impl/resource_tracker.h" | 12 #include "ppapi/shared_impl/resource_tracker.h" |
13 #include "ppapi/shared_impl/tracker_base.h" | 13 #include "ppapi/shared_impl/tracker_base.h" |
14 #include "ppapi/thunk/enter.h" | 14 #include "ppapi/thunk/enter.h" |
15 #include "ppapi/thunk/ppb_audio_config_api.h" | 15 #include "ppapi/thunk/ppb_audio_config_api.h" |
16 #include "ppapi/thunk/thunk.h" | 16 #include "ppapi/thunk/thunk.h" |
17 #include "webkit/plugins/ppapi/common.h" | 17 #include "webkit/plugins/ppapi/common.h" |
18 #include "webkit/plugins/ppapi/resource_helper.h" | 18 #include "webkit/plugins/ppapi/resource_helper.h" |
19 | 19 |
20 using ppapi::PpapiGlobals; | |
21 using ppapi::thunk::EnterResourceNoLock; | 20 using ppapi::thunk::EnterResourceNoLock; |
22 using ppapi::thunk::PPB_Audio_API; | 21 using ppapi::thunk::PPB_Audio_API; |
23 using ppapi::thunk::PPB_AudioConfig_API; | 22 using ppapi::thunk::PPB_AudioConfig_API; |
24 | 23 |
25 namespace webkit { | 24 namespace webkit { |
26 namespace ppapi { | 25 namespace ppapi { |
27 | 26 |
28 // PPB_Audio_Impl -------------------------------------------------------------- | 27 // PPB_Audio_Impl -------------------------------------------------------------- |
29 | 28 |
30 PPB_Audio_Impl::PPB_Audio_Impl(PP_Instance instance) | 29 PPB_Audio_Impl::PPB_Audio_Impl(PP_Instance instance) |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 // When the stream is created, we'll get called back on StreamCreated(). | 87 // When the stream is created, we'll get called back on StreamCreated(). |
89 CHECK(!audio_); | 88 CHECK(!audio_); |
90 audio_ = plugin_delegate->CreateAudio(enter.object()->GetSampleRate(), | 89 audio_ = plugin_delegate->CreateAudio(enter.object()->GetSampleRate(), |
91 enter.object()->GetSampleFrameCount(), | 90 enter.object()->GetSampleFrameCount(), |
92 this); | 91 this); |
93 return audio_ != NULL; | 92 return audio_ != NULL; |
94 } | 93 } |
95 | 94 |
96 PP_Resource PPB_Audio_Impl::GetCurrentConfig() { | 95 PP_Resource PPB_Audio_Impl::GetCurrentConfig() { |
97 // AddRef on behalf of caller, while keeping a ref for ourselves. | 96 // AddRef on behalf of caller, while keeping a ref for ourselves. |
98 PpapiGlobals::Get()->GetResourceTracker()->AddRefResource(config_); | 97 ::ppapi::TrackerBase::Get()->GetResourceTracker()->AddRefResource(config_); |
99 return config_; | 98 return config_; |
100 } | 99 } |
101 | 100 |
102 PP_Bool PPB_Audio_Impl::StartPlayback() { | 101 PP_Bool PPB_Audio_Impl::StartPlayback() { |
103 if (!audio_) | 102 if (!audio_) |
104 return PP_FALSE; | 103 return PP_FALSE; |
105 if (playing()) | 104 if (playing()) |
106 return PP_TRUE; | 105 return PP_TRUE; |
107 SetStartPlaybackState(); | 106 SetStartPlaybackState(); |
108 return BoolToPPBool(audio_->StartPlayback()); | 107 return BoolToPPBool(audio_->StartPlayback()); |
(...skipping 91 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 | 199 // 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 | 200 // the I/O thread and back, but this extra complexity doesn't seem worth it |
202 // just to clean up these handles faster. | 201 // just to clean up these handles faster. |
203 } else { | 202 } else { |
204 SetStreamInfo(shared_memory_handle, shared_memory_size, socket_handle); | 203 SetStreamInfo(shared_memory_handle, shared_memory_size, socket_handle); |
205 } | 204 } |
206 } | 205 } |
207 | 206 |
208 } // namespace ppapi | 207 } // namespace ppapi |
209 } // namespace webkit | 208 } // namespace webkit |
OLD | NEW |