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

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

Issue 9234064: Implement device enumeration for PPB_VideoCapture_Dev. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Changes in response to Antoine's comments. Created 8 years, 10 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) 2011 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/ppb_video_capture_proxy.h" 5 #include "ppapi/proxy/ppb_video_capture_proxy.h"
6 6
7 #include <vector> 7 #include "base/compiler_specific.h"
8
9 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/memory/ref_counted.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
11 #include "ppapi/c/pp_errors.h" 11 #include "ppapi/c/pp_errors.h"
12 #include "ppapi/c/pp_resource.h" 12 #include "ppapi/c/pp_resource.h"
13 #include "ppapi/c/ppb_core.h" 13 #include "ppapi/c/ppb_core.h"
14 #include "ppapi/c/dev/ppb_video_capture_dev.h" 14 #include "ppapi/c/dev/ppb_video_capture_dev.h"
15 #include "ppapi/c/dev/ppp_video_capture_dev.h" 15 #include "ppapi/c/dev/ppp_video_capture_dev.h"
16 #include "ppapi/proxy/enter_proxy.h" 16 #include "ppapi/proxy/enter_proxy.h"
17 #include "ppapi/proxy/host_dispatcher.h" 17 #include "ppapi/proxy/host_dispatcher.h"
18 #include "ppapi/proxy/plugin_dispatcher.h" 18 #include "ppapi/proxy/plugin_dispatcher.h"
19 #include "ppapi/proxy/ppapi_messages.h" 19 #include "ppapi/proxy/ppapi_messages.h"
20 #include "ppapi/proxy/ppb_buffer_proxy.h" 20 #include "ppapi/proxy/ppb_buffer_proxy.h"
21 #include "ppapi/shared_impl/ppapi_globals.h"
22 #include "ppapi/shared_impl/ppb_resource_array_shared.h"
23 #include "ppapi/shared_impl/resource_tracker.h"
24 #include "ppapi/shared_impl/tracked_callback.h"
21 #include "ppapi/thunk/ppb_buffer_api.h" 25 #include "ppapi/thunk/ppb_buffer_api.h"
22 #include "ppapi/thunk/ppb_buffer_trusted_api.h" 26 #include "ppapi/thunk/ppb_buffer_trusted_api.h"
23 #include "ppapi/thunk/ppb_video_capture_api.h" 27 #include "ppapi/thunk/ppb_video_capture_api.h"
24 #include "ppapi/thunk/resource_creation_api.h" 28 #include "ppapi/thunk/resource_creation_api.h"
25 #include "ppapi/thunk/thunk.h" 29 #include "ppapi/thunk/thunk.h"
26 30
27 using ppapi::thunk::EnterResourceNoLock; 31 using ppapi::thunk::EnterResourceNoLock;
28 using ppapi::thunk::PPB_Buffer_API; 32 using ppapi::thunk::PPB_Buffer_API;
29 using ppapi::thunk::PPB_BufferTrusted_API; 33 using ppapi::thunk::PPB_BufferTrusted_API;
30 using ppapi::thunk::PPB_VideoCapture_API; 34 using ppapi::thunk::PPB_VideoCapture_API;
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 class VideoCapture : public ppapi::thunk::PPB_VideoCapture_API, 144 class VideoCapture : public ppapi::thunk::PPB_VideoCapture_API,
141 public Resource { 145 public Resource {
142 public: 146 public:
143 VideoCapture(const HostResource& resource); 147 VideoCapture(const HostResource& resource);
144 virtual ~VideoCapture(); 148 virtual ~VideoCapture();
145 149
146 // Resource overrides. 150 // Resource overrides.
147 virtual ppapi::thunk::PPB_VideoCapture_API* AsPPB_VideoCapture_API() OVERRIDE; 151 virtual ppapi::thunk::PPB_VideoCapture_API* AsPPB_VideoCapture_API() OVERRIDE;
148 152
149 // PPB_VideoCapture_API implementation. 153 // PPB_VideoCapture_API implementation.
154 virtual int32_t EnumerateDevices(PP_CompletionCallback callback) OVERRIDE;
155 virtual PP_Resource GetDevices() OVERRIDE;
150 virtual int32_t StartCapture( 156 virtual int32_t StartCapture(
157 const std::string& device_id,
151 const PP_VideoCaptureDeviceInfo_Dev& requested_info, 158 const PP_VideoCaptureDeviceInfo_Dev& requested_info,
152 uint32_t buffer_count) { 159 uint32_t buffer_count) OVERRIDE;
153 switch (status_) { 160 virtual int32_t ReuseBuffer(uint32_t buffer) OVERRIDE;
154 case PP_VIDEO_CAPTURE_STATUS_STARTING: 161 virtual int32_t StopCapture() OVERRIDE;
155 case PP_VIDEO_CAPTURE_STATUS_STARTED: 162 virtual const std::vector<DeviceRefData>& GetDeviceRefData() const OVERRIDE;
156 case PP_VIDEO_CAPTURE_STATUS_PAUSED:
157 default:
158 return PP_ERROR_FAILED;
159 case PP_VIDEO_CAPTURE_STATUS_STOPPED:
160 case PP_VIDEO_CAPTURE_STATUS_STOPPING:
161 break;
162 }
163 status_ = PP_VIDEO_CAPTURE_STATUS_STARTING;
164 GetDispatcher()->Send(new PpapiHostMsg_PPBVideoCapture_StartCapture(
165 API_ID_PPB_VIDEO_CAPTURE_DEV, host_resource(),
166 requested_info, buffer_count));
167 return PP_OK;
168 }
169 163
170 virtual int32_t ReuseBuffer(uint32_t buffer) { 164 void OnEnumerateDevicesComplete(int32_t result,
171 if (buffer >= buffer_in_use_.size() || !buffer_in_use_[buffer]) 165 const std::vector<DeviceRefData>& devices);
172 return PP_ERROR_BADARGUMENT; 166 bool OnStatus(uint32_t status);
173 GetDispatcher()->Send(new PpapiHostMsg_PPBVideoCapture_ReuseBuffer(
174 API_ID_PPB_VIDEO_CAPTURE_DEV, host_resource(), buffer));
175 return PP_OK;
176 }
177
178 virtual int32_t StopCapture() {
179 switch (status_) {
180 case PP_VIDEO_CAPTURE_STATUS_STOPPED:
181 case PP_VIDEO_CAPTURE_STATUS_STOPPING:
182 default:
183 return PP_ERROR_FAILED;
184 case PP_VIDEO_CAPTURE_STATUS_STARTING:
185 case PP_VIDEO_CAPTURE_STATUS_STARTED:
186 case PP_VIDEO_CAPTURE_STATUS_PAUSED:
187 break;
188 }
189 buffer_in_use_.clear();
190 status_ = PP_VIDEO_CAPTURE_STATUS_STOPPING;
191 GetDispatcher()->Send(new PpapiHostMsg_PPBVideoCapture_StopCapture(
192 API_ID_PPB_VIDEO_CAPTURE_DEV, host_resource()));
193 return PP_OK;
194 }
195
196 bool OnStatus(uint32_t status) {
197 switch (status) {
198 case PP_VIDEO_CAPTURE_STATUS_STARTING:
199 case PP_VIDEO_CAPTURE_STATUS_STOPPING:
200 default:
201 // Those states are not sent by the browser.
202 NOTREACHED();
203 return false;
204 case PP_VIDEO_CAPTURE_STATUS_STARTED:
205 switch (status_) {
206 case PP_VIDEO_CAPTURE_STATUS_STARTING:
207 case PP_VIDEO_CAPTURE_STATUS_PAUSED:
208 break;
209 default:
210 return false;
211 }
212 break;
213 case PP_VIDEO_CAPTURE_STATUS_PAUSED:
214 switch (status_) {
215 case PP_VIDEO_CAPTURE_STATUS_STARTING:
216 case PP_VIDEO_CAPTURE_STATUS_STARTED:
217 break;
218 default:
219 return false;
220 }
221 break;
222 case PP_VIDEO_CAPTURE_STATUS_STOPPED:
223 if (status_ != PP_VIDEO_CAPTURE_STATUS_STOPPING)
224 return false;
225 break;
226 }
227 status_ = status;
228 return true;
229 }
230 167
231 void set_status(uint32_t status) { status_ = status; } 168 void set_status(uint32_t status) { status_ = status; }
232 169
233 void SetBufferCount(size_t count) { 170 void SetBufferCount(size_t count) {
234 buffer_in_use_ = std::vector<bool>(count); 171 buffer_in_use_ = std::vector<bool>(count);
235 } 172 }
236 void SetBufferInUse(uint32_t buffer) { 173 void SetBufferInUse(uint32_t buffer) {
237 DCHECK(buffer < buffer_in_use_.size()); 174 DCHECK(buffer < buffer_in_use_.size());
238 buffer_in_use_[buffer] = true; 175 buffer_in_use_[buffer] = true;
239 } 176 }
240 177
241 private: 178 private:
242 PluginDispatcher* GetDispatcher() const { 179 PluginDispatcher* GetDispatcher() const {
243 return PluginDispatcher::GetForResource(this); 180 return PluginDispatcher::GetForResource(this);
244 } 181 }
245 182
246 uint32_t status_; 183 uint32_t status_;
247 std::vector<bool> buffer_in_use_; 184 std::vector<bool> buffer_in_use_;
185
186 scoped_refptr<TrackedCallback> enumerate_devices_callback_;
187
188 // A resource array holding the enumeration result. When nonzero, we're
189 // holding a reference to it.
190 PP_Resource devices_;
191
248 DISALLOW_COPY_AND_ASSIGN(VideoCapture); 192 DISALLOW_COPY_AND_ASSIGN(VideoCapture);
249 }; 193 };
250 194
251 VideoCapture::VideoCapture(const HostResource& resource) 195 VideoCapture::VideoCapture(const HostResource& resource)
252 : Resource(resource), 196 : Resource(resource),
253 status_(PP_VIDEO_CAPTURE_STATUS_STOPPED) { 197 status_(PP_VIDEO_CAPTURE_STATUS_STOPPED),
198 devices_(0) {
254 } 199 }
255 200
256 VideoCapture::~VideoCapture() { 201 VideoCapture::~VideoCapture() {
202 if (devices_)
203 PpapiGlobals::Get()->GetResourceTracker()->ReleaseResource(devices_);
257 } 204 }
258 205
259 ppapi::thunk::PPB_VideoCapture_API* VideoCapture::AsPPB_VideoCapture_API() { 206 ppapi::thunk::PPB_VideoCapture_API* VideoCapture::AsPPB_VideoCapture_API() {
260 return this; 207 return this;
261 } 208 }
262 209
210 int32_t VideoCapture::EnumerateDevices(PP_CompletionCallback callback) {
211 if (!callback.func)
212 return PP_ERROR_BLOCKS_MAIN_THREAD;
213 if (TrackedCallback::IsPending(enumerate_devices_callback_))
214 return PP_ERROR_INPROGRESS;
215
216 enumerate_devices_callback_ = new TrackedCallback(this, callback);
217 GetDispatcher()->Send(new PpapiHostMsg_PPBVideoCapture_EnumerateDevices(
218 API_ID_PPB_VIDEO_CAPTURE_DEV, host_resource()));
219 return PP_OK_COMPLETIONPENDING;
220 }
221
222 PP_Resource VideoCapture::GetDevices() {
223 if (devices_)
224 PpapiGlobals::Get()->GetResourceTracker()->AddRefResource(devices_);
225 return devices_;
226 }
227
228 int32_t VideoCapture::StartCapture(
229 const std::string& device_id,
230 const PP_VideoCaptureDeviceInfo_Dev& requested_info,
231 uint32_t buffer_count) {
232 switch (status_) {
233 case PP_VIDEO_CAPTURE_STATUS_STARTING:
234 case PP_VIDEO_CAPTURE_STATUS_STARTED:
235 case PP_VIDEO_CAPTURE_STATUS_PAUSED:
236 case PP_VIDEO_CAPTURE_STATUS_STOPPING:
237 default:
238 return PP_ERROR_FAILED;
239 case PP_VIDEO_CAPTURE_STATUS_STOPPED:
240 break;
241 }
242 buffer_in_use_.clear();
243 status_ = PP_VIDEO_CAPTURE_STATUS_STARTING;
244 GetDispatcher()->Send(new PpapiHostMsg_PPBVideoCapture_StartCapture(
245 API_ID_PPB_VIDEO_CAPTURE_DEV, host_resource(), device_id,
246 requested_info, buffer_count));
247 return PP_OK;
248 }
249
250 int32_t VideoCapture::ReuseBuffer(uint32_t buffer) {
251 if (buffer >= buffer_in_use_.size() || !buffer_in_use_[buffer])
252 return PP_ERROR_BADARGUMENT;
253 GetDispatcher()->Send(new PpapiHostMsg_PPBVideoCapture_ReuseBuffer(
254 API_ID_PPB_VIDEO_CAPTURE_DEV, host_resource(), buffer));
255 return PP_OK;
256 }
257
258 int32_t VideoCapture::StopCapture() {
259 switch (status_) {
260 case PP_VIDEO_CAPTURE_STATUS_STOPPED:
261 case PP_VIDEO_CAPTURE_STATUS_STOPPING:
262 default:
263 return PP_ERROR_FAILED;
264 case PP_VIDEO_CAPTURE_STATUS_STARTING:
265 case PP_VIDEO_CAPTURE_STATUS_STARTED:
266 case PP_VIDEO_CAPTURE_STATUS_PAUSED:
267 break;
268 }
269 status_ = PP_VIDEO_CAPTURE_STATUS_STOPPING;
270 GetDispatcher()->Send(new PpapiHostMsg_PPBVideoCapture_StopCapture(
271 API_ID_PPB_VIDEO_CAPTURE_DEV, host_resource()));
272 return PP_OK;
273 }
274
275 const std::vector<DeviceRefData>& VideoCapture::GetDeviceRefData() const {
276 // This should never be called at the plugin side.
277 NOTREACHED();
278 static std::vector<DeviceRefData> result;
279 return result;
280 }
281
282 void VideoCapture::OnEnumerateDevicesComplete(
283 int32_t result,
284 const std::vector<DeviceRefData>& devices) {
285 if (devices_) {
286 PpapiGlobals::Get()->GetResourceTracker()->ReleaseResource(devices_);
287 devices_ = 0;
288 }
289
290 if (result == PP_OK) {
291 devices_ = PPB_DeviceRef_Shared::CreateResourceArray(false, pp_instance(),
292 devices);
293 }
294
295 TrackedCallback::ClearAndRun(&enumerate_devices_callback_, result);
296 }
297
298 bool VideoCapture::OnStatus(uint32_t status) {
299 switch (status) {
300 case PP_VIDEO_CAPTURE_STATUS_STARTING:
301 case PP_VIDEO_CAPTURE_STATUS_STOPPING:
302 default:
303 // Those states are not sent by the browser.
304 NOTREACHED();
305 return false;
306 case PP_VIDEO_CAPTURE_STATUS_STARTED:
307 switch (status_) {
308 case PP_VIDEO_CAPTURE_STATUS_STARTING:
309 case PP_VIDEO_CAPTURE_STATUS_PAUSED:
310 break;
311 default:
312 return false;
313 }
314 break;
315 case PP_VIDEO_CAPTURE_STATUS_PAUSED:
316 switch (status_) {
317 case PP_VIDEO_CAPTURE_STATUS_STARTING:
318 case PP_VIDEO_CAPTURE_STATUS_STARTED:
319 break;
320 default:
321 return false;
322 }
323 break;
324 case PP_VIDEO_CAPTURE_STATUS_STOPPED:
325 if (status_ != PP_VIDEO_CAPTURE_STATUS_STOPPING)
326 return false;
327 break;
328 }
329 status_ = status;
330 return true;
331 }
332
263 PPB_VideoCapture_Proxy::PPB_VideoCapture_Proxy(Dispatcher* dispatcher) 333 PPB_VideoCapture_Proxy::PPB_VideoCapture_Proxy(Dispatcher* dispatcher)
264 : InterfaceProxy(dispatcher) { 334 : InterfaceProxy(dispatcher),
335 ALLOW_THIS_IN_INITIALIZER_LIST(callback_factory_(this)) {
265 } 336 }
266 337
267 PPB_VideoCapture_Proxy::~PPB_VideoCapture_Proxy() { 338 PPB_VideoCapture_Proxy::~PPB_VideoCapture_Proxy() {
268 } 339 }
269 340
270 // static 341 // static
271 PP_Resource PPB_VideoCapture_Proxy::CreateProxyResource(PP_Instance instance) { 342 PP_Resource PPB_VideoCapture_Proxy::CreateProxyResource(PP_Instance instance) {
272 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); 343 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance);
273 if (!dispatcher) 344 if (!dispatcher)
274 return 0; 345 return 0;
275 346
276 HostResource result; 347 HostResource result;
277 dispatcher->Send(new PpapiHostMsg_PPBVideoCapture_Create( 348 dispatcher->Send(new PpapiHostMsg_PPBVideoCapture_Create(
278 API_ID_PPB_VIDEO_CAPTURE_DEV, instance, &result)); 349 API_ID_PPB_VIDEO_CAPTURE_DEV, instance, &result));
279 if (result.is_null()) 350 if (result.is_null())
280 return 0; 351 return 0;
281 return (new VideoCapture(result))->GetReference(); 352 return (new VideoCapture(result))->GetReference();
282 } 353 }
283 354
284 bool PPB_VideoCapture_Proxy::OnMessageReceived(const IPC::Message& msg) { 355 bool PPB_VideoCapture_Proxy::OnMessageReceived(const IPC::Message& msg) {
285 bool handled = true; 356 bool handled = true;
286 IPC_BEGIN_MESSAGE_MAP(PPB_VideoCapture_Proxy, msg) 357 IPC_BEGIN_MESSAGE_MAP(PPB_VideoCapture_Proxy, msg)
287 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBVideoCapture_Create, OnMsgCreate) 358 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBVideoCapture_Create, OnMsgCreate)
359 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBVideoCapture_EnumerateDevices,
360 OnMsgEnumerateDevices)
288 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBVideoCapture_StartCapture, 361 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBVideoCapture_StartCapture,
289 OnMsgStartCapture) 362 OnMsgStartCapture)
290 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBVideoCapture_ReuseBuffer, 363 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBVideoCapture_ReuseBuffer,
291 OnMsgReuseBuffer) 364 OnMsgReuseBuffer)
292 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBVideoCapture_StopCapture, 365 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBVideoCapture_StopCapture,
293 OnMsgStopCapture) 366 OnMsgStopCapture)
367
368 IPC_MESSAGE_HANDLER(PpapiMsg_PPBVideoCapture_EnumerateDevicesACK,
369 OnMsgEnumerateDevicesACK)
294 IPC_MESSAGE_UNHANDLED(handled = false) 370 IPC_MESSAGE_UNHANDLED(handled = false)
295 IPC_END_MESSAGE_MAP() 371 IPC_END_MESSAGE_MAP()
296 // TODO(brettw) handle bad messages! 372 // TODO(brettw) handle bad messages!
297 return handled; 373 return handled;
298 } 374 }
299 375
300 void PPB_VideoCapture_Proxy::OnMsgCreate(PP_Instance instance, 376 void PPB_VideoCapture_Proxy::OnMsgCreate(PP_Instance instance,
301 HostResource* result_resource) { 377 HostResource* result_resource) {
302 thunk::EnterResourceCreation enter(instance); 378 thunk::EnterResourceCreation enter(instance);
303 if (enter.succeeded()) { 379 if (enter.succeeded()) {
304 result_resource->SetHostResource( 380 result_resource->SetHostResource(
305 instance, 381 instance,
306 enter.functions()->CreateVideoCapture(instance)); 382 enter.functions()->CreateVideoCapture(instance));
307 } 383 }
308 } 384 }
309 385
386 void PPB_VideoCapture_Proxy::OnMsgEnumerateDevices(
387 const HostResource& resource) {
388 EnterHostFromHostResourceForceCallback<PPB_VideoCapture_API> enter(
389 resource, callback_factory_,
390 &PPB_VideoCapture_Proxy::EnumerateDevicesACKInHost, resource);
391
392 if (enter.succeeded())
393 enter.SetResult(enter.object()->EnumerateDevices(enter.callback()));
394 }
395
310 void PPB_VideoCapture_Proxy::OnMsgStartCapture( 396 void PPB_VideoCapture_Proxy::OnMsgStartCapture(
311 const HostResource& resource, 397 const HostResource& resource,
398 const std::string& device_id,
312 const PP_VideoCaptureDeviceInfo_Dev& info, 399 const PP_VideoCaptureDeviceInfo_Dev& info,
313 uint32_t buffers) { 400 uint32_t buffers) {
314 EnterHostFromHostResource<PPB_VideoCapture_API> enter(resource); 401 EnterHostFromHostResource<PPB_VideoCapture_API> enter(resource);
315 if (enter.succeeded()) 402 if (enter.succeeded())
316 enter.object()->StartCapture(info, buffers); 403 enter.object()->StartCapture(device_id, info, buffers);
317 } 404 }
318 405
319 void PPB_VideoCapture_Proxy::OnMsgReuseBuffer(const HostResource& resource, 406 void PPB_VideoCapture_Proxy::OnMsgReuseBuffer(const HostResource& resource,
320 uint32_t buffer) { 407 uint32_t buffer) {
321 EnterHostFromHostResource<PPB_VideoCapture_API> enter(resource); 408 EnterHostFromHostResource<PPB_VideoCapture_API> enter(resource);
322 if (enter.succeeded()) 409 if (enter.succeeded())
323 enter.object()->ReuseBuffer(buffer); 410 enter.object()->ReuseBuffer(buffer);
324 } 411 }
325 412
326 void PPB_VideoCapture_Proxy::OnMsgStopCapture(const HostResource& resource) { 413 void PPB_VideoCapture_Proxy::OnMsgStopCapture(const HostResource& resource) {
327 EnterHostFromHostResource<PPB_VideoCapture_API> enter(resource); 414 EnterHostFromHostResource<PPB_VideoCapture_API> enter(resource);
328 if (enter.succeeded()) 415 if (enter.succeeded())
329 enter.object()->StopCapture(); 416 enter.object()->StopCapture();
330 } 417 }
331 418
419 void PPB_VideoCapture_Proxy::OnMsgEnumerateDevicesACK(
420 const HostResource& resource,
421 int32_t result,
422 const std::vector<ppapi::DeviceRefData>& devices) {
423 EnterPluginFromHostResource<PPB_VideoCapture_API> enter(resource);
424 if (enter.succeeded()) {
425 static_cast<VideoCapture*>(enter.object())->OnEnumerateDevicesComplete(
426 result, devices);
427 }
428 }
429
430 void PPB_VideoCapture_Proxy::EnumerateDevicesACKInHost(
431 int32_t result,
432 const HostResource& resource) {
433 EnterHostFromHostResource<PPB_VideoCapture_API> enter(resource);
434 dispatcher()->Send(new PpapiMsg_PPBVideoCapture_EnumerateDevicesACK(
435 API_ID_PPB_VIDEO_CAPTURE_DEV, resource, result,
436 enter.succeeded() && result == PP_OK ?
437 enter.object()->GetDeviceRefData() : std::vector<DeviceRefData>()));
438 }
439
332 PPP_VideoCapture_Proxy::PPP_VideoCapture_Proxy(Dispatcher* dispatcher) 440 PPP_VideoCapture_Proxy::PPP_VideoCapture_Proxy(Dispatcher* dispatcher)
333 : InterfaceProxy(dispatcher), 441 : InterfaceProxy(dispatcher),
334 ppp_video_capture_impl_(NULL) { 442 ppp_video_capture_impl_(NULL) {
335 if (dispatcher->IsPlugin()) { 443 if (dispatcher->IsPlugin()) {
336 ppp_video_capture_impl_ = static_cast<const PPP_VideoCapture_Dev*>( 444 ppp_video_capture_impl_ = static_cast<const PPP_VideoCapture_Dev*>(
337 dispatcher->local_get_interface()(PPP_VIDEO_CAPTURE_DEV_INTERFACE)); 445 dispatcher->local_get_interface()(PPP_VIDEO_CAPTURE_DEV_INTERFACE));
338 } 446 }
339 } 447 }
340 448
341 PPP_VideoCapture_Proxy::~PPP_VideoCapture_Proxy() { 449 PPP_VideoCapture_Proxy::~PPP_VideoCapture_Proxy() {
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 return; 539 return;
432 540
433 VideoCapture* capture = static_cast<VideoCapture*>(enter.object()); 541 VideoCapture* capture = static_cast<VideoCapture*>(enter.object());
434 capture->SetBufferInUse(buffer); 542 capture->SetBufferInUse(buffer);
435 ppp_video_capture_impl_->OnBufferReady( 543 ppp_video_capture_impl_->OnBufferReady(
436 host_resource.instance(), capture->pp_resource(), buffer); 544 host_resource.instance(), capture->pp_resource(), buffer);
437 } 545 }
438 546
439 } // namespace proxy 547 } // namespace proxy
440 } // namespace ppapi 548 } // namespace ppapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698