OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <vector> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); | 294 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); |
295 if (!dispatcher) | 295 if (!dispatcher) |
296 return 0; | 296 return 0; |
297 | 297 |
298 HostResource result; | 298 HostResource result; |
299 dispatcher->Send(new PpapiHostMsg_PPBVideoCapture_Create( | 299 dispatcher->Send(new PpapiHostMsg_PPBVideoCapture_Create( |
300 INTERFACE_ID_PPB_VIDEO_CAPTURE_DEV, instance, &result)); | 300 INTERFACE_ID_PPB_VIDEO_CAPTURE_DEV, instance, &result)); |
301 if (result.is_null()) | 301 if (result.is_null()) |
302 return 0; | 302 return 0; |
303 | 303 |
304 linked_ptr<VideoCapture> object(new VideoCapture(result)); | 304 return PluginResourceTracker::GetInstance()->AddResource( |
305 return PluginResourceTracker::GetInstance()->AddResource(object); | 305 new VideoCapture(result)); |
306 } | 306 } |
307 | 307 |
308 bool PPB_VideoCapture_Proxy::OnMessageReceived(const IPC::Message& msg) { | 308 bool PPB_VideoCapture_Proxy::OnMessageReceived(const IPC::Message& msg) { |
309 bool handled = true; | 309 bool handled = true; |
310 IPC_BEGIN_MESSAGE_MAP(PPB_VideoCapture_Proxy, msg) | 310 IPC_BEGIN_MESSAGE_MAP(PPB_VideoCapture_Proxy, msg) |
311 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBVideoCapture_Create, OnMsgCreate) | 311 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBVideoCapture_Create, OnMsgCreate) |
312 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBVideoCapture_StartCapture, | 312 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBVideoCapture_StartCapture, |
313 OnMsgStartCapture) | 313 OnMsgStartCapture) |
314 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBVideoCapture_ReuseBuffer, | 314 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBVideoCapture_ReuseBuffer, |
315 OnMsgReuseBuffer) | 315 OnMsgReuseBuffer) |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
450 PP_Resource resource = tracker->PluginResourceForHostResource(host_resource); | 450 PP_Resource resource = tracker->PluginResourceForHostResource(host_resource); |
451 if (!resource || !ppp_video_capture_target() || enter.failed()) | 451 if (!resource || !ppp_video_capture_target() || enter.failed()) |
452 return; | 452 return; |
453 static_cast<VideoCapture*>(enter.object())->SetBufferInUse(buffer); | 453 static_cast<VideoCapture*>(enter.object())->SetBufferInUse(buffer); |
454 ppp_video_capture_target()->OnBufferReady( | 454 ppp_video_capture_target()->OnBufferReady( |
455 host_resource.instance(), resource, buffer); | 455 host_resource.instance(), resource, buffer); |
456 } | 456 } |
457 | 457 |
458 } // namespace proxy | 458 } // namespace proxy |
459 } // namespace pp | 459 } // namespace pp |
OLD | NEW |