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

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: Updated TestURLLoader to test blocking callbacks. Created 8 years, 8 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
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 dbadfca16f12f6c4efdd7ebf3abb31a1435e9040..6a2349ce89d21071ceabe7aada6728d7ca3349fd 100644
--- a/webkit/plugins/ppapi/ppb_video_capture_impl.cc
+++ b/webkit/plugins/ppapi/ppb_video_capture_impl.cc
@@ -25,6 +25,7 @@
#include "webkit/plugins/ppapi/ppb_buffer_impl.h"
#include "webkit/plugins/ppapi/resource_helper.h"
+using ppapi::ApiCallbackType;
using ppapi::DeviceRefData;
using ppapi::PpapiGlobals;
using ppapi::thunk::EnterResourceNoLock;
@@ -173,13 +174,13 @@ void PPB_VideoCapture_Impl::OnInitialized(media::VideoCapture* capture,
int32_t PPB_VideoCapture_Impl::InternalEnumerateDevices(
PP_Resource* devices,
- const PP_CompletionCallback& callback) {
+ ApiCallbackType 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 +192,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) {
+ ApiCallbackType 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 +210,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;
}
}

Powered by Google App Engine
This is Rietveld 408576698