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}
diff --git a/webrtc/api/rtcstatscollector.cc b/webrtc/api/rtcstatscollector.cc
index cf97057..85113e6 100644
--- a/webrtc/api/rtcstatscollector.cc
+++ b/webrtc/api/rtcstatscollector.cc
@@ -425,17 +425,8 @@
// 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 @@
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 @@
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());
diff --git a/webrtc/api/rtcstatscollector.h b/webrtc/api/rtcstatscollector.h
index 4268a21..0a99ae9 100644
--- a/webrtc/api/rtcstatscollector.h
+++ b/webrtc/api/rtcstatscollector.h
@@ -82,7 +82,6 @@
// 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.
diff --git a/webrtc/api/rtcstatscollector_unittest.cc b/webrtc/api/rtcstatscollector_unittest.cc
index 8916136..749b3d5 100644
--- a/webrtc/api/rtcstatscollector_unittest.cc
+++ b/webrtc/api/rtcstatscollector_unittest.cc
@@ -396,15 +396,12 @@
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 @@
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 @@
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;
};