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

Side by Side Diff: ppapi/proxy/flash_resource.cc

Issue 11028104: Add template SyncCall() to PluginResource. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync & resolve Created 8 years, 2 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 | « ppapi/proxy/flash_font_file_resource.cc ('k') | ppapi/proxy/plugin_resource.h » ('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) 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 21 matching lines...) Expand all
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::EnterResource<thunk::PPB_VideoCapture_API> enter(video_capture, true);
39 if (enter.failed()) 39 if (enter.failed())
40 return PP_ERROR_NOINTERFACE; 40 return PP_ERROR_NOINTERFACE;
41 41
42 IPC::Message reply;
43 std::vector<ppapi::DeviceRefData> device_ref_data; 42 std::vector<ppapi::DeviceRefData> device_ref_data;
44 int32_t result = CallRendererSync( 43 int32_t result =
45 PpapiHostMsg_Flash_EnumerateVideoCaptureDevices( 44 SyncCall<PpapiPluginMsg_Flash_EnumerateVideoCaptureDevicesReply>(
46 enter.resource()->host_resource()), &reply); 45 RENDERER,
46 PpapiHostMsg_Flash_EnumerateVideoCaptureDevices(
47 enter.resource()->host_resource()),
48 &device_ref_data);
47 if (result != PP_OK) 49 if (result != PP_OK)
48 return result; 50 return result;
49 PpapiPluginMsg_Flash_EnumerateVideoCaptureDevicesReply::Schema::Param p;
50 if (!PpapiPluginMsg_Flash_EnumerateVideoCaptureDevicesReply::Read(&reply, &p))
51 return PP_ERROR_FAILED;
52 device_ref_data = p.a;
53 51
54 std::vector<scoped_refptr<Resource> > device_resources; 52 std::vector<scoped_refptr<Resource> > device_resources;
55 for (size_t i = 0; i < device_ref_data.size(); ++i) { 53 for (size_t i = 0; i < device_ref_data.size(); ++i) {
56 scoped_refptr<Resource> resource(new PPB_DeviceRef_Shared( 54 scoped_refptr<Resource> resource(new PPB_DeviceRef_Shared(
57 OBJECT_IS_PROXY, instance, device_ref_data[i])); 55 OBJECT_IS_PROXY, instance, device_ref_data[i]));
58 device_resources.push_back(resource); 56 device_resources.push_back(resource);
59 } 57 }
60 58
61 if (!output.StoreResourceVector(device_resources)) 59 if (!output.StoreResourceVector(device_resources))
62 return PP_ERROR_FAILED; 60 return PP_ERROR_FAILED;
63 61
64 return PP_OK; 62 return PP_OK;
65 } 63 }
66 64
67 } // namespace proxy 65 } // namespace proxy
68 } // namespace ppapi 66 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/proxy/flash_font_file_resource.cc ('k') | ppapi/proxy/plugin_resource.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698