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