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

Side by Side Diff: webrtc/media/engine/webrtcvideocapturerfactory.cc

Issue 2685093002: Switching some interfaces to use std::unique_ptr<>. (Closed)
Patch Set: Rebase onto master Created 3 years, 10 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2004 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2004 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #include <memory> 11 #include <memory>
12 12
13 #include "webrtc/media/engine/webrtcvideocapturer.h" 13 #include "webrtc/media/engine/webrtcvideocapturer.h"
14 #include "webrtc/media/engine/webrtcvideocapturerfactory.h" 14 #include "webrtc/media/engine/webrtcvideocapturerfactory.h"
15 15
16 namespace cricket { 16 namespace cricket {
17 17
18 VideoCapturer* WebRtcVideoDeviceCapturerFactory::Create(const Device& device) { 18 std::unique_ptr<VideoCapturer> WebRtcVideoDeviceCapturerFactory::Create(
19 const Device& device) {
19 #ifdef HAVE_WEBRTC_VIDEO 20 #ifdef HAVE_WEBRTC_VIDEO
20 std::unique_ptr<WebRtcVideoCapturer> capturer( 21 std::unique_ptr<WebRtcVideoCapturer> capturer(
21 new WebRtcVideoCapturer()); 22 new WebRtcVideoCapturer());
22 if (!capturer->Init(device)) { 23 if (!capturer->Init(device)) {
23 return nullptr; 24 return std::unique_ptr<VideoCapturer>();
24 } 25 }
25 return capturer.release(); 26 return std::move(capturer);
26 #else 27 #else
27 return nullptr; 28 return std::unique_ptr<VideoCapturer>();
28 #endif 29 #endif
29 } 30 }
30 31
31 } // namespace cricket 32 } // namespace cricket
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698