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/proxy/flash_resource.h" | 5 #include "ppapi/proxy/flash_resource.h" |
6 | 6 |
7 #include "ipc/ipc_message.h" | 7 #include "ipc/ipc_message.h" |
8 #include "ppapi/c/pp_errors.h" | 8 #include "ppapi/c/pp_errors.h" |
9 #include "ppapi/proxy/dispatch_reply_message.h" | 9 #include "ppapi/proxy/dispatch_reply_message.h" |
10 #include "ppapi/proxy/ppapi_messages.h" | 10 #include "ppapi/proxy/ppapi_messages.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 | 28 |
29 int32_t FlashResource::EnumerateVideoCaptureDevices( | 29 int32_t FlashResource::EnumerateVideoCaptureDevices( |
30 PP_Instance instance, | 30 PP_Instance instance, |
31 PP_Resource video_capture, | 31 PP_Resource video_capture, |
32 const PP_ArrayOutput& devices) { | 32 const PP_ArrayOutput& devices) { |
33 ArrayWriter output; | 33 ArrayWriter output; |
34 output.set_pp_array_output(devices); | 34 output.set_pp_array_output(devices); |
35 if (!output.is_valid()) | 35 if (!output.is_valid()) |
36 return PP_ERROR_BADARGUMENT; | 36 return PP_ERROR_BADARGUMENT; |
37 | 37 |
38 thunk::EnterResource<thunk::PPB_VideoCapture_API> enter(video_capture, true); | 38 thunk::EnterResourceNoLock<thunk::PPB_VideoCapture_API> enter(video_capture, |
| 39 true); |
39 if (enter.failed()) | 40 if (enter.failed()) |
40 return PP_ERROR_NOINTERFACE; | 41 return PP_ERROR_NOINTERFACE; |
41 | 42 |
42 std::vector<ppapi::DeviceRefData> device_ref_data; | 43 std::vector<ppapi::DeviceRefData> device_ref_data; |
43 int32_t result = | 44 int32_t result = |
44 SyncCall<PpapiPluginMsg_Flash_EnumerateVideoCaptureDevicesReply>( | 45 SyncCall<PpapiPluginMsg_Flash_EnumerateVideoCaptureDevicesReply>( |
45 RENDERER, | 46 RENDERER, |
46 PpapiHostMsg_Flash_EnumerateVideoCaptureDevices( | 47 PpapiHostMsg_Flash_EnumerateVideoCaptureDevices( |
47 enter.resource()->host_resource()), | 48 enter.resource()->host_resource()), |
48 &device_ref_data); | 49 &device_ref_data); |
49 if (result != PP_OK) | 50 if (result != PP_OK) |
50 return result; | 51 return result; |
51 | 52 |
52 std::vector<scoped_refptr<Resource> > device_resources; | 53 std::vector<scoped_refptr<Resource> > device_resources; |
53 for (size_t i = 0; i < device_ref_data.size(); ++i) { | 54 for (size_t i = 0; i < device_ref_data.size(); ++i) { |
54 scoped_refptr<Resource> resource(new PPB_DeviceRef_Shared( | 55 scoped_refptr<Resource> resource(new PPB_DeviceRef_Shared( |
55 OBJECT_IS_PROXY, instance, device_ref_data[i])); | 56 OBJECT_IS_PROXY, instance, device_ref_data[i])); |
56 device_resources.push_back(resource); | 57 device_resources.push_back(resource); |
57 } | 58 } |
58 | 59 |
59 if (!output.StoreResourceVector(device_resources)) | 60 if (!output.StoreResourceVector(device_resources)) |
60 return PP_ERROR_FAILED; | 61 return PP_ERROR_FAILED; |
61 | 62 |
62 return PP_OK; | 63 return PP_OK; |
63 } | 64 } |
64 | 65 |
65 } // namespace proxy | 66 } // namespace proxy |
66 } // namespace ppapi | 67 } // namespace ppapi |
OLD | NEW |