| OLD | NEW |
| 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 17 matching lines...) Expand all Loading... |
| 28 resource_object_type_(OBJECT_IS_PROXY) { | 28 resource_object_type_(OBJECT_IS_PROXY) { |
| 29 } | 29 } |
| 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(PP_Resource* devices, |
| 39 PP_Resource* devices, | 39 ApiCallbackType callback) { |
| 40 const PP_CompletionCallback& callback) { | |
| 41 if (!callback.func) | |
| 42 return PP_ERROR_BLOCKS_MAIN_THREAD; | |
| 43 if (TrackedCallback::IsPending(enumerate_devices_callback_)) | 40 if (TrackedCallback::IsPending(enumerate_devices_callback_)) |
| 44 return PP_ERROR_INPROGRESS; | 41 return PP_ERROR_INPROGRESS; |
| 45 | 42 |
| 46 return InternalEnumerateDevices(devices, callback); | 43 return InternalEnumerateDevices(devices, callback); |
| 47 } | 44 } |
| 48 | 45 |
| 49 int32_t PPB_VideoCapture_Shared::Open( | 46 int32_t PPB_VideoCapture_Shared::Open( |
| 50 const std::string& device_id, | 47 const std::string& device_id, |
| 51 const PP_VideoCaptureDeviceInfo_Dev& requested_info, | 48 const PP_VideoCaptureDeviceInfo_Dev& requested_info, |
| 52 uint32_t buffer_count, | 49 uint32_t buffer_count, |
| 53 const PP_CompletionCallback& callback) { | 50 ApiCallbackType callback) { |
| 54 if (open_state_ != BEFORE_OPEN) | 51 if (open_state_ != BEFORE_OPEN) |
| 55 return PP_ERROR_FAILED; | 52 return PP_ERROR_FAILED; |
| 56 | 53 |
| 57 if (TrackedCallback::IsPending(open_callback_)) | 54 if (TrackedCallback::IsPending(open_callback_)) |
| 58 return PP_ERROR_INPROGRESS; | 55 return PP_ERROR_INPROGRESS; |
| 59 | 56 |
| 60 return InternalOpen(device_id, requested_info, buffer_count, callback); | 57 return InternalOpen(device_id, requested_info, buffer_count, callback); |
| 61 } | 58 } |
| 62 | 59 |
| 63 int32_t PPB_VideoCapture_Shared::StartCapture() { | 60 int32_t PPB_VideoCapture_Shared::StartCapture() { |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 } | 177 } |
| 181 break; | 178 break; |
| 182 } | 179 } |
| 183 } | 180 } |
| 184 | 181 |
| 185 status_ = status; | 182 status_ = status; |
| 186 return true; | 183 return true; |
| 187 } | 184 } |
| 188 | 185 |
| 189 } // namespace ppapi | 186 } // namespace ppapi |
| OLD | NEW |