Commit d1fc4cc3 authored by Antonio Gomes's avatar Antonio Gomes Committed by Commit Bot

Move webrtc_stats_report_obtainer.h out of the Blink API

Apart from the API footprint reduction, this CL also takes
the opportunity to rename the header (and its associated .cc file)
to test_webrtc_stats_report_obtainer.h, so it matches its purposes better.

BUG=787254, 919392
R=guidou@chromium.org, haraken@chromium.org

Change-Id: I3ac52d3a1e80c1d0612f705d77b59d49d881b1b0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1869410Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Reviewed-by: default avatarGuido Urdaneta <guidou@chromium.org>
Commit-Queue: Antonio Gomes <tonikitoo@igalia.com>
Cr-Commit-Position: refs/heads/master@{#707477}
parent fedabd26
...@@ -113,7 +113,6 @@ source_set("test_headers") { ...@@ -113,7 +113,6 @@ source_set("test_headers") {
"web/modules/peerconnection/mock_peer_connection_dependency_factory.h", "web/modules/peerconnection/mock_peer_connection_dependency_factory.h",
"web/modules/peerconnection/mock_peer_connection_impl.h", "web/modules/peerconnection/mock_peer_connection_impl.h",
"web/modules/peerconnection/mock_web_rtc_peer_connection_handler_client.h", "web/modules/peerconnection/mock_web_rtc_peer_connection_handler_client.h",
"web/modules/peerconnection/webrtc_stats_report_obtainer.h",
] ]
deps = [ deps = [
":blink_headers", ":blink_headers",
......
...@@ -11,7 +11,7 @@ include_rules = [ ...@@ -11,7 +11,7 @@ include_rules = [
] ]
specific_include_rules = { specific_include_rules = {
".*obtainer\.h|mock.*\.h": [ "mock.*\.h": [
"+base/run_loop.h", "+base/run_loop.h",
"+testing/gmock/include/gmock/gmock.h", "+testing/gmock/include/gmock/gmock.h",
], ],
......
...@@ -151,7 +151,8 @@ jumbo_source_set("test_support") { ...@@ -151,7 +151,8 @@ jumbo_source_set("test_support") {
"mock_peer_connection_dependency_factory.cc", "mock_peer_connection_dependency_factory.cc",
"mock_peer_connection_impl.cc", "mock_peer_connection_impl.cc",
"mock_web_rtc_peer_connection_handler_client.cc", "mock_web_rtc_peer_connection_handler_client.cc",
"webrtc_stats_report_obtainer.cc", "test_webrtc_stats_report_obtainer.cc",
"test_webrtc_stats_report_obtainer.h",
] ]
deps = [ deps = [
......
...@@ -21,7 +21,7 @@ include_rules = [ ...@@ -21,7 +21,7 @@ include_rules = [
] ]
specific_include_rules = { specific_include_rules = {
".*test\.cc" : [ ".*test.*": [
"+base/run_loop.h", "+base/run_loop.h",
"+base/test/bind_test_util.h", "+base/test/bind_test_util.h",
"+base/test/test_timeouts.h", "+base/test/test_timeouts.h",
......
...@@ -19,8 +19,8 @@ ...@@ -19,8 +19,8 @@
#include "third_party/blink/public/web/modules/peerconnection/mock_peer_connection_dependency_factory.h" #include "third_party/blink/public/web/modules/peerconnection/mock_peer_connection_dependency_factory.h"
#include "third_party/blink/public/web/modules/peerconnection/mock_peer_connection_impl.h" #include "third_party/blink/public/web/modules/peerconnection/mock_peer_connection_impl.h"
#include "third_party/blink/public/web/modules/peerconnection/webrtc_media_stream_track_adapter_map.h" #include "third_party/blink/public/web/modules/peerconnection/webrtc_media_stream_track_adapter_map.h"
#include "third_party/blink/public/web/modules/peerconnection/webrtc_stats_report_obtainer.h"
#include "third_party/blink/public/web/web_heap.h" #include "third_party/blink/public/web/web_heap.h"
#include "third_party/blink/renderer/modules/peerconnection/test_webrtc_stats_report_obtainer.h"
#include "third_party/blink/renderer/platform/testing/io_task_runner_testing_platform_support.h" #include "third_party/blink/renderer/platform/testing/io_task_runner_testing_platform_support.h"
#include "third_party/webrtc/api/stats/rtc_stats_report.h" #include "third_party/webrtc/api/stats/rtc_stats_report.h"
#include "third_party/webrtc/api/stats/rtcstats_objects.h" #include "third_party/webrtc/api/stats/rtcstats_objects.h"
...@@ -80,9 +80,9 @@ class RTCRtpReceiverImplTest : public ::testing::Test { ...@@ -80,9 +80,9 @@ class RTCRtpReceiverImplTest : public ::testing::Test {
std::move(state)); std::move(state));
} }
scoped_refptr<blink::WebRTCStatsReportObtainer> GetStats() { scoped_refptr<blink::TestWebRTCStatsReportObtainer> GetStats() {
scoped_refptr<blink::WebRTCStatsReportObtainer> obtainer = scoped_refptr<blink::TestWebRTCStatsReportObtainer> obtainer =
new blink::WebRTCStatsReportObtainer(); base::MakeRefCounted<TestWebRTCStatsReportObtainer>();
receiver_->GetStats(obtainer->GetStatsCallbackWrapper(), {}); receiver_->GetStats(obtainer->GetStatsCallbackWrapper(), {});
return obtainer; return obtainer;
} }
......
...@@ -22,8 +22,8 @@ ...@@ -22,8 +22,8 @@
#include "third_party/blink/public/web/modules/peerconnection/mock_peer_connection_dependency_factory.h" #include "third_party/blink/public/web/modules/peerconnection/mock_peer_connection_dependency_factory.h"
#include "third_party/blink/public/web/modules/peerconnection/mock_peer_connection_impl.h" #include "third_party/blink/public/web/modules/peerconnection/mock_peer_connection_impl.h"
#include "third_party/blink/public/web/modules/peerconnection/webrtc_media_stream_track_adapter_map.h" #include "third_party/blink/public/web/modules/peerconnection/webrtc_media_stream_track_adapter_map.h"
#include "third_party/blink/public/web/modules/peerconnection/webrtc_stats_report_obtainer.h"
#include "third_party/blink/public/web/web_heap.h" #include "third_party/blink/public/web/web_heap.h"
#include "third_party/blink/renderer/modules/peerconnection/test_webrtc_stats_report_obtainer.h"
#include "third_party/blink/renderer/platform/testing/io_task_runner_testing_platform_support.h" #include "third_party/blink/renderer/platform/testing/io_task_runner_testing_platform_support.h"
#include "third_party/webrtc/api/stats/rtc_stats_report.h" #include "third_party/webrtc/api/stats/rtc_stats_report.h"
#include "third_party/webrtc/api/stats/rtcstats_objects.h" #include "third_party/webrtc/api/stats/rtcstats_objects.h"
...@@ -118,9 +118,9 @@ class RTCRtpSenderImplTest : public ::testing::Test { ...@@ -118,9 +118,9 @@ class RTCRtpSenderImplTest : public ::testing::Test {
std::move(run_loop)); std::move(run_loop));
} }
scoped_refptr<blink::WebRTCStatsReportObtainer> CallGetStats() { scoped_refptr<blink::TestWebRTCStatsReportObtainer> CallGetStats() {
scoped_refptr<blink::WebRTCStatsReportObtainer> obtainer = scoped_refptr<blink::TestWebRTCStatsReportObtainer> obtainer =
new blink::WebRTCStatsReportObtainer(); base::MakeRefCounted<TestWebRTCStatsReportObtainer>();
sender_->GetStats(obtainer->GetStatsCallbackWrapper(), {}); sender_->GetStats(obtainer->GetStatsCallbackWrapper(), {});
return obtainer; return obtainer;
} }
......
...@@ -2,32 +2,32 @@ ...@@ -2,32 +2,32 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "third_party/blink/public/web/modules/peerconnection/webrtc_stats_report_obtainer.h" #include "third_party/blink/renderer/modules/peerconnection/test_webrtc_stats_report_obtainer.h"
#include "base/bind.h" #include "base/bind.h"
#include "base/callback.h" #include "base/callback.h"
namespace blink { namespace blink {
WebRTCStatsReportObtainer::WebRTCStatsReportObtainer() {} TestWebRTCStatsReportObtainer::TestWebRTCStatsReportObtainer() {}
WebRTCStatsReportObtainer::~WebRTCStatsReportObtainer() {} TestWebRTCStatsReportObtainer::~TestWebRTCStatsReportObtainer() {}
blink::WebRTCStatsReportCallback blink::WebRTCStatsReportCallback
WebRTCStatsReportObtainer::GetStatsCallbackWrapper() { TestWebRTCStatsReportObtainer::GetStatsCallbackWrapper() {
return base::BindOnce(&WebRTCStatsReportObtainer::OnStatsDelivered, this); return base::BindOnce(&TestWebRTCStatsReportObtainer::OnStatsDelivered, this);
} }
blink::WebRTCStatsReport* WebRTCStatsReportObtainer::report() const { blink::WebRTCStatsReport* TestWebRTCStatsReportObtainer::report() const {
return report_.get(); return report_.get();
} }
blink::WebRTCStatsReport* WebRTCStatsReportObtainer::WaitForReport() { blink::WebRTCStatsReport* TestWebRTCStatsReportObtainer::WaitForReport() {
run_loop_.Run(); run_loop_.Run();
return report_.get(); return report_.get();
} }
void WebRTCStatsReportObtainer::OnStatsDelivered( void TestWebRTCStatsReportObtainer::OnStatsDelivered(
std::unique_ptr<blink::WebRTCStatsReport> report) { std::unique_ptr<blink::WebRTCStatsReport> report) {
report_ = std::move(report); report_ = std::move(report);
run_loop_.Quit(); run_loop_.Quit();
......
...@@ -2,14 +2,14 @@ ...@@ -2,14 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef THIRD_PARTY_BLINK_PUBLIC_WEB_MODULES_PEERCONNECTION_WEBRTC_STATS_REPORT_OBTAINER_H_ #ifndef THIRD_PARTY_BLINK_RENDERER_MODULES_PEERCONNECTION_TEST_WEBRTC_STATS_REPORT_OBTAINER_H_
#define THIRD_PARTY_BLINK_PUBLIC_WEB_MODULES_PEERCONNECTION_WEBRTC_STATS_REPORT_OBTAINER_H_ #define THIRD_PARTY_BLINK_RENDERER_MODULES_PEERCONNECTION_TEST_WEBRTC_STATS_REPORT_OBTAINER_H_
#include <memory> #include <memory>
#include "base/memory/ref_counted.h"
#include "base/run_loop.h" #include "base/run_loop.h"
#include "third_party/blink/public/platform/web_rtc_stats.h" #include "third_party/blink/public/platform/web_rtc_stats.h"
#include "third_party/blink/renderer/platform/wtf/thread_safe_ref_counted.h"
namespace blink { namespace blink {
...@@ -20,13 +20,10 @@ namespace blink { ...@@ -20,13 +20,10 @@ namespace blink {
// thread are executed (see base::RunLoop::Run()) making it safe to wait on the // thread are executed (see base::RunLoop::Run()) making it safe to wait on the
// same thread that the stats report callback occurs on without blocking the // same thread that the stats report callback occurs on without blocking the
// callback. // callback.
// class TestWebRTCStatsReportObtainer
// TODO(crbug.com/787254): Move this class out of the Blink API : public WTF::ThreadSafeRefCounted<TestWebRTCStatsReportObtainer> {
// when all its clients get Onion souped.
class WebRTCStatsReportObtainer
: public base::RefCountedThreadSafe<WebRTCStatsReportObtainer> {
public: public:
WebRTCStatsReportObtainer(); TestWebRTCStatsReportObtainer();
blink::WebRTCStatsReportCallback GetStatsCallbackWrapper(); blink::WebRTCStatsReportCallback GetStatsCallbackWrapper();
...@@ -34,9 +31,9 @@ class WebRTCStatsReportObtainer ...@@ -34,9 +31,9 @@ class WebRTCStatsReportObtainer
blink::WebRTCStatsReport* WaitForReport(); blink::WebRTCStatsReport* WaitForReport();
private: private:
friend class base::RefCountedThreadSafe<WebRTCStatsReportObtainer>; friend class WTF::ThreadSafeRefCounted<TestWebRTCStatsReportObtainer>;
friend class CallbackWrapper; friend class CallbackWrapper;
virtual ~WebRTCStatsReportObtainer(); virtual ~TestWebRTCStatsReportObtainer();
void OnStatsDelivered(std::unique_ptr<blink::WebRTCStatsReport> report); void OnStatsDelivered(std::unique_ptr<blink::WebRTCStatsReport> report);
...@@ -46,4 +43,4 @@ class WebRTCStatsReportObtainer ...@@ -46,4 +43,4 @@ class WebRTCStatsReportObtainer
} // namespace blink } // namespace blink
#endif // THIRD_PARTY_BLINK_PUBLIC_WEB_MODULES_PEERCONNECTION_WEBRTC_STATS_REPORT_OBTAINER_H_ #endif // THIRD_PARTY_BLINK_RENDERER_MODULES_PEERCONNECTION_TEST_WEBRTC_STATS_REPORT_OBTAINER_H_
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment