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

Unified Diff: webkit/plugins/ppapi/ppb_video_capture_impl.cc

Issue 10081020: PPAPI: Make blocking completion callbacks work. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: export AssertLockHeld Created 8 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webkit/plugins/ppapi/ppb_video_capture_impl.h ('k') | webkit/plugins/ppapi/ppb_video_decoder_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/plugins/ppapi/ppb_video_capture_impl.cc
diff --git a/webkit/plugins/ppapi/ppb_video_capture_impl.cc b/webkit/plugins/ppapi/ppb_video_capture_impl.cc
index 9a00155ee0e72653d6a12f2628e3a8712153dff4..40612f0c042a7a917acfdcc7a57a2190029c8901 100644
--- a/webkit/plugins/ppapi/ppb_video_capture_impl.cc
+++ b/webkit/plugins/ppapi/ppb_video_capture_impl.cc
@@ -173,13 +173,13 @@ void PPB_VideoCapture_Impl::OnInitialized(media::VideoCapture* capture,
int32_t PPB_VideoCapture_Impl::InternalEnumerateDevices(
PP_Resource* devices,
- const PP_CompletionCallback& callback) {
+ scoped_refptr<TrackedCallback> callback) {
PluginInstance* instance = ResourceHelper::GetPluginInstance(this);
if (!instance)
return PP_ERROR_FAILED;
devices_ = devices;
- enumerate_devices_callback_ = new TrackedCallback(this, callback);
+ enumerate_devices_callback_ = callback;
instance->delegate()->EnumerateDevices(
PP_DEVICETYPE_DEV_VIDEOCAPTURE,
base::Bind(&PPB_VideoCapture_Impl::EnumerateDevicesCallbackFunc,
@@ -191,13 +191,10 @@ int32_t PPB_VideoCapture_Impl::InternalOpen(
const std::string& device_id,
const PP_VideoCaptureDeviceInfo_Dev& requested_info,
uint32_t buffer_count,
- const PP_CompletionCallback& callback) {
+ scoped_refptr<TrackedCallback> callback) {
// It is able to complete synchronously if the default device is used.
bool sync_completion = device_id.empty();
- if (!callback.func && !sync_completion)
- return PP_ERROR_BLOCKS_MAIN_THREAD;
-
PluginInstance* instance = ResourceHelper::GetPluginInstance(this);
if (!instance)
return PP_ERROR_FAILED;
@@ -212,7 +209,7 @@ int32_t PPB_VideoCapture_Impl::InternalOpen(
OnInitialized(platform_video_capture_.get(), true);
return PP_OK;
} else {
- open_callback_ = new TrackedCallback(this, callback);
+ open_callback_ = callback;
return PP_OK_COMPLETIONPENDING;
}
}
« no previous file with comments | « webkit/plugins/ppapi/ppb_video_capture_impl.h ('k') | webkit/plugins/ppapi/ppb_video_decoder_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698