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

Unified Diff: media/capture/video/linux/v4l2_capture_delegate.h

Issue 2815643002: Make V4L2CaptureDelegate non-ref-counted (Closed)
Patch Set: Added weak pointer to V4L2CaptureDelegate Created 3 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: media/capture/video/linux/v4l2_capture_delegate.h
diff --git a/media/capture/video/linux/v4l2_capture_delegate.h b/media/capture/video/linux/v4l2_capture_delegate.h
index 82896bbcf0ac6e5ee42b9f318bc564a633673567..2f47ea96753070ca6842f91ba83eb95a1510642b 100644
--- a/media/capture/video/linux/v4l2_capture_delegate.h
+++ b/media/capture/video/linux/v4l2_capture_delegate.h
@@ -10,7 +10,6 @@
#include "base/files/scoped_file.h"
#include "base/macros.h"
-#include "base/memory/ref_counted.h"
#include "build/build_config.h"
#include "media/capture/video/video_capture_device.h"
@@ -29,9 +28,7 @@ namespace media {
// Class doing the actual Linux capture using V4L2 API. V4L2 SPLANE/MPLANE
// capture specifics are implemented in derived classes. Created and destroyed
// on the owner's thread, otherwise living and operating on |v4l2_task_runner_|.
chfremer 2017/04/12 17:13:46 No longer accurate. We are now destroying the inst
Chandan 2017/04/13 09:06:07 Done.
-// TODO(mcasas): Make this class a non-ref-counted.
-class CAPTURE_EXPORT V4L2CaptureDelegate final
- : public base::RefCountedThreadSafe<V4L2CaptureDelegate> {
+class CAPTURE_EXPORT V4L2CaptureDelegate final {
public:
// Retrieves the #planes for a given |fourcc|, or 0 if unknown.
static size_t GetNumPlanesForFourCc(uint32_t fourcc);
@@ -47,6 +44,7 @@ class CAPTURE_EXPORT V4L2CaptureDelegate final
const VideoCaptureDeviceDescriptor& device_descriptor,
const scoped_refptr<base::SingleThreadTaskRunner>& v4l2_task_runner,
int power_line_frequency);
+ ~V4L2CaptureDelegate();
// Forward-to versions of VideoCaptureDevice virtual methods.
void AllocateAndStart(int width,
@@ -67,9 +65,6 @@ class CAPTURE_EXPORT V4L2CaptureDelegate final
private:
friend class V4L2CaptureDelegateTest;
- friend class base::RefCountedThreadSafe<V4L2CaptureDelegate>;
- ~V4L2CaptureDelegate();
-
class BufferTracker;
// VIDIOC_QUERYBUFs a buffer from V4L2, creates a BufferTracker for it and
@@ -104,6 +99,8 @@ class CAPTURE_EXPORT V4L2CaptureDelegate final
// Clockwise rotation in degrees. This value should be 0, 90, 180, or 270.
int rotation_;
+ base::WeakPtrFactory<V4L2CaptureDelegate> weak_factory_;
+
DISALLOW_COPY_AND_ASSIGN(V4L2CaptureDelegate);
};

Powered by Google App Engine
This is Rietveld 408576698