Removed RTCStatsCollector::ProducePartialResultsOnWorkerThread.

No stats are collected by it, remove to reduce unnecessary thread hops.

BUG=webrtc:6875, chromium:627816

Review-Url: https://codereview.webrtc.org/2583193002
Cr-Commit-Position: refs/heads/master@{#15862}
This commit is contained in:
hbos 2017-01-02 04:28:51 -08:00 committed by Commit bot
parent 38fd1758e9
commit f415f8ae73
3 changed files with 3 additions and 41 deletions

View File

@ -425,17 +425,8 @@ void RTCStatsCollector::GetStatsReport(
// necessarily monotonically increasing.
int64_t timestamp_us = rtc::TimeUTCMicros();
num_pending_partial_reports_ = 3;
num_pending_partial_reports_ = 2;
partial_report_timestamp_us_ = cache_now_us;
invoker_.AsyncInvoke<void>(RTC_FROM_HERE, signaling_thread_,
rtc::Bind(&RTCStatsCollector::ProducePartialResultsOnSignalingThread,
rtc::scoped_refptr<RTCStatsCollector>(this), timestamp_us));
// TODO(hbos): No stats are gathered by
// |ProducePartialResultsOnWorkerThread|, remove it.
invoker_.AsyncInvoke<void>(RTC_FROM_HERE, worker_thread_,
rtc::Bind(&RTCStatsCollector::ProducePartialResultsOnWorkerThread,
rtc::scoped_refptr<RTCStatsCollector>(this), timestamp_us));
// Prepare |channel_names_| and |media_info_| for use in
// |ProducePartialResultsOnNetworkThread|.
@ -456,9 +447,11 @@ void RTCStatsCollector::GetStatsReport(
pc_->session()->data_channel()->transport_name()));
}
media_info_.reset(PrepareMediaInfo_s().release());
invoker_.AsyncInvoke<void>(RTC_FROM_HERE, network_thread_,
rtc::Bind(&RTCStatsCollector::ProducePartialResultsOnNetworkThread,
rtc::scoped_refptr<RTCStatsCollector>(this), timestamp_us));
ProducePartialResultsOnSignalingThread(timestamp_us);
}
}
@ -491,18 +484,6 @@ void RTCStatsCollector::ProducePartialResultsOnSignalingThread(
AddPartialResults(report);
}
void RTCStatsCollector::ProducePartialResultsOnWorkerThread(
int64_t timestamp_us) {
RTC_DCHECK(worker_thread_->IsCurrent());
rtc::scoped_refptr<RTCStatsReport> report = RTCStatsReport::Create(
timestamp_us);
// TODO(hbos): There are no stats to be gathered on this thread, remove this
// method.
AddPartialResults(report);
}
void RTCStatsCollector::ProducePartialResultsOnNetworkThread(
int64_t timestamp_us) {
RTC_DCHECK(network_thread_->IsCurrent());

View File

@ -82,7 +82,6 @@ class RTCStatsCollector : public virtual rtc::RefCountInterface,
// Stats gathering on a particular thread. Calls |AddPartialResults| before
// returning. Virtual for the sake of testing.
virtual void ProducePartialResultsOnSignalingThread(int64_t timestamp_us);
virtual void ProducePartialResultsOnWorkerThread(int64_t timestamp_us);
virtual void ProducePartialResultsOnNetworkThread(int64_t timestamp_us);
// Can be called on any thread.

View File

@ -396,15 +396,12 @@ class FakeRTCStatsCollector : public RTCStatsCollector,
if (!delivered_report_)
return false;
EXPECT_EQ(produced_on_signaling_thread_, 1);
EXPECT_EQ(produced_on_worker_thread_, 1);
EXPECT_EQ(produced_on_network_thread_, 1);
EXPECT_TRUE(delivered_report_->Get("SignalingThreadStats"));
EXPECT_TRUE(delivered_report_->Get("WorkerThreadStats"));
EXPECT_TRUE(delivered_report_->Get("NetworkThreadStats"));
produced_on_signaling_thread_ = 0;
produced_on_worker_thread_ = 0;
produced_on_network_thread_ = 0;
delivered_report_ = nullptr;
return true;
@ -434,20 +431,6 @@ class FakeRTCStatsCollector : public RTCStatsCollector,
new RTCTestStats("SignalingThreadStats", timestamp_us)));
AddPartialResults(signaling_report);
}
void ProducePartialResultsOnWorkerThread(int64_t timestamp_us) override {
EXPECT_TRUE(worker_thread_->IsCurrent());
{
rtc::CritScope cs(&lock_);
EXPECT_FALSE(delivered_report_);
++produced_on_worker_thread_;
}
rtc::scoped_refptr<RTCStatsReport> worker_report =
RTCStatsReport::Create(0);
worker_report->AddStats(std::unique_ptr<const RTCStats>(
new RTCTestStats("WorkerThreadStats", timestamp_us)));
AddPartialResults(worker_report);
}
void ProducePartialResultsOnNetworkThread(int64_t timestamp_us) override {
EXPECT_TRUE(network_thread_->IsCurrent());
{
@ -471,7 +454,6 @@ class FakeRTCStatsCollector : public RTCStatsCollector,
rtc::CriticalSection lock_;
rtc::scoped_refptr<const RTCStatsReport> delivered_report_;
int produced_on_signaling_thread_ = 0;
int produced_on_worker_thread_ = 0;
int produced_on_network_thread_ = 0;
};