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

Side by Side Diff: ppapi/shared_impl/ppb_video_capture_shared.cc

Issue 10081020: PPAPI: Make blocking completion callbacks work. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: export AssertLockHeld Created 8 years, 6 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ppapi/shared_impl/ppb_video_capture_shared.h" 5 #include "ppapi/shared_impl/ppb_video_capture_shared.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "ppapi/c/pp_errors.h" 8 #include "ppapi/c/pp_errors.h"
9 #include "ppapi/shared_impl/ppb_device_ref_shared.h" 9 #include "ppapi/shared_impl/ppb_device_ref_shared.h"
10 #include "ppapi/shared_impl/ppb_resource_array_shared.h" 10 #include "ppapi/shared_impl/ppb_resource_array_shared.h"
(...skipping 19 matching lines...) Expand all
30 30
31 PPB_VideoCapture_Shared::~PPB_VideoCapture_Shared() { 31 PPB_VideoCapture_Shared::~PPB_VideoCapture_Shared() {
32 } 32 }
33 33
34 thunk::PPB_VideoCapture_API* PPB_VideoCapture_Shared::AsPPB_VideoCapture_API() { 34 thunk::PPB_VideoCapture_API* PPB_VideoCapture_Shared::AsPPB_VideoCapture_API() {
35 return this; 35 return this;
36 } 36 }
37 37
38 int32_t PPB_VideoCapture_Shared::EnumerateDevices( 38 int32_t PPB_VideoCapture_Shared::EnumerateDevices(
39 PP_Resource* devices, 39 PP_Resource* devices,
40 const PP_CompletionCallback& callback) { 40 scoped_refptr<TrackedCallback> callback) {
41 if (!callback.func)
42 return PP_ERROR_BLOCKS_MAIN_THREAD;
43 if (TrackedCallback::IsPending(enumerate_devices_callback_)) 41 if (TrackedCallback::IsPending(enumerate_devices_callback_))
44 return PP_ERROR_INPROGRESS; 42 return PP_ERROR_INPROGRESS;
45 43
46 return InternalEnumerateDevices(devices, callback); 44 return InternalEnumerateDevices(devices, callback);
47 } 45 }
48 46
49 int32_t PPB_VideoCapture_Shared::Open( 47 int32_t PPB_VideoCapture_Shared::Open(
50 const std::string& device_id, 48 const std::string& device_id,
51 const PP_VideoCaptureDeviceInfo_Dev& requested_info, 49 const PP_VideoCaptureDeviceInfo_Dev& requested_info,
52 uint32_t buffer_count, 50 uint32_t buffer_count,
53 const PP_CompletionCallback& callback) { 51 scoped_refptr<TrackedCallback> callback) {
54 if (open_state_ != BEFORE_OPEN) 52 if (open_state_ != BEFORE_OPEN)
55 return PP_ERROR_FAILED; 53 return PP_ERROR_FAILED;
56 54
57 if (TrackedCallback::IsPending(open_callback_)) 55 if (TrackedCallback::IsPending(open_callback_))
58 return PP_ERROR_INPROGRESS; 56 return PP_ERROR_INPROGRESS;
59 57
60 return InternalOpen(device_id, requested_info, buffer_count, callback); 58 return InternalOpen(device_id, requested_info, buffer_count, callback);
61 } 59 }
62 60
63 int32_t PPB_VideoCapture_Shared::StartCapture() { 61 int32_t PPB_VideoCapture_Shared::StartCapture() {
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 } 178 }
181 break; 179 break;
182 } 180 }
183 } 181 }
184 182
185 status_ = status; 183 status_ = status;
186 return true; 184 return true;
187 } 185 }
188 186
189 } // namespace ppapi 187 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/shared_impl/ppb_video_capture_shared.h ('k') | ppapi/shared_impl/ppb_video_decoder_shared.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698