summaryrefslogtreecommitdiffstats
path: root/ppapi/proxy/ppb_video_capture_proxy.cc
diff options
context:
space:
mode:
authordmichael@chromium.org <dmichael@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-23 14:27:42 +0000
committerdmichael@chromium.org <dmichael@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-23 14:27:42 +0000
commitaed965375dec978e7feb8722b1b94250a2a6e039 (patch)
tree9f8ccdf7a3902fa1db54e0c036f7cb9ca96775fb /ppapi/proxy/ppb_video_capture_proxy.cc
parent94bd0a2e94c1f07ccc0236a95e57a2e16b94038a (diff)
downloadchromium_src-aed965375dec978e7feb8722b1b94250a2a6e039.zip
chromium_src-aed965375dec978e7feb8722b1b94250a2a6e039.tar.gz
chromium_src-aed965375dec978e7feb8722b1b94250a2a6e039.tar.bz2
PPAPI: Make blocking completion callbacks work.
This also makes scoped_refptr<TrackedCallback> the "new" way to pass completion callbacks in an API. This allows the Enter object to handle checking for blocking callbacks on the main thread to report error, and blocking if on the background thread. This way, interfaces don't have to write any special cases for blocking callbacks. When built with enable_pepper_threading=1 locally, URLLoader tests all pass for blocking completion callbacks. I haven't updated all tests yet. BUG=92909 TEST= Review URL: https://chromiumcodereview.appspot.com/10081020 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@143806 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/proxy/ppb_video_capture_proxy.cc')
-rw-r--r--ppapi/proxy/ppb_video_capture_proxy.cc17
1 files changed, 7 insertions, 10 deletions
diff --git a/ppapi/proxy/ppb_video_capture_proxy.cc b/ppapi/proxy/ppb_video_capture_proxy.cc
index 6a51299..badd40d 100644
--- a/ppapi/proxy/ppb_video_capture_proxy.cc
+++ b/ppapi/proxy/ppb_video_capture_proxy.cc
@@ -164,12 +164,12 @@ class VideoCapture : public PPB_VideoCapture_Shared {
// PPB_VideoCapture_Shared implementation.
virtual int32_t InternalEnumerateDevices(
PP_Resource* devices,
- const PP_CompletionCallback& callback) OVERRIDE;
+ scoped_refptr<TrackedCallback> callback) OVERRIDE;
virtual int32_t InternalOpen(
const std::string& device_id,
const PP_VideoCaptureDeviceInfo_Dev& requested_info,
uint32_t buffer_count,
- const PP_CompletionCallback& callback) OVERRIDE;
+ scoped_refptr<TrackedCallback> callback) OVERRIDE;
virtual int32_t InternalStartCapture() OVERRIDE;
virtual int32_t InternalReuseBuffer(uint32_t buffer) OVERRIDE;
virtual int32_t InternalStopCapture() OVERRIDE;
@@ -214,9 +214,10 @@ bool VideoCapture::OnStatus(PP_VideoCaptureStatus_Dev status) {
}
int32_t VideoCapture::InternalEnumerateDevices(
- PP_Resource* devices, const PP_CompletionCallback& callback) {
+ PP_Resource* devices,
+ scoped_refptr<TrackedCallback> callback) {
devices_ = devices;
- enumerate_devices_callback_ = new TrackedCallback(this, callback);
+ enumerate_devices_callback_ = callback;
GetDispatcher()->Send(new PpapiHostMsg_PPBVideoCapture_EnumerateDevices(
API_ID_PPB_VIDEO_CAPTURE_DEV, host_resource()));
return PP_OK_COMPLETIONPENDING;
@@ -226,12 +227,8 @@ int32_t VideoCapture::InternalOpen(
const std::string& device_id,
const PP_VideoCaptureDeviceInfo_Dev& requested_info,
uint32_t buffer_count,
- const PP_CompletionCallback& callback) {
- // Disallow blocking call. The base class doesn't check this.
- if (!callback.func)
- return PP_ERROR_BLOCKS_MAIN_THREAD;
-
- open_callback_ = new TrackedCallback(this, callback);
+ scoped_refptr<TrackedCallback> callback) {
+ open_callback_ = callback;
GetDispatcher()->Send(new PpapiHostMsg_PPBVideoCapture_Open(
API_ID_PPB_VIDEO_CAPTURE_DEV, host_resource(), device_id, requested_info,
buffer_count));