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

Unified Diff: webrtc/modules/video_capture/linux/video_capture_linux.cc

Issue 1477013005: Replace RefCountImpl with rtc::RefCountedObject. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: add back explicit Release()s in test Created 4 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: webrtc/modules/video_capture/linux/video_capture_linux.cc
diff --git a/webrtc/modules/video_capture/linux/video_capture_linux.cc b/webrtc/modules/video_capture/linux/video_capture_linux.cc
index 13149dcafcd705637d04c3b0bbf8aabc1502904c..cee1355c0908f09227660ed1a844ef22bae13c7a 100644
--- a/webrtc/modules/video_capture/linux/video_capture_linux.cc
+++ b/webrtc/modules/video_capture/linux/video_capture_linux.cc
@@ -21,26 +21,22 @@
#include <iostream>
#include <new>
+#include "webrtc/base/refcount.h"
+#include "webrtc/base/scoped_ref_ptr.h"
#include "webrtc/modules/video_capture/linux/video_capture_linux.h"
#include "webrtc/system_wrappers/include/critical_section_wrapper.h"
-#include "webrtc/system_wrappers/include/ref_count.h"
#include "webrtc/system_wrappers/include/trace.h"
-namespace webrtc
-{
-namespace videocapturemodule
-{
-VideoCaptureModule* VideoCaptureImpl::Create(const int32_t id,
- const char* deviceUniqueId)
-{
- RefCountImpl<videocapturemodule::VideoCaptureModuleV4L2>* implementation =
- new RefCountImpl<videocapturemodule::VideoCaptureModuleV4L2>(id);
+namespace webrtc {
+namespace videocapturemodule {
+rtc::scoped_refptr<VideoCaptureModule> VideoCaptureImpl::Create(
+ const int32_t id,
+ const char* deviceUniqueId) {
+ rtc::scoped_refptr<VideoCaptureModuleV4L2> implementation(
+ new rtc::RefCountedObject<VideoCaptureModuleV4L2>(id));
- if (!implementation || implementation->Init(deviceUniqueId) != 0)
- {
- delete implementation;
- implementation = NULL;
- }
+ if (implementation->Init(deviceUniqueId) != 0)
+ return nullptr;
return implementation;
}
« no previous file with comments | « webrtc/modules/video_capture/linux/device_info_linux.cc ('k') | webrtc/modules/video_capture/mac/video_capture_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698