summaryrefslogtreecommitdiffstats
path: root/remoting
diff options
context:
space:
mode:
authorwez@chromium.org <wez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-20 02:32:24 +0000
committerwez@chromium.org <wez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-20 02:32:24 +0000
commitf908147003e37019ec6a4f12fd0fc334a9027355 (patch)
treef1cb39b3f0b0dc50dba501c54b35f92835a0e627 /remoting
parent238d5c33178e3d3cf6345754357670ba58e43ddf (diff)
downloadchromium_src-f908147003e37019ec6a4f12fd0fc334a9027355.zip
chromium_src-f908147003e37019ec6a4f12fd0fc334a9027355.tar.gz
chromium_src-f908147003e37019ec6a4f12fd0fc334a9027355.tar.bz2
Tweak VideoFrameCapturer::Create() to return a scoped_ptr.
Review URL: https://chromiumcodereview.appspot.com/11418053 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@168708 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting')
-rw-r--r--remoting/host/desktop_environment_factory.cc11
-rw-r--r--remoting/host/ipc_desktop_environment.cc2
-rw-r--r--remoting/host/video_frame_capturer.h2
-rw-r--r--remoting/host/video_frame_capturer_linux.cc12
-rw-r--r--remoting/host/video_frame_capturer_mac.mm12
-rw-r--r--remoting/host/video_frame_capturer_mac_unittest.cc2
-rw-r--r--remoting/host/video_frame_capturer_unittest.cc2
-rw-r--r--remoting/host/video_frame_capturer_win.cc4
8 files changed, 21 insertions, 26 deletions
diff --git a/remoting/host/desktop_environment_factory.cc b/remoting/host/desktop_environment_factory.cc
index d9944a4..f3299a9 100644
--- a/remoting/host/desktop_environment_factory.cc
+++ b/remoting/host/desktop_environment_factory.cc
@@ -25,12 +25,11 @@ DesktopEnvironmentFactory::~DesktopEnvironmentFactory() {
scoped_ptr<DesktopEnvironment> DesktopEnvironmentFactory::Create(
ClientSession* client) {
- scoped_ptr<AudioCapturer> audio_capturer = AudioCapturer::Create();
- scoped_ptr<EventExecutor> event_executor = EventExecutor::Create(
- input_task_runner_, ui_task_runner_);
- scoped_ptr<VideoFrameCapturer> video_capturer(VideoFrameCapturer::Create());
- return scoped_ptr<DesktopEnvironment>(new DesktopEnvironment(
- audio_capturer.Pass(), event_executor.Pass(), video_capturer.Pass()));
+ scoped_ptr<DesktopEnvironment> environment(new DesktopEnvironment(
+ AudioCapturer::Create(),
+ EventExecutor::Create(input_task_runner_, ui_task_runner_),
+ VideoFrameCapturer::Create()));
+ return environment.Pass();
}
bool DesktopEnvironmentFactory::SupportsAudioCapture() const {
diff --git a/remoting/host/ipc_desktop_environment.cc b/remoting/host/ipc_desktop_environment.cc
index 7ff4d98..9d52be7 100644
--- a/remoting/host/ipc_desktop_environment.cc
+++ b/remoting/host/ipc_desktop_environment.cc
@@ -30,7 +30,7 @@ IpcDesktopEnvironment::IpcDesktopEnvironment(
: DesktopEnvironment(
AudioCapturer::Create(),
EventExecutor::Create(input_task_runner, ui_task_runner),
- scoped_ptr<VideoFrameCapturer>(VideoFrameCapturer::Create())),
+ VideoFrameCapturer::Create()),
network_task_runner_(network_task_runner),
desktop_session_connector_(desktop_session_connector),
client_(client),
diff --git a/remoting/host/video_frame_capturer.h b/remoting/host/video_frame_capturer.h
index 7cc863e..8fdb4ce 100644
--- a/remoting/host/video_frame_capturer.h
+++ b/remoting/host/video_frame_capturer.h
@@ -69,7 +69,7 @@ class VideoFrameCapturer {
virtual ~VideoFrameCapturer() {}
// Create platform-specific capturer.
- static VideoFrameCapturer* Create();
+ static scoped_ptr<VideoFrameCapturer> Create();
#if defined(OS_LINUX)
// Set whether the VideoFrameCapturer should try to use X DAMAGE support if it
diff --git a/remoting/host/video_frame_capturer_linux.cc b/remoting/host/video_frame_capturer_linux.cc
index 945029f..39f5026 100644
--- a/remoting/host/video_frame_capturer_linux.cc
+++ b/remoting/host/video_frame_capturer_linux.cc
@@ -615,13 +615,11 @@ const SkISize& VideoFrameCapturerLinux::size_most_recent() const {
} // namespace
// static
-VideoFrameCapturer* VideoFrameCapturer::Create() {
- VideoFrameCapturerLinux* capturer = new VideoFrameCapturerLinux();
- if (!capturer->Init()) {
- delete capturer;
- capturer = NULL;
- }
- return capturer;
+scoped_ptr<VideoFrameCapturer> VideoFrameCapturer::Create() {
+ scoped_ptr<VideoFrameCapturerLinux> capturer(new VideoFrameCapturerLinux());
+ if (!capturer->Init())
+ capturer.reset();
+ return capturer.PassAs<VideoFrameCapturer>();
}
// static
diff --git a/remoting/host/video_frame_capturer_mac.mm b/remoting/host/video_frame_capturer_mac.mm
index c03b443..786cd78 100644
--- a/remoting/host/video_frame_capturer_mac.mm
+++ b/remoting/host/video_frame_capturer_mac.mm
@@ -813,13 +813,11 @@ void VideoFrameCapturerMac::DisplaysReconfiguredCallback(
} // namespace
// static
-VideoFrameCapturer* VideoFrameCapturer::Create() {
- VideoFrameCapturerMac* capturer = new VideoFrameCapturerMac();
- if (!capturer->Init()) {
- delete capturer;
- capturer = NULL;
- }
- return capturer;
+scoped_ptr<VideoFrameCapturer> VideoFrameCapturer::Create() {
+ scoped_ptr<VideoFrameCapturerMac> capturer(new VideoFrameCapturerMac());
+ if (!capturer->Init())
+ capturer.reset();
+ return capturer.PassAs<VideoFrameCapturer>();
}
} // namespace remoting
diff --git a/remoting/host/video_frame_capturer_mac_unittest.cc b/remoting/host/video_frame_capturer_mac_unittest.cc
index ced13dc..b4eaacf 100644
--- a/remoting/host/video_frame_capturer_mac_unittest.cc
+++ b/remoting/host/video_frame_capturer_mac_unittest.cc
@@ -41,7 +41,7 @@ class VideoFrameCapturerMacTest : public testing::Test {
protected:
virtual void SetUp() OVERRIDE {
- capturer_.reset(VideoFrameCapturer::Create());
+ capturer_ = VideoFrameCapturer::Create();
}
void AddDirtyRect() {
diff --git a/remoting/host/video_frame_capturer_unittest.cc b/remoting/host/video_frame_capturer_unittest.cc
index 0b10161..ccc4fdd 100644
--- a/remoting/host/video_frame_capturer_unittest.cc
+++ b/remoting/host/video_frame_capturer_unittest.cc
@@ -31,7 +31,7 @@ MATCHER(DirtyRegionIsNonEmptyRect, "") {
class VideoFrameCapturerTest : public testing::Test {
protected:
virtual void SetUp() OVERRIDE {
- capturer_.reset(VideoFrameCapturer::Create());
+ capturer_ = VideoFrameCapturer::Create();
}
scoped_ptr<VideoFrameCapturer> capturer_;
diff --git a/remoting/host/video_frame_capturer_win.cc b/remoting/host/video_frame_capturer_win.cc
index cfa0836..ad1a3a7 100644
--- a/remoting/host/video_frame_capturer_win.cc
+++ b/remoting/host/video_frame_capturer_win.cc
@@ -549,8 +549,8 @@ void VideoFrameCapturerWin::CaptureCursor() {
} // namespace
// static
-VideoFrameCapturer* VideoFrameCapturer::Create() {
- return new VideoFrameCapturerWin();
+scoped_ptr<VideoFrameCapturer> VideoFrameCapturer::Create() {
+ return scoped_ptr<VideoFrameCapturer>(new VideoFrameCapturerWin());
}
} // namespace remoting