Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Side by Side Diff: webkit/plugins/ppapi/ppb_audio_impl.cc

Issue 9015013: Convert callers to use the new TrackedCallback. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Foo Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « webkit/plugins/ppapi/audio_helper.cc ('k') | webkit/plugins/ppapi/ppb_audio_input_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/thunk/enter.h" 13 #include "ppapi/thunk/enter.h"
14 #include "ppapi/thunk/ppb_audio_config_api.h" 14 #include "ppapi/thunk/ppb_audio_config_api.h"
15 #include "ppapi/thunk/thunk.h" 15 #include "ppapi/thunk/thunk.h"
16 #include "webkit/plugins/ppapi/common.h" 16 #include "webkit/plugins/ppapi/common.h"
17 #include "webkit/plugins/ppapi/resource_helper.h" 17 #include "webkit/plugins/ppapi/resource_helper.h"
18 18
19 using ppapi::PpapiGlobals; 19 using ppapi::PpapiGlobals;
20 using ppapi::thunk::EnterResourceNoLock; 20 using ppapi::thunk::EnterResourceNoLock;
21 using ppapi::thunk::PPB_Audio_API; 21 using ppapi::thunk::PPB_Audio_API;
22 using ppapi::thunk::PPB_AudioConfig_API; 22 using ppapi::thunk::PPB_AudioConfig_API;
23 using ppapi::TrackedCallback;
23 24
24 namespace webkit { 25 namespace webkit {
25 namespace ppapi { 26 namespace ppapi {
26 27
27 // PPB_Audio_Impl -------------------------------------------------------------- 28 // PPB_Audio_Impl --------------------------------------------------------------
28 29
29 PPB_Audio_Impl::PPB_Audio_Impl(PP_Instance instance) 30 PPB_Audio_Impl::PPB_Audio_Impl(PP_Instance instance)
30 : Resource(instance), 31 : Resource(instance),
31 audio_(NULL) { 32 audio_(NULL) {
32 } 33 }
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 DCHECK(!audio_); 125 DCHECK(!audio_);
125 audio_ = plugin_delegate->CreateAudio(enter.object()->GetSampleRate(), 126 audio_ = plugin_delegate->CreateAudio(enter.object()->GetSampleRate(),
126 enter.object()->GetSampleFrameCount(), 127 enter.object()->GetSampleFrameCount(),
127 this); 128 this);
128 if (!audio_) 129 if (!audio_)
129 return PP_ERROR_FAILED; 130 return PP_ERROR_FAILED;
130 131
131 // At this point, we are guaranteeing ownership of the completion 132 // At this point, we are guaranteeing ownership of the completion
132 // callback. Audio promises to fire the completion callback 133 // callback. Audio promises to fire the completion callback
133 // once and only once. 134 // once and only once.
134 SetCallbackInfo(true, create_callback); 135 SetCreateCallback(new TrackedCallback(this, create_callback));
135 136
136 return PP_OK_COMPLETIONPENDING; 137 return PP_OK_COMPLETIONPENDING;
137 } 138 }
138 139
139 int32_t PPB_Audio_Impl::GetSyncSocket(int* sync_socket) { 140 int32_t PPB_Audio_Impl::GetSyncSocket(int* sync_socket) {
140 return GetSyncSocketImpl(sync_socket); 141 return GetSyncSocketImpl(sync_socket);
141 } 142 }
142 143
143 int32_t PPB_Audio_Impl::GetSharedMemory(int* shm_handle, 144 int32_t PPB_Audio_Impl::GetSharedMemory(int* shm_handle,
144 uint32_t* shm_size) { 145 uint32_t* shm_size) {
145 return GetSharedMemoryImpl(shm_handle, shm_size); 146 return GetSharedMemoryImpl(shm_handle, shm_size);
146 } 147 }
147 148
148 void PPB_Audio_Impl::OnSetStreamInfo( 149 void PPB_Audio_Impl::OnSetStreamInfo(
149 base::SharedMemoryHandle shared_memory_handle, 150 base::SharedMemoryHandle shared_memory_handle,
150 size_t shared_memory_size, 151 size_t shared_memory_size,
151 base::SyncSocket::Handle socket_handle) { 152 base::SyncSocket::Handle socket_handle) {
152 SetStreamInfo(shared_memory_handle, shared_memory_size, socket_handle); 153 SetStreamInfo(shared_memory_handle, shared_memory_size, socket_handle);
153 } 154 }
154 155
155 } // namespace ppapi 156 } // namespace ppapi
156 } // namespace webkit 157 } // namespace webkit
OLDNEW
« no previous file with comments | « webkit/plugins/ppapi/audio_helper.cc ('k') | webkit/plugins/ppapi/ppb_audio_input_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698