Use one scoped_refptr.
Uses webrtc/base/scoped_ref_ptr.h and removes the copy in
system_wrappers.
BUG=
R=kwiberg@webrtc.org, tommi@webrtc.org
Review URL: https://codereview.webrtc.org/1152733005
Cr-Original-Commit-Position: refs/heads/master@{#9370}
Cr-Mirrored-From: https://chromium.googlesource.com/external/webrtc
Cr-Mirrored-Commit: 26b08605e2b99136fcc1cab0800234f469d6e236
diff --git a/modules/audio_device/android/audio_device_unittest.cc b/modules/audio_device/android/audio_device_unittest.cc
index e3d657d..8c00539 100644
--- a/modules/audio_device/android/audio_device_unittest.cc
+++ b/modules/audio_device/android/audio_device_unittest.cc
@@ -20,6 +20,7 @@
#include "webrtc/base/arraysize.h"
#include "webrtc/base/criticalsection.h"
#include "webrtc/base/scoped_ptr.h"
+#include "webrtc/base/scoped_ref_ptr.h"
#include "webrtc/modules/audio_device/android/audio_common.h"
#include "webrtc/modules/audio_device/android/audio_manager.h"
#include "webrtc/modules/audio_device/android/build_info.h"
@@ -28,7 +29,6 @@
#include "webrtc/modules/audio_device/include/audio_device.h"
#include "webrtc/system_wrappers/interface/clock.h"
#include "webrtc/system_wrappers/interface/event_wrapper.h"
-#include "webrtc/system_wrappers/interface/scoped_refptr.h"
#include "webrtc/system_wrappers/interface/sleep.h"
#include "webrtc/test/testsupport/fileutils.h"
@@ -536,7 +536,7 @@
return audio_manager()->GetDelayEstimateInMilliseconds();
}
- scoped_refptr<AudioDeviceModule> audio_device() const {
+ rtc::scoped_refptr<AudioDeviceModule> audio_device() const {
return audio_device_;
}
@@ -557,9 +557,9 @@
return audio_device_impl()->GetAudioDeviceBuffer();
}
- scoped_refptr<AudioDeviceModule> CreateAudioDevice(
+ rtc::scoped_refptr<AudioDeviceModule> CreateAudioDevice(
AudioDeviceModule::AudioLayer audio_layer) {
- scoped_refptr<AudioDeviceModule> module(
+ rtc::scoped_refptr<AudioDeviceModule> module(
AudioDeviceModuleImpl::Create(0, audio_layer));
return module;
}
@@ -594,7 +594,7 @@
int TestDelayOnAudioLayer(
const AudioDeviceModule::AudioLayer& layer_to_test) {
- scoped_refptr<AudioDeviceModule> audio_device;
+ rtc::scoped_refptr<AudioDeviceModule> audio_device;
audio_device = CreateAudioDevice(layer_to_test);
EXPECT_NE(audio_device.get(), nullptr);
AudioManager* audio_manager = GetAudioManager(audio_device.get());
@@ -604,7 +604,7 @@
AudioDeviceModule::AudioLayer TestActiveAudioLayer(
const AudioDeviceModule::AudioLayer& layer_to_test) {
- scoped_refptr<AudioDeviceModule> audio_device;
+ rtc::scoped_refptr<AudioDeviceModule> audio_device;
audio_device = CreateAudioDevice(layer_to_test);
EXPECT_NE(audio_device.get(), nullptr);
AudioDeviceModule::AudioLayer active;
@@ -685,7 +685,7 @@
}
rtc::scoped_ptr<EventWrapper> test_is_done_;
- scoped_refptr<AudioDeviceModule> audio_device_;
+ rtc::scoped_refptr<AudioDeviceModule> audio_device_;
AudioParameters playout_parameters_;
AudioParameters record_parameters_;
rtc::scoped_ptr<BuildInfo> build_info_;
diff --git a/modules/audio_device/win/audio_device_core_win.cc b/modules/audio_device/win/audio_device_core_win.cc
index f792a71..9931e9a 100644
--- a/modules/audio_device/win/audio_device_core_win.cc
+++ b/modules/audio_device/win/audio_device_core_win.cc
@@ -4205,7 +4205,7 @@
HRESULT hr = S_OK;
assert(_dmo != NULL);
- scoped_refptr<IPropertyStore> ps;
+ rtc::scoped_refptr<IPropertyStore> ps;
{
IPropertyStore* ptrPS = NULL;
hr = _dmo->QueryInterface(IID_IPropertyStore,
@@ -4638,7 +4638,7 @@
for (UINT i = 0; i < count; i++)
{
memset(szDeviceID, 0, sizeof(szDeviceID));
- scoped_refptr<IMMDevice> device;
+ rtc::scoped_refptr<IMMDevice> device;
{
IMMDevice* ptrDevice = NULL;
hr = collection->Item(i, &ptrDevice);
diff --git a/modules/audio_device/win/audio_device_core_win.h b/modules/audio_device/win/audio_device_core_win.h
index 7fe92ac..8d37006 100644
--- a/modules/audio_device/win/audio_device_core_win.h
+++ b/modules/audio_device/win/audio_device_core_win.h
@@ -24,8 +24,8 @@
#include <endpointvolume.h>
#include <mediaobj.h> // IMediaObject
+#include "webrtc/base/scoped_ref_ptr.h"
#include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
-#include "webrtc/system_wrappers/interface/scoped_refptr.h"
// Use Multimedia Class Scheduler Service (MMCSS) to boost the thread priority
#pragma comment( lib, "avrt.lib" )
@@ -296,8 +296,8 @@
ISimpleAudioVolume* _ptrRenderSimpleVolume;
// DirectX Media Object (DMO) for the built-in AEC.
- scoped_refptr<IMediaObject> _dmo;
- scoped_refptr<IMediaBuffer> _mediaBuffer;
+ rtc::scoped_refptr<IMediaObject> _dmo;
+ rtc::scoped_refptr<IMediaBuffer> _mediaBuffer;
bool _builtInAecEnabled;
HANDLE _hRenderSamplesReadyEvent;
diff --git a/modules/desktop_capture/desktop_capture_options.h b/modules/desktop_capture/desktop_capture_options.h
index 030cb2b..68bb588 100644
--- a/modules/desktop_capture/desktop_capture_options.h
+++ b/modules/desktop_capture/desktop_capture_options.h
@@ -11,7 +11,7 @@
#define WEBRTC_MODULES_DESKTOP_CAPTURE_DESKTOP_CAPTURE_OPTIONS_H_
#include "webrtc/base/constructormagic.h"
-#include "webrtc/system_wrappers/interface/scoped_refptr.h"
+#include "webrtc/base/scoped_ref_ptr.h"
#if defined(USE_X11)
#include "webrtc/modules/desktop_capture/x11/shared_x_display.h"
@@ -39,7 +39,7 @@
#if defined(USE_X11)
SharedXDisplay* x_display() const { return x_display_; }
- void set_x_display(scoped_refptr<SharedXDisplay> x_display) {
+ void set_x_display(rtc::scoped_refptr<SharedXDisplay> x_display) {
x_display_ = x_display;
}
#endif
@@ -48,7 +48,8 @@
DesktopConfigurationMonitor* configuration_monitor() const {
return configuration_monitor_;
}
- void set_configuration_monitor(scoped_refptr<DesktopConfigurationMonitor> m) {
+ void set_configuration_monitor(
+ rtc::scoped_refptr<DesktopConfigurationMonitor> m) {
configuration_monitor_ = m;
}
@@ -56,7 +57,7 @@
return full_screen_window_detector_;
}
void set_full_screen_chrome_window_detector(
- scoped_refptr<FullScreenChromeWindowDetector> detector) {
+ rtc::scoped_refptr<FullScreenChromeWindowDetector> detector) {
full_screen_window_detector_ = detector;
}
#endif
@@ -86,12 +87,13 @@
private:
#if defined(USE_X11)
- scoped_refptr<SharedXDisplay> x_display_;
+ rtc::scoped_refptr<SharedXDisplay> x_display_;
#endif
#if defined(WEBRTC_MAC) && !defined(WEBRTC_IOS)
- scoped_refptr<DesktopConfigurationMonitor> configuration_monitor_;
- scoped_refptr<FullScreenChromeWindowDetector> full_screen_window_detector_;
+ rtc::scoped_refptr<DesktopConfigurationMonitor> configuration_monitor_;
+ rtc::scoped_refptr<FullScreenChromeWindowDetector>
+ full_screen_window_detector_;
#endif
#if defined(WEBRTC_WIN)
diff --git a/modules/desktop_capture/mouse_cursor_monitor_mac.mm b/modules/desktop_capture/mouse_cursor_monitor_mac.mm
index 5a080fa..deda9ce 100644
--- a/modules/desktop_capture/mouse_cursor_monitor_mac.mm
+++ b/modules/desktop_capture/mouse_cursor_monitor_mac.mm
@@ -17,6 +17,7 @@
#include "webrtc/base/macutils.h"
#include "webrtc/base/scoped_ptr.h"
+#include "webrtc/base/scoped_ref_ptr.h"
#include "webrtc/modules/desktop_capture/desktop_capture_options.h"
#include "webrtc/modules/desktop_capture/desktop_frame.h"
#include "webrtc/modules/desktop_capture/mac/desktop_configuration.h"
@@ -24,7 +25,6 @@
#include "webrtc/modules/desktop_capture/mac/full_screen_chrome_window_detector.h"
#include "webrtc/modules/desktop_capture/mouse_cursor.h"
#include "webrtc/system_wrappers/interface/logging.h"
-#include "webrtc/system_wrappers/interface/scoped_refptr.h"
namespace webrtc {
@@ -47,13 +47,13 @@
void CaptureImage();
- scoped_refptr<DesktopConfigurationMonitor> configuration_monitor_;
+ rtc::scoped_refptr<DesktopConfigurationMonitor> configuration_monitor_;
CGWindowID window_id_;
ScreenId screen_id_;
Callback* callback_;
Mode mode_;
rtc::scoped_ptr<MouseCursor> last_cursor_;
- scoped_refptr<FullScreenChromeWindowDetector>
+ rtc::scoped_refptr<FullScreenChromeWindowDetector>
full_screen_chrome_window_detector_;
};
diff --git a/modules/desktop_capture/mouse_cursor_monitor_x11.cc b/modules/desktop_capture/mouse_cursor_monitor_x11.cc
index 9b3cc17..ae89587 100644
--- a/modules/desktop_capture/mouse_cursor_monitor_x11.cc
+++ b/modules/desktop_capture/mouse_cursor_monitor_x11.cc
@@ -75,7 +75,7 @@
// Captures current cursor shape and stores it in |cursor_shape_|.
void CaptureCursor();
- scoped_refptr<SharedXDisplay> x_display_;
+ rtc::scoped_refptr<SharedXDisplay> x_display_;
Callback* callback_;
Mode mode_;
Window window_;
diff --git a/modules/desktop_capture/screen_capturer_mac.mm b/modules/desktop_capture/screen_capturer_mac.mm
index 93e9a6f..ceb0781 100644
--- a/modules/desktop_capture/screen_capturer_mac.mm
+++ b/modules/desktop_capture/screen_capturer_mac.mm
@@ -190,7 +190,7 @@
class ScreenCapturerMac : public ScreenCapturer {
public:
explicit ScreenCapturerMac(
- scoped_refptr<DesktopConfigurationMonitor> desktop_config_monitor);
+ rtc::scoped_refptr<DesktopConfigurationMonitor> desktop_config_monitor);
virtual ~ScreenCapturerMac();
bool Init();
@@ -262,7 +262,7 @@
DesktopRegion last_invalid_region_;
// Monitoring display reconfiguration.
- scoped_refptr<DesktopConfigurationMonitor> desktop_config_monitor_;
+ rtc::scoped_refptr<DesktopConfigurationMonitor> desktop_config_monitor_;
// Power management assertion to prevent the screen from sleeping.
IOPMAssertionID power_assertion_id_display_;
@@ -307,7 +307,7 @@
};
ScreenCapturerMac::ScreenCapturerMac(
- scoped_refptr<DesktopConfigurationMonitor> desktop_config_monitor)
+ rtc::scoped_refptr<DesktopConfigurationMonitor> desktop_config_monitor)
: callback_(NULL),
cgl_context_(NULL),
current_display_(0),
diff --git a/modules/desktop_capture/shared_desktop_frame.cc b/modules/desktop_capture/shared_desktop_frame.cc
index 591b622..7651816 100644
--- a/modules/desktop_capture/shared_desktop_frame.cc
+++ b/modules/desktop_capture/shared_desktop_frame.cc
@@ -49,7 +49,7 @@
// static
SharedDesktopFrame* SharedDesktopFrame::Wrap(
DesktopFrame* desktop_frame) {
- scoped_refptr<Core> core(new Core(desktop_frame));
+ rtc::scoped_refptr<Core> core(new Core(desktop_frame));
return new SharedDesktopFrame(core);
}
@@ -69,9 +69,11 @@
return !core_->HasOneRef();
}
-SharedDesktopFrame::SharedDesktopFrame(scoped_refptr<Core> core)
- : DesktopFrame(core->frame()->size(), core->frame()->stride(),
- core->frame()->data(), core->frame()->shared_memory()),
+SharedDesktopFrame::SharedDesktopFrame(rtc::scoped_refptr<Core> core)
+ : DesktopFrame(core->frame()->size(),
+ core->frame()->stride(),
+ core->frame()->data(),
+ core->frame()->shared_memory()),
core_(core) {
}
diff --git a/modules/desktop_capture/shared_desktop_frame.h b/modules/desktop_capture/shared_desktop_frame.h
index d77cb15..12d373a 100644
--- a/modules/desktop_capture/shared_desktop_frame.h
+++ b/modules/desktop_capture/shared_desktop_frame.h
@@ -11,8 +11,8 @@
#ifndef WEBRTC_MODULES_DESKTOP_CAPTURE_SHARED_DESKTOP_FRAME_H_
#define WEBRTC_MODULES_DESKTOP_CAPTURE_SHARED_DESKTOP_FRAME_H_
+#include "webrtc/base/scoped_ref_ptr.h"
#include "webrtc/modules/desktop_capture/desktop_frame.h"
-#include "webrtc/system_wrappers/interface/scoped_refptr.h"
namespace webrtc {
@@ -37,9 +37,9 @@
private:
class Core;
- SharedDesktopFrame(scoped_refptr<Core> core);
+ SharedDesktopFrame(rtc::scoped_refptr<Core> core);
- scoped_refptr<Core> core_;
+ rtc::scoped_refptr<Core> core_;
DISALLOW_COPY_AND_ASSIGN(SharedDesktopFrame);
};
diff --git a/modules/desktop_capture/window_capturer_mac.mm b/modules/desktop_capture/window_capturer_mac.mm
index daa9fc7..3acca67 100644
--- a/modules/desktop_capture/window_capturer_mac.mm
+++ b/modules/desktop_capture/window_capturer_mac.mm
@@ -16,13 +16,13 @@
#include <CoreFoundation/CoreFoundation.h>
#include "webrtc/base/macutils.h"
+#include "webrtc/base/scoped_ref_ptr.h"
#include "webrtc/modules/desktop_capture/desktop_capture_options.h"
#include "webrtc/modules/desktop_capture/desktop_frame.h"
#include "webrtc/modules/desktop_capture/mac/desktop_configuration.h"
#include "webrtc/modules/desktop_capture/mac/full_screen_chrome_window_detector.h"
#include "webrtc/modules/desktop_capture/mac/window_list_utils.h"
#include "webrtc/system_wrappers/interface/logging.h"
-#include "webrtc/system_wrappers/interface/scoped_refptr.h"
#include "webrtc/system_wrappers/interface/tick_util.h"
namespace webrtc {
@@ -44,9 +44,8 @@
class WindowCapturerMac : public WindowCapturer {
public:
- explicit WindowCapturerMac(
- scoped_refptr<FullScreenChromeWindowDetector>
- full_screen_chrome_window_detector);
+ explicit WindowCapturerMac(rtc::scoped_refptr<FullScreenChromeWindowDetector>
+ full_screen_chrome_window_detector);
virtual ~WindowCapturerMac();
// WindowCapturer interface.
@@ -64,15 +63,14 @@
// The window being captured.
CGWindowID window_id_;
- scoped_refptr<FullScreenChromeWindowDetector>
+ rtc::scoped_refptr<FullScreenChromeWindowDetector>
full_screen_chrome_window_detector_;
DISALLOW_COPY_AND_ASSIGN(WindowCapturerMac);
};
-WindowCapturerMac::WindowCapturerMac(
- scoped_refptr<FullScreenChromeWindowDetector>
- full_screen_chrome_window_detector)
+WindowCapturerMac::WindowCapturerMac(rtc::scoped_refptr<
+ FullScreenChromeWindowDetector> full_screen_chrome_window_detector)
: callback_(NULL),
window_id_(0),
full_screen_chrome_window_detector_(full_screen_chrome_window_detector) {
diff --git a/modules/desktop_capture/window_capturer_x11.cc b/modules/desktop_capture/window_capturer_x11.cc
index 8dacd46..3568305 100755
--- a/modules/desktop_capture/window_capturer_x11.cc
+++ b/modules/desktop_capture/window_capturer_x11.cc
@@ -20,13 +20,13 @@
#include <algorithm>
#include "webrtc/base/scoped_ptr.h"
+#include "webrtc/base/scoped_ref_ptr.h"
#include "webrtc/modules/desktop_capture/desktop_capture_options.h"
#include "webrtc/modules/desktop_capture/desktop_frame.h"
#include "webrtc/modules/desktop_capture/x11/shared_x_display.h"
#include "webrtc/modules/desktop_capture/x11/x_error_trap.h"
#include "webrtc/modules/desktop_capture/x11/x_server_pixel_buffer.h"
#include "webrtc/system_wrappers/interface/logging.h"
-#include "webrtc/system_wrappers/interface/scoped_refptr.h"
namespace webrtc {
@@ -119,7 +119,7 @@
Callback* callback_;
- scoped_refptr<SharedXDisplay> x_display_;
+ rtc::scoped_refptr<SharedXDisplay> x_display_;
Atom wm_state_atom_;
Atom window_type_atom_;
diff --git a/modules/desktop_capture/x11/shared_x_display.cc b/modules/desktop_capture/x11/shared_x_display.cc
index 05b7f57..9383715 100644
--- a/modules/desktop_capture/x11/shared_x_display.cc
+++ b/modules/desktop_capture/x11/shared_x_display.cc
@@ -27,7 +27,7 @@
}
// static
-scoped_refptr<SharedXDisplay> SharedXDisplay::Create(
+rtc::scoped_refptr<SharedXDisplay> SharedXDisplay::Create(
const std::string& display_name) {
Display* display =
XOpenDisplay(display_name.empty() ? NULL : display_name.c_str());
@@ -39,7 +39,7 @@
}
// static
-scoped_refptr<SharedXDisplay> SharedXDisplay::CreateDefault() {
+rtc::scoped_refptr<SharedXDisplay> SharedXDisplay::CreateDefault() {
return Create(std::string());
}
@@ -64,7 +64,7 @@
void SharedXDisplay::ProcessPendingXEvents() {
// Hold reference to |this| to prevent it from being destroyed while
// processing events.
- scoped_refptr<SharedXDisplay> self(this);
+ rtc::scoped_refptr<SharedXDisplay> self(this);
// Find the number of events that are outstanding "now." We don't just loop
// on XPending because we want to guarantee this terminates.
diff --git a/modules/desktop_capture/x11/shared_x_display.h b/modules/desktop_capture/x11/shared_x_display.h
index 81b5ef6..11c5bf4 100644
--- a/modules/desktop_capture/x11/shared_x_display.h
+++ b/modules/desktop_capture/x11/shared_x_display.h
@@ -19,8 +19,8 @@
#include <string>
+#include "webrtc/base/scoped_ref_ptr.h"
#include "webrtc/system_wrappers/interface/atomic32.h"
-#include "webrtc/system_wrappers/interface/scoped_refptr.h"
namespace webrtc {
@@ -41,11 +41,12 @@
// Creates a new X11 Display for the |display_name|. NULL is returned if X11
// connection failed. Equivalent to CreateDefault() when |display_name| is
// empty.
- static scoped_refptr<SharedXDisplay> Create(const std::string& display_name);
+ static rtc::scoped_refptr<SharedXDisplay> Create(
+ const std::string& display_name);
// Creates X11 Display connection for the default display (e.g. specified in
// DISPLAY). NULL is returned if X11 connection failed.
- static scoped_refptr<SharedXDisplay> CreateDefault();
+ static rtc::scoped_refptr<SharedXDisplay> CreateDefault();
void AddRef() { ++ref_count_; }
void Release() {
diff --git a/modules/rtp_rtcp/source/forward_error_correction.cc b/modules/rtp_rtcp/source/forward_error_correction.cc
index abef1dd..a9e88a5 100644
--- a/modules/rtp_rtcp/source/forward_error_correction.cc
+++ b/modules/rtp_rtcp/source/forward_error_correction.cc
@@ -55,7 +55,7 @@
// TODO(holmer): Refactor into a proper class.
class ProtectedPacket : public ForwardErrorCorrection::SortablePacket {
public:
- scoped_refptr<ForwardErrorCorrection::Packet> pkt;
+ rtc::scoped_refptr<ForwardErrorCorrection::Packet> pkt;
};
typedef std::list<ProtectedPacket*> ProtectedPacketList;
@@ -68,7 +68,7 @@
public:
ProtectedPacketList protected_pkt_list;
uint32_t ssrc; // SSRC of the current frame.
- scoped_refptr<ForwardErrorCorrection::Packet> pkt;
+ rtc::scoped_refptr<ForwardErrorCorrection::Packet> pkt;
};
bool ForwardErrorCorrection::SortablePacket::LessThan(
diff --git a/modules/rtp_rtcp/source/forward_error_correction.h b/modules/rtp_rtcp/source/forward_error_correction.h
index a3b3fa0..c6f2738 100644
--- a/modules/rtp_rtcp/source/forward_error_correction.h
+++ b/modules/rtp_rtcp/source/forward_error_correction.h
@@ -14,9 +14,9 @@
#include <list>
#include <vector>
+#include "webrtc/base/scoped_ref_ptr.h"
#include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp_defines.h"
#include "webrtc/system_wrappers/interface/ref_count.h"
-#include "webrtc/system_wrappers/interface/scoped_refptr.h"
#include "webrtc/typedefs.h"
namespace webrtc {
@@ -92,7 +92,7 @@
// packets, but not required for media packets.
bool is_fec; // Set to true if this is an FEC packet and false
// otherwise.
- scoped_refptr<Packet> pkt; // Pointer to the packet storage.
+ rtc::scoped_refptr<Packet> pkt; // Pointer to the packet storage.
};
// The recovered list parameter of #DecodeFEC() will reference structs of
@@ -110,7 +110,7 @@
// caller through the callback.
uint8_t length_recovery[2]; // Two bytes used for recovering the packet
// length with XOR operations.
- scoped_refptr<Packet> pkt; // Pointer to the packet storage.
+ rtc::scoped_refptr<Packet> pkt; // Pointer to the packet storage.
};
typedef std::list<Packet*> PacketList;
diff --git a/modules/video_capture/ios/video_capture_ios.mm b/modules/video_capture/ios/video_capture_ios.mm
index e9c7763..b36b0d4 100644
--- a/modules/video_capture/ios/video_capture_ios.mm
+++ b/modules/video_capture/ios/video_capture_ios.mm
@@ -15,7 +15,6 @@
#include "webrtc/modules/video_capture/ios/device_info_ios_objc.h"
#include "webrtc/modules/video_capture/ios/rtc_video_capture_ios_objc.h"
#include "webrtc/system_wrappers/interface/ref_count.h"
-#include "webrtc/system_wrappers/interface/scoped_refptr.h"
#include "webrtc/system_wrappers/interface/trace.h"
using namespace webrtc;
diff --git a/modules/video_capture/test/video_capture_unittest.cc b/modules/video_capture/test/video_capture_unittest.cc
index 63676a1..6d9b112 100644
--- a/modules/video_capture/test/video_capture_unittest.cc
+++ b/modules/video_capture/test/video_capture_unittest.cc
@@ -15,13 +15,13 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "webrtc/base/scoped_ptr.h"
+#include "webrtc/base/scoped_ref_ptr.h"
#include "webrtc/common_video/libyuv/include/webrtc_libyuv.h"
#include "webrtc/modules/utility/interface/process_thread.h"
#include "webrtc/modules/video_capture/ensure_initialized.h"
#include "webrtc/modules/video_capture/include/video_capture.h"
#include "webrtc/modules/video_capture/include/video_capture_factory.h"
#include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
-#include "webrtc/system_wrappers/interface/scoped_refptr.h"
#include "webrtc/system_wrappers/interface/sleep.h"
#include "webrtc/system_wrappers/interface/tick_util.h"
#include "webrtc/test/testsupport/gtest_disable.h"
@@ -242,7 +242,7 @@
ASSERT_GT(number_of_devices_, 0u);
}
- webrtc::scoped_refptr<VideoCaptureModule> OpenVideoCaptureDevice(
+ rtc::scoped_refptr<VideoCaptureModule> OpenVideoCaptureDevice(
unsigned int device,
VideoCaptureDataCallback* callback) {
char device_name[256];
@@ -251,7 +251,7 @@
EXPECT_EQ(0, device_info_->GetDeviceName(
device, device_name, 256, unique_name, 256));
- webrtc::scoped_refptr<VideoCaptureModule> module(
+ rtc::scoped_refptr<VideoCaptureModule> module(
VideoCaptureFactory::Create(device, unique_name));
if (module.get() == NULL)
return NULL;
@@ -281,8 +281,8 @@
for (int i = 0; i < 5; ++i) {
int64_t start_time = TickTime::MillisecondTimestamp();
TestVideoCaptureCallback capture_observer;
- webrtc::scoped_refptr<VideoCaptureModule> module(OpenVideoCaptureDevice(
- 0, &capture_observer));
+ rtc::scoped_refptr<VideoCaptureModule> module(
+ OpenVideoCaptureDevice(0, &capture_observer));
ASSERT_TRUE(module.get() != NULL);
VideoCaptureCapability capability;
@@ -322,8 +322,8 @@
TestVideoCaptureCallback capture_observer;
- webrtc::scoped_refptr<VideoCaptureModule> module(OpenVideoCaptureDevice(
- 0, &capture_observer));
+ rtc::scoped_refptr<VideoCaptureModule> module(
+ OpenVideoCaptureDevice(0, &capture_observer));
ASSERT_TRUE(module.get() != NULL);
int number_of_capabilities = device_info_->NumberOfCapabilities(
@@ -384,8 +384,8 @@
}
TestVideoCaptureCallback capture_observer1;
- webrtc::scoped_refptr<VideoCaptureModule> module1(OpenVideoCaptureDevice(
- 0, &capture_observer1));
+ rtc::scoped_refptr<VideoCaptureModule> module1(
+ OpenVideoCaptureDevice(0, &capture_observer1));
ASSERT_TRUE(module1.get() != NULL);
VideoCaptureCapability capability1;
#ifndef WEBRTC_MAC
@@ -399,8 +399,8 @@
capture_observer1.SetExpectedCapability(capability1);
TestVideoCaptureCallback capture_observer2;
- webrtc::scoped_refptr<VideoCaptureModule> module2(OpenVideoCaptureDevice(
- 1, &capture_observer2));
+ rtc::scoped_refptr<VideoCaptureModule> module2(
+ OpenVideoCaptureDevice(1, &capture_observer2));
ASSERT_TRUE(module1.get() != NULL);
@@ -460,7 +460,7 @@
}
webrtc::VideoCaptureExternal* capture_input_interface_;
- webrtc::scoped_refptr<VideoCaptureModule> capture_module_;
+ rtc::scoped_refptr<VideoCaptureModule> capture_module_;
rtc::scoped_ptr<webrtc::ProcessThread> process_module_;
webrtc::VideoFrame test_frame_;
TestVideoCaptureCallback capture_callback_;
diff --git a/system_wrappers/BUILD.gn b/system_wrappers/BUILD.gn
index 6d16ac2..0657e20 100644
--- a/system_wrappers/BUILD.gn
+++ b/system_wrappers/BUILD.gn
@@ -32,7 +32,6 @@
"interface/ref_count.h",
"interface/rtp_to_ntp.h",
"interface/rw_lock_wrapper.h",
- "interface/scoped_refptr.h",
"interface/scoped_vector.h",
"interface/sleep.h",
"interface/sort.h",
diff --git a/system_wrappers/interface/scoped_refptr.h b/system_wrappers/interface/scoped_refptr.h
deleted file mode 100644
index b344d21..0000000
--- a/system_wrappers/interface/scoped_refptr.h
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef SYSTEM_WRAPPERS_INTERFACE_SCOPED_REFPTR_H_
-#define SYSTEM_WRAPPERS_INTERFACE_SCOPED_REFPTR_H_
-
-#include <stddef.h>
-
-namespace webrtc {
-
-// Extracted from Chromium's src/base/memory/ref_counted.h.
-
-//
-// A smart pointer class for reference counted objects. Use this class instead
-// of calling AddRef and Release manually on a reference counted object to
-// avoid common memory leaks caused by forgetting to Release an object
-// reference. Sample usage:
-//
-// class MyFoo : public RefCounted<MyFoo> {
-// ...
-// };
-//
-// void some_function() {
-// scoped_refptr<MyFoo> foo = new MyFoo();
-// foo->Method(param);
-// // |foo| is released when this function returns
-// }
-//
-// void some_other_function() {
-// scoped_refptr<MyFoo> foo = new MyFoo();
-// ...
-// foo = NULL; // explicitly releases |foo|
-// ...
-// if (foo)
-// foo->Method(param);
-// }
-//
-// The above examples show how scoped_refptr<T> acts like a pointer to T.
-// Given two scoped_refptr<T> classes, it is also possible to exchange
-// references between the two objects, like so:
-//
-// {
-// scoped_refptr<MyFoo> a = new MyFoo();
-// scoped_refptr<MyFoo> b;
-//
-// b.swap(a);
-// // now, |b| references the MyFoo object, and |a| references NULL.
-// }
-//
-// To make both |a| and |b| in the above example reference the same MyFoo
-// object, simply use the assignment operator:
-//
-// {
-// scoped_refptr<MyFoo> a = new MyFoo();
-// scoped_refptr<MyFoo> b;
-//
-// b = a;
-// // now, |a| and |b| each own a reference to the same MyFoo object.
-// }
-//
-template <class T>
-class scoped_refptr {
- public:
- scoped_refptr() : ptr_(NULL) {
- }
-
- scoped_refptr(T* p) : ptr_(p) {
- if (ptr_)
- ptr_->AddRef();
- }
-
- scoped_refptr(const scoped_refptr<T>& r) : ptr_(r.ptr_) {
- if (ptr_)
- ptr_->AddRef();
- }
-
- template <typename U>
- scoped_refptr(const scoped_refptr<U>& r) : ptr_(r.get()) {
- if (ptr_)
- ptr_->AddRef();
- }
-
- ~scoped_refptr() {
- if (ptr_)
- ptr_->Release();
- }
-
- T* get() const { return ptr_; }
- operator T*() const { return ptr_; }
- T* operator->() const { return ptr_; }
-
- // Release a pointer.
- // The return value is the current pointer held by this object.
- // If this object holds a NULL pointer, the return value is NULL.
- // After this operation, this object will hold a NULL pointer,
- // and will not own the object any more.
- T* release() {
- T* retVal = ptr_;
- ptr_ = NULL;
- return retVal;
- }
-
- scoped_refptr<T>& operator=(T* p) {
- // AddRef first so that self assignment should work
- if (p)
- p->AddRef();
- if (ptr_ )
- ptr_->Release();
- ptr_ = p;
- return *this;
- }
-
- scoped_refptr<T>& operator=(const scoped_refptr<T>& r) {
- return *this = r.ptr_;
- }
-
- template <typename U>
- scoped_refptr<T>& operator=(const scoped_refptr<U>& r) {
- return *this = r.get();
- }
-
- void swap(T** pp) {
- T* p = ptr_;
- ptr_ = *pp;
- *pp = p;
- }
-
- void swap(scoped_refptr<T>& r) {
- swap(&r.ptr_);
- }
-
- protected:
- T* ptr_;
-};
-} // namespace webrtc
-
-#endif // SYSTEM_WRAPPERS_INTERFACE_SCOPED_REFPTR_H_
diff --git a/system_wrappers/system_wrappers.gyp b/system_wrappers/system_wrappers.gyp
index a466741..02e9305 100644
--- a/system_wrappers/system_wrappers.gyp
+++ b/system_wrappers/system_wrappers.gyp
@@ -39,7 +39,6 @@
'interface/ref_count.h',
'interface/rtp_to_ntp.h',
'interface/rw_lock_wrapper.h',
- 'interface/scoped_refptr.h',
'interface/scoped_vector.h',
'interface/sleep.h',
'interface/sort.h',
diff --git a/test/win/d3d_renderer.h b/test/win/d3d_renderer.h
index c3b728b..46ce266 100644
--- a/test/win/d3d_renderer.h
+++ b/test/win/d3d_renderer.h
@@ -14,7 +14,7 @@
#include <d3d9.h>
#pragma comment(lib, "d3d9.lib") // located in DirectX SDK
-#include "webrtc/system_wrappers/interface/scoped_refptr.h"
+#include "webrtc/base/scoped_ref_ptr.h"
#include "webrtc/test/video_renderer.h"
#include "webrtc/typedefs.h"
@@ -42,11 +42,11 @@
size_t width_, height_;
HWND hwnd_;
- scoped_refptr<IDirect3D9> d3d_;
- scoped_refptr<IDirect3DDevice9> d3d_device_;
+ rtc::scoped_refptr<IDirect3D9> d3d_;
+ rtc::scoped_refptr<IDirect3DDevice9> d3d_device_;
- scoped_refptr<IDirect3DTexture9> texture_;
- scoped_refptr<IDirect3DVertexBuffer9> vertex_buffer_;
+ rtc::scoped_refptr<IDirect3DTexture9> texture_;
+ rtc::scoped_refptr<IDirect3DVertexBuffer9> vertex_buffer_;
};
} // namespace test
} // namespace webrtc
diff --git a/video_engine/vie_channel.cc b/video_engine/vie_channel.cc
index c66f5d6..b83ef32 100644
--- a/video_engine/vie_channel.cc
+++ b/video_engine/vie_channel.cc
@@ -1400,7 +1400,7 @@
return rtp_rtcp_.get();
}
-scoped_refptr<PayloadRouter> ViEChannel::send_payload_router() {
+rtc::scoped_refptr<PayloadRouter> ViEChannel::send_payload_router() {
return send_payload_router_;
}
diff --git a/video_engine/vie_channel.h b/video_engine/vie_channel.h
index 4b4a73e..39dc4d0 100644
--- a/video_engine/vie_channel.h
+++ b/video_engine/vie_channel.h
@@ -14,12 +14,12 @@
#include <list>
#include "webrtc/base/scoped_ptr.h"
+#include "webrtc/base/scoped_ref_ptr.h"
#include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimator.h"
#include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp.h"
#include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp_defines.h"
#include "webrtc/modules/video_coding/main/interface/video_coding_defines.h"
#include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
-#include "webrtc/system_wrappers/interface/scoped_refptr.h"
#include "webrtc/system_wrappers/interface/tick_util.h"
#include "webrtc/typedefs.h"
#include "webrtc/video_engine/vie_defines.h"
@@ -286,7 +286,7 @@
// Gets the modules used by the channel.
RtpRtcp* rtp_rtcp();
- scoped_refptr<PayloadRouter> send_payload_router();
+ rtc::scoped_refptr<PayloadRouter> send_payload_router();
VCMProtectionCallback* vcm_protection_callback();
@@ -476,7 +476,7 @@
rtc::scoped_ptr<RtpRtcp> rtp_rtcp_;
std::list<RtpRtcp*> simulcast_rtp_rtcp_;
std::list<RtpRtcp*> removed_rtp_rtcp_;
- scoped_refptr<PayloadRouter> send_payload_router_;
+ rtc::scoped_refptr<PayloadRouter> send_payload_router_;
rtc::scoped_ptr<ViEChannelProtectionCallback> vcm_protection_callback_;
VideoCodingModule* const vcm_;
diff --git a/video_engine/vie_encoder.cc b/video_engine/vie_encoder.cc
index 2787e09..597b311 100644
--- a/video_engine/vie_encoder.cc
+++ b/video_engine/vie_encoder.cc
@@ -179,7 +179,7 @@
}
void ViEEncoder::StartThreadsAndSetSharedMembers(
- scoped_refptr<PayloadRouter> send_payload_router,
+ rtc::scoped_refptr<PayloadRouter> send_payload_router,
VCMProtectionCallback* vcm_protection_callback) {
DCHECK(send_payload_router_ == NULL);
diff --git a/video_engine/vie_encoder.h b/video_engine/vie_encoder.h
index 43bedb0..26dd810 100644
--- a/video_engine/vie_encoder.h
+++ b/video_engine/vie_encoder.h
@@ -15,16 +15,16 @@
#include <vector>
#include "webrtc/base/scoped_ptr.h"
+#include "webrtc/base/scoped_ref_ptr.h"
#include "webrtc/base/thread_annotations.h"
#include "webrtc/common_types.h"
+#include "webrtc/frame_callback.h"
#include "webrtc/modules/bitrate_controller/include/bitrate_allocator.h"
#include "webrtc/modules/bitrate_controller/include/bitrate_controller.h"
#include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp_defines.h"
#include "webrtc/modules/video_coding/main/interface/video_coding_defines.h"
#include "webrtc/modules/video_processing/main/interface/video_processing.h"
#include "webrtc/typedefs.h"
-#include "webrtc/frame_callback.h"
-#include "webrtc/system_wrappers/interface/scoped_refptr.h"
#include "webrtc/video_engine/vie_capturer.h"
#include "webrtc/video_engine/vie_defines.h"
@@ -89,7 +89,7 @@
// Ideally this would be done in Init, but the dependencies between ViEEncoder
// and ViEChannel makes it really hard to do in a good way.
void StartThreadsAndSetSharedMembers(
- scoped_refptr<PayloadRouter> send_payload_router,
+ rtc::scoped_refptr<PayloadRouter> send_payload_router,
VCMProtectionCallback* vcm_protection_callback);
// This function must be called before the corresponding ViEChannel is
@@ -200,7 +200,7 @@
const rtc::scoped_ptr<VideoProcessingModule> vpm_;
const rtc::scoped_ptr<QMVideoSettingsCallback> qm_callback_;
const rtc::scoped_ptr<VideoCodingModule> vcm_;
- scoped_refptr<PayloadRouter> send_payload_router_;
+ rtc::scoped_refptr<PayloadRouter> send_payload_router_;
rtc::scoped_ptr<CriticalSectionWrapper> callback_cs_;
rtc::scoped_ptr<CriticalSectionWrapper> data_cs_;