Move internal PeerConnection methods to PeerConnectionInternal

PeerConnectionInternal is being introduced so that it can be mocked in
tests and so that a fake can be written for it to be used by stats
tests.

Bug: webrtc:8764
Change-Id: I375d12ce352523e8ac584402685a7870bc399fac
Reviewed-on: https://webrtc-review.googlesource.com/43202
Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
Commit-Queue: Steve Anton <steveanton@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#21747}
This commit is contained in:
Steve Anton
2018-01-23 16:38:46 -08:00
committed by Commit Bot
parent 194939b8ca
commit 2d8609c77e
13 changed files with 202 additions and 133 deletions

View File

@ -24,6 +24,7 @@
#include "call/call.h"
#include "media/base/mediachannel.h"
#include "pc/datachannel.h"
#include "pc/peerconnectioninternal.h"
#include "pc/trackmediainfomap.h"
#include "rtc_base/asyncinvoker.h"
#include "rtc_base/refcount.h"
@ -32,20 +33,8 @@
#include "rtc_base/sslidentity.h"
#include "rtc_base/timeutils.h"
namespace cricket {
class Candidate;
} // namespace cricket
namespace rtc {
class SSLCertificate;
} // namespace rtc
namespace webrtc {
class PeerConnection;
struct SessionStats;
struct ChannelNamePairs;
// All public methods of the collector are to be called on the signaling thread.
// Stats are gathered on the signaling, worker and network threads
// asynchronously. The callback is invoked on the signaling thread. Resulting
@ -54,7 +43,7 @@ class RTCStatsCollector : public virtual rtc::RefCountInterface,
public sigslot::has_slots<> {
public:
static rtc::scoped_refptr<RTCStatsCollector> Create(
PeerConnection* pc,
PeerConnectionInternal* pc,
int64_t cache_lifetime_us = 50 * rtc::kNumMicrosecsPerMillisec);
// Gets a recent stats report. If there is a report cached that is still fresh
@ -71,7 +60,7 @@ class RTCStatsCollector : public virtual rtc::RefCountInterface,
void WaitForPendingRequest();
protected:
RTCStatsCollector(PeerConnection* pc, int64_t cache_lifetime_us);
RTCStatsCollector(PeerConnectionInternal* pc, int64_t cache_lifetime_us);
~RTCStatsCollector();
// Stats gathering on a particular thread. Calls |AddPartialResults| before
@ -141,7 +130,7 @@ class RTCStatsCollector : public virtual rtc::RefCountInterface,
void OnDataChannelOpened(DataChannel* channel);
void OnDataChannelClosed(DataChannel* channel);
PeerConnection* const pc_;
PeerConnectionInternal* const pc_;
rtc::Thread* const signaling_thread_;
rtc::Thread* const worker_thread_;
rtc::Thread* const network_thread_;