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

Unified Diff: ppapi/cpp/dev/video_capture_dev.h

Issue 9965080: Change the cpp wrappers of audio input/video capture to use CompletionCallbackWithOutput. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Avoid extra copies in Dispatcher*::operator(). Created 8 years, 9 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: ppapi/cpp/dev/video_capture_dev.h
diff --git a/ppapi/cpp/dev/video_capture_dev.h b/ppapi/cpp/dev/video_capture_dev.h
index 57f6e1d67aa3a3ed9d127371b3c9a1dcfa4dc636..416a1b86b7899fdb38400a85e3f340195c401c88 100644
--- a/ppapi/cpp/dev/video_capture_dev.h
+++ b/ppapi/cpp/dev/video_capture_dev.h
@@ -8,31 +8,27 @@
#include <vector>
#include "ppapi/c/dev/pp_video_capture_dev.h"
+#include "ppapi/cpp/completion_callback.h"
+#include "ppapi/cpp/dev/device_ref_dev.h"
#include "ppapi/cpp/resource.h"
namespace pp {
-class CompletionCallback;
-class DeviceRef_Dev;
class InstanceHandle;
class VideoCapture_Dev : public Resource {
public:
explicit VideoCapture_Dev(const InstanceHandle& instance);
VideoCapture_Dev(PP_Resource resource);
- VideoCapture_Dev(const VideoCapture_Dev& other);
virtual ~VideoCapture_Dev();
- VideoCapture_Dev& operator=(const VideoCapture_Dev& other);
-
// Returns true if the required interface is available.
static bool IsAvailable();
- // |devices| must stay alive until either this VideoCapture_Dev object goes
- // away or |callback| is run.
- int32_t EnumerateDevices(std::vector<DeviceRef_Dev>* devices,
- const CompletionCallback& callback);
+ int32_t EnumerateDevices(
+ const CompletionCallbackWithOutput<std::vector<DeviceRef_Dev> >&
+ callback);
int32_t Open(const DeviceRef_Dev& device_ref,
const PP_VideoCaptureDeviceInfo_Dev& requested_info,
uint32_t buffer_count,
@@ -43,16 +39,21 @@ class VideoCapture_Dev : public Resource {
void Close();
private:
- struct EnumerateDevicesState;
-
- void AbortEnumerateDevices();
-
- // |user_data| is an EnumerateDevicesState object. It is this method's
- // responsibility to delete it.
- static void OnEnumerateDevicesComplete(void* user_data, int32_t result);
-
- // Not owned by this object.
- EnumerateDevicesState* enum_state_;
+ // Heap-allocated data passed to the CallbackConverter for backward
+ // compatibility.
+ struct EnumerateCallbackData0_2 {
+ PP_Resource devices;
+ PP_ArrayOutput output;
+ PP_CompletionCallback original_callback;
+ };
+
+ // This is an adapter to convert the v0.2 EnumerateDevices oputput, which is a
+ // PPB_ResourceArray_Dev resource, to PP_ArrayOutput that the caller is
+ // expecting.
+ //
+ // This takes a heap-allocated EnumerateCallbackData0_2 struct passed as the
+ // user data and deletes it when the call completes.
+ static void CallbackConverter(void* user_data, int32_t result);
// Used to store the arguments of Open() when using the v0.1 interface.
PP_VideoCaptureDeviceInfo_Dev requested_info_;

Powered by Google App Engine
This is Rietveld 408576698