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

Side by Side Diff: webrtc/pc/channelmanager.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 2004 The WebRTC project authors. All Rights Reserved. 2 * Copyright 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
(...skipping 10 matching lines...) Expand all
21 #include "webrtc/media/base/device.h" 21 #include "webrtc/media/base/device.h"
22 #include "webrtc/media/base/rtpdataengine.h" 22 #include "webrtc/media/base/rtpdataengine.h"
23 #include "webrtc/pc/srtpfilter.h" 23 #include "webrtc/pc/srtpfilter.h"
24 #include "webrtc/pc/mediacontroller.h" 24 #include "webrtc/pc/mediacontroller.h"
25 25
26 namespace cricket { 26 namespace cricket {
27 27
28 28
29 using rtc::Bind; 29 using rtc::Bind;
30 30
31 static DataEngineInterface* ConstructDataEngine() { 31 ChannelManager::ChannelManager(std::unique_ptr<MediaEngineInterface> me,
32 return new RtpDataEngine(); 32 std::unique_ptr<DataEngineInterface> dme,
33 rtc::Thread* thread) {
34 Construct(std::move(me), std::move(dme), thread, thread);
33 } 35 }
34 36
35 ChannelManager::ChannelManager(MediaEngineInterface* me, 37 ChannelManager::ChannelManager(std::unique_ptr<MediaEngineInterface> me,
36 DataEngineInterface* dme, 38 rtc::Thread* worker_thread,
37 rtc::Thread* thread) { 39 rtc::Thread* network_thread) {
38 Construct(me, dme, thread, thread); 40 Construct(std::move(me),
41 std::unique_ptr<DataEngineInterface>(new RtpDataEngine()),
42 worker_thread, network_thread);
39 } 43 }
40 44
41 ChannelManager::ChannelManager(MediaEngineInterface* me, 45 void ChannelManager::Construct(std::unique_ptr<MediaEngineInterface> me,
46 std::unique_ptr<DataEngineInterface> dme,
42 rtc::Thread* worker_thread, 47 rtc::Thread* worker_thread,
43 rtc::Thread* network_thread) { 48 rtc::Thread* network_thread) {
44 Construct(me, ConstructDataEngine(), worker_thread, network_thread); 49 media_engine_ = std::move(me);
45 } 50 data_media_engine_ = std::move(dme);
46
47 void ChannelManager::Construct(MediaEngineInterface* me,
48 DataEngineInterface* dme,
49 rtc::Thread* worker_thread,
50 rtc::Thread* network_thread) {
51 media_engine_.reset(me);
52 data_media_engine_.reset(dme);
53 initialized_ = false; 51 initialized_ = false;
54 main_thread_ = rtc::Thread::Current(); 52 main_thread_ = rtc::Thread::Current();
55 worker_thread_ = worker_thread; 53 worker_thread_ = worker_thread;
56 network_thread_ = network_thread; 54 network_thread_ = network_thread;
57 capturing_ = false; 55 capturing_ = false;
58 enable_rtx_ = false; 56 enable_rtx_ = false;
59 crypto_options_ = rtc::CryptoOptions::NoGcm(); 57 crypto_options_ = rtc::CryptoOptions::NoGcm();
60 } 58 }
61 59
62 ChannelManager::~ChannelManager() { 60 ChannelManager::~ChannelManager() {
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 media_engine_.get(), file, max_size_bytes)); 429 media_engine_.get(), file, max_size_bytes));
432 } 430 }
433 431
434 void ChannelManager::StopAecDump() { 432 void ChannelManager::StopAecDump() {
435 worker_thread_->Invoke<void>( 433 worker_thread_->Invoke<void>(
436 RTC_FROM_HERE, 434 RTC_FROM_HERE,
437 Bind(&MediaEngineInterface::StopAecDump, media_engine_.get())); 435 Bind(&MediaEngineInterface::StopAecDump, media_engine_.get()));
438 } 436 }
439 437
440 } // namespace cricket 438 } // namespace cricket
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698