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-Commit-Position: refs/heads/master@{#9370}
This commit is contained in:
Peter Boström 2015-06-04 15:18:17 +02:00
parent 491bd534ef
commit 26b08605e2
25 changed files with 83 additions and 227 deletions

View File

@ -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 @@ class AudioDeviceTest : public ::testing::Test {
return audio_manager()->GetDelayEstimateInMilliseconds();
}
scoped_refptr<AudioDeviceModule> audio_device() const {
rtc::scoped_refptr<AudioDeviceModule> audio_device() const {
return audio_device_;
}
@ -557,9 +557,9 @@ class AudioDeviceTest : public ::testing::Test {
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 @@ class AudioDeviceTest : public ::testing::Test {
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 @@ class AudioDeviceTest : public ::testing::Test {
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 @@ class AudioDeviceTest : public ::testing::Test {
}
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_;

View File

@ -4205,7 +4205,7 @@ int AudioDeviceWindowsCore::SetDMOProperties()
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 @@ int32_t AudioDeviceWindowsCore::_GetDefaultDeviceIndex(EDataFlow dir,
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);

View File

@ -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 @@ private: // WASAPI
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;

View File

@ -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 @@ class DesktopCaptureOptions {
#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 @@ class DesktopCaptureOptions {
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 @@ class DesktopCaptureOptions {
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 @@ class DesktopCaptureOptions {
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)

View File

@ -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 @@ class MouseCursorMonitorMac : public MouseCursorMonitor {
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_;
};

View File

@ -75,7 +75,7 @@ class MouseCursorMonitorX11 : public MouseCursorMonitor,
// 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_;

View File

@ -190,7 +190,7 @@ CGImageRef CreateExcludedWindowRegionImage(const DesktopRect& pixel_bounds,
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 @@ class ScreenCapturerMac : public ScreenCapturer {
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 @@ class InvertedDesktopFrame : public DesktopFrame {
};
ScreenCapturerMac::ScreenCapturerMac(
scoped_refptr<DesktopConfigurationMonitor> desktop_config_monitor)
rtc::scoped_refptr<DesktopConfigurationMonitor> desktop_config_monitor)
: callback_(NULL),
cgl_context_(NULL),
current_display_(0),

View File

@ -49,7 +49,7 @@ SharedDesktopFrame::~SharedDesktopFrame() {}
// 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 @@ bool SharedDesktopFrame::IsShared() {
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) {
}

View File

@ -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 @@ class SharedDesktopFrame : public DesktopFrame {
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);
};

View File

@ -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 @@ bool IsWindowValid(CGWindowID id) {
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 @@ class WindowCapturerMac : public WindowCapturer {
// 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) {

View File

@ -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 @@ class WindowCapturerLinux : public WindowCapturer,
Callback* callback_;
scoped_refptr<SharedXDisplay> x_display_;
rtc::scoped_refptr<SharedXDisplay> x_display_;
Atom wm_state_atom_;
Atom window_type_atom_;

View File

@ -27,7 +27,7 @@ SharedXDisplay::~SharedXDisplay() {
}
// 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 @@ scoped_refptr<SharedXDisplay> SharedXDisplay::Create(
}
// static
scoped_refptr<SharedXDisplay> SharedXDisplay::CreateDefault() {
rtc::scoped_refptr<SharedXDisplay> SharedXDisplay::CreateDefault() {
return Create(std::string());
}
@ -64,7 +64,7 @@ void SharedXDisplay::RemoveEventHandler(int type, XEventHandler* handler) {
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.

View File

@ -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 @@ class SharedXDisplay {
// 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() {

View File

@ -55,7 +55,7 @@ int32_t ForwardErrorCorrection::Packet::Release() {
// 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 @@ class FecPacket : public ForwardErrorCorrection::SortablePacket {
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(

View File

@ -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 @@ class ForwardErrorCorrection {
// 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 @@ class ForwardErrorCorrection {
// 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;

View File

@ -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;

View File

@ -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 @@ class VideoCaptureTest : public testing::Test {
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 @@ class VideoCaptureTest : public testing::Test {
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 @@ TEST_F(VideoCaptureTest, CreateDelete) {
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 @@ TEST_F(VideoCaptureTest, Capabilities) {
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 @@ TEST_F(VideoCaptureTest, DISABLED_TestTwoCameras) {
}
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 @@ TEST_F(VideoCaptureTest, DISABLED_TestTwoCameras) {
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 @@ class VideoCaptureExternalTest : public testing::Test {
}
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_;

View File

@ -32,7 +32,6 @@ static_library("system_wrappers") {
"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",

View File

@ -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_

View File

@ -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',

View File

@ -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 @@ class D3dRenderer : public VideoRenderer {
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

View File

@ -1400,7 +1400,7 @@ RtpRtcp* ViEChannel::rtp_rtcp() {
return rtp_rtcp_.get();
}
scoped_refptr<PayloadRouter> ViEChannel::send_payload_router() {
rtc::scoped_refptr<PayloadRouter> ViEChannel::send_payload_router() {
return send_payload_router_;
}

View File

@ -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 @@ class ViEChannel : public VCMFrameTypeCallback,
// 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 @@ class ViEChannel : public VCMFrameTypeCallback,
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_;

View File

@ -179,7 +179,7 @@ bool ViEEncoder::Init() {
}
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);

View File

@ -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 @@ class ViEEncoder
// 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 @@ class ViEEncoder
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_;