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

Replace uses of WebRTCStatsResponse by RTCStatsResponse

... and RTCStatsResponseBase.

It is also possible to merge RTCStatsResponse and
RTCStatsResponseBase in a future step, once they
are both solely used in renderer/modules/peerconnection.
Today, there is still some code in renderer/platform using
RTCStatsResponseBase.

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

Change-Id: I788a81507447d990ca7d047d4a370f3bf8ec73d9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1930941
Commit-Queue: Antonio Gomes <tonikitoo@igalia.com>
Reviewed-by: default avatarGuido Urdaneta <guidou@chromium.org>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Cr-Commit-Position: refs/heads/master@{#718607}
parent b6989b50
...@@ -273,7 +273,6 @@ source_set("blink_headers") { ...@@ -273,7 +273,6 @@ source_set("blink_headers") {
"platform/web_rtc_rtp_transceiver.h", "platform/web_rtc_rtp_transceiver.h",
"platform/web_rtc_stats.h", "platform/web_rtc_stats.h",
"platform/web_rtc_stats_request.h", "platform/web_rtc_stats_request.h",
"platform/web_rtc_stats_response.h",
"platform/web_runtime_features.h", "platform/web_runtime_features.h",
"platform/web_scoped_page_pauser.h", "platform/web_scoped_page_pauser.h",
"platform/web_screen_info.h", "platform/web_screen_info.h",
......
...@@ -39,17 +39,17 @@ namespace blink { ...@@ -39,17 +39,17 @@ namespace blink {
class RTCStatsRequest; class RTCStatsRequest;
class WebMediaStreamTrack; class WebMediaStreamTrack;
class WebRTCStatsResponse; class RTCStatsResponseBase;
// The WebRTCStatsRequest class represents a JavaScript call on // The WebRTCStatsRequest class represents a JavaScript call on
// RTCPeerConnection.getStats(). The user of this API will use // RTCPeerConnection.getStats(). The user of this API will use
// the calls on this class and WebRTCStatsResponse to fill in the // the calls on this class and RTCStatsResponseBase to fill in the
// data that will be returned via a callback to the user in an // data that will be returned via a callback to the user in an
// RTCStatsResponse structure. // RTCStatsResponse structure.
// //
// The typical usage pattern is: // The typical usage pattern is:
// WebRTCStatsRequest request = <from somewhere> // WebRTCStatsRequest request = <from somewhere>
// WebRTCStatsResponse response = request.CreateResponse(); // RTCStatsResponseBase* response = request.CreateResponse();
// //
// For each item on which statistics are going to be reported: // For each item on which statistics are going to be reported:
// WebRTCLegacyStats stats(...); // WebRTCLegacyStats stats(...);
...@@ -81,9 +81,9 @@ class WebRTCStatsRequest { ...@@ -81,9 +81,9 @@ class WebRTCStatsRequest {
// It is only useful to call it when HasSelector() returns true. // It is only useful to call it when HasSelector() returns true.
BLINK_PLATFORM_EXPORT const WebMediaStreamTrack Component() const; BLINK_PLATFORM_EXPORT const WebMediaStreamTrack Component() const;
BLINK_PLATFORM_EXPORT void RequestSucceeded(const WebRTCStatsResponse&) const; BLINK_PLATFORM_EXPORT void RequestSucceeded(RTCStatsResponseBase*) const;
BLINK_PLATFORM_EXPORT WebRTCStatsResponse CreateResponse() const; BLINK_PLATFORM_EXPORT RTCStatsResponseBase* CreateResponse() const;
#if INSIDE_BLINK #if INSIDE_BLINK
BLINK_PLATFORM_EXPORT WebRTCStatsRequest(RTCStatsRequest*); BLINK_PLATFORM_EXPORT WebRTCStatsRequest(RTCStatsRequest*);
......
/*
* Copyright (C) 2012 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef THIRD_PARTY_BLINK_PUBLIC_PLATFORM_WEB_RTC_STATS_RESPONSE_H_
#define THIRD_PARTY_BLINK_PUBLIC_PLATFORM_WEB_RTC_STATS_RESPONSE_H_
#include "third_party/blink/public/platform/web_common.h"
#include "third_party/blink/public/platform/web_private_ptr.h"
#include "third_party/blink/public/platform/web_rtc_legacy_stats.h"
#include "third_party/blink/public/platform/web_string.h"
namespace blink {
class RTCStatsResponseBase;
class WebRTCStatsResponse {
public:
WebRTCStatsResponse(const WebRTCStatsResponse& other) { Assign(other); }
WebRTCStatsResponse() = default;
~WebRTCStatsResponse() { Reset(); }
WebRTCStatsResponse& operator=(const WebRTCStatsResponse& other) {
Assign(other);
return *this;
}
BLINK_PLATFORM_EXPORT void Assign(const WebRTCStatsResponse&);
BLINK_PLATFORM_EXPORT void Reset();
BLINK_PLATFORM_EXPORT void AddStats(const WebRTCLegacyStats&);
#if INSIDE_BLINK
BLINK_PLATFORM_EXPORT WebRTCStatsResponse(RTCStatsResponseBase*);
BLINK_PLATFORM_EXPORT operator RTCStatsResponseBase*() const;
#endif
private:
WebPrivatePtr<RTCStatsResponseBase> private_;
};
} // namespace blink
#endif // THIRD_PARTY_BLINK_PUBLIC_PLATFORM_WEB_RTC_STATS_RESPONSE_H_
...@@ -647,12 +647,12 @@ void LocalRTCStatsRequest::requestSucceeded( ...@@ -647,12 +647,12 @@ void LocalRTCStatsRequest::requestSucceeded(
} }
// Implementation of LocalRTCStatsResponse. // Implementation of LocalRTCStatsResponse.
blink::WebRTCStatsResponse LocalRTCStatsResponse::webKitStatsResponse() const { RTCStatsResponseBase* LocalRTCStatsResponse::webKitStatsResponse() const {
return impl_; return impl_;
} }
void LocalRTCStatsResponse::addStats(const blink::WebRTCLegacyStats& stats) { void LocalRTCStatsResponse::addStats(const blink::WebRTCLegacyStats& stats) {
impl_.AddStats(stats); impl_->AddStats(stats);
} }
// Processes the resulting state changes of a SetLocalDescription() or // Processes the resulting state changes of a SetLocalDescription() or
......
...@@ -21,13 +21,13 @@ ...@@ -21,13 +21,13 @@
#include "third_party/blink/public/platform/web_rtc_peer_connection_handler_client.h" #include "third_party/blink/public/platform/web_rtc_peer_connection_handler_client.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/public/platform/web_rtc_stats_request.h" #include "third_party/blink/public/platform/web_rtc_stats_request.h"
#include "third_party/blink/public/platform/web_rtc_stats_response.h"
#include "third_party/blink/renderer/modules/modules_export.h" #include "third_party/blink/renderer/modules/modules_export.h"
#include "third_party/blink/renderer/modules/peerconnection/media_stream_track_metrics.h" #include "third_party/blink/renderer/modules/peerconnection/media_stream_track_metrics.h"
#include "third_party/blink/renderer/modules/peerconnection/rtc_rtp_receiver_impl.h" #include "third_party/blink/renderer/modules/peerconnection/rtc_rtp_receiver_impl.h"
#include "third_party/blink/renderer/modules/peerconnection/rtc_rtp_sender_impl.h" #include "third_party/blink/renderer/modules/peerconnection/rtc_rtp_sender_impl.h"
#include "third_party/blink/renderer/modules/peerconnection/transceiver_state_surfacer.h" #include "third_party/blink/renderer/modules/peerconnection/transceiver_state_surfacer.h"
#include "third_party/blink/renderer/modules/peerconnection/webrtc_media_stream_track_adapter_map.h" #include "third_party/blink/renderer/modules/peerconnection/webrtc_media_stream_track_adapter_map.h"
#include "third_party/blink/renderer/platform/peerconnection/rtc_stats_response_base.h"
#include "third_party/webrtc/api/stats/rtc_stats.h" #include "third_party/webrtc/api/stats/rtc_stats.h"
#include "third_party/webrtc/api/stats/rtc_stats_collector_callback.h" #include "third_party/webrtc/api/stats/rtc_stats_collector_callback.h"
...@@ -42,13 +42,12 @@ class WebLocalFrame; ...@@ -42,13 +42,12 @@ class WebLocalFrame;
class WebRTCLegacyStats; class WebRTCLegacyStats;
class WebRTCPeerConnectionHandlerClient; class WebRTCPeerConnectionHandlerClient;
// Mockable wrapper for blink::WebRTCStatsResponse // Mockable wrapper for blink::RTCStatsResponseBase
class MODULES_EXPORT LocalRTCStatsResponse : public rtc::RefCountInterface { class MODULES_EXPORT LocalRTCStatsResponse : public rtc::RefCountInterface {
public: public:
explicit LocalRTCStatsResponse(const blink::WebRTCStatsResponse& impl) explicit LocalRTCStatsResponse(RTCStatsResponseBase* impl) : impl_(impl) {}
: impl_(impl) {}
virtual blink::WebRTCStatsResponse webKitStatsResponse() const; virtual RTCStatsResponseBase* webKitStatsResponse() const;
virtual void addStats(const blink::WebRTCLegacyStats& stats); virtual void addStats(const blink::WebRTCLegacyStats& stats);
protected: protected:
...@@ -57,7 +56,7 @@ class MODULES_EXPORT LocalRTCStatsResponse : public rtc::RefCountInterface { ...@@ -57,7 +56,7 @@ class MODULES_EXPORT LocalRTCStatsResponse : public rtc::RefCountInterface {
LocalRTCStatsResponse() {} LocalRTCStatsResponse() {}
private: private:
blink::WebRTCStatsResponse impl_; Persistent<RTCStatsResponseBase> impl_;
}; };
// Mockable wrapper for blink::WebRTCStatsRequest // Mockable wrapper for blink::WebRTCStatsRequest
......
...@@ -535,7 +535,6 @@ jumbo_component("platform") { ...@@ -535,7 +535,6 @@ jumbo_component("platform") {
"exported/web_rtc_rtp_transceiver.cc", "exported/web_rtc_rtp_transceiver.cc",
"exported/web_rtc_stats.cc", "exported/web_rtc_stats.cc",
"exported/web_rtc_stats_request.cc", "exported/web_rtc_stats_request.cc",
"exported/web_rtc_stats_response.cc",
"exported/web_runtime_features.cc", "exported/web_runtime_features.cc",
"exported/web_security_origin.cc", "exported/web_security_origin.cc",
"exported/web_string.cc", "exported/web_string.cc",
......
...@@ -32,7 +32,6 @@ ...@@ -32,7 +32,6 @@
#include "third_party/blink/public/platform/web_media_stream.h" #include "third_party/blink/public/platform/web_media_stream.h"
#include "third_party/blink/public/platform/web_media_stream_track.h" #include "third_party/blink/public/platform/web_media_stream_track.h"
#include "third_party/blink/public/platform/web_rtc_stats_response.h"
#include "third_party/blink/renderer/platform/peerconnection/rtc_stats_request.h" #include "third_party/blink/renderer/platform/peerconnection/rtc_stats_request.h"
#include "third_party/blink/renderer/platform/peerconnection/rtc_stats_response_base.h" #include "third_party/blink/renderer/platform/peerconnection/rtc_stats_response_base.h"
...@@ -49,8 +48,8 @@ void WebRTCStatsRequest::Reset() { ...@@ -49,8 +48,8 @@ void WebRTCStatsRequest::Reset() {
private_.Reset(); private_.Reset();
} }
WebRTCStatsResponse WebRTCStatsRequest::CreateResponse() const { RTCStatsResponseBase* WebRTCStatsRequest::CreateResponse() const {
return WebRTCStatsResponse(private_->CreateResponse()); return private_->CreateResponse();
} }
bool WebRTCStatsRequest::HasSelector() const { bool WebRTCStatsRequest::HasSelector() const {
...@@ -62,7 +61,7 @@ const WebMediaStreamTrack WebRTCStatsRequest::Component() const { ...@@ -62,7 +61,7 @@ const WebMediaStreamTrack WebRTCStatsRequest::Component() const {
} }
void WebRTCStatsRequest::RequestSucceeded( void WebRTCStatsRequest::RequestSucceeded(
const WebRTCStatsResponse& response) const { RTCStatsResponseBase* response) const {
private_->RequestSucceeded(response); private_->RequestSucceeded(response);
} }
......
/*
* Copyright (C) 2012 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "third_party/blink/public/platform/web_rtc_stats_response.h"
#include "third_party/blink/renderer/platform/peerconnection/rtc_stats_response_base.h"
#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"
namespace blink {
WebRTCStatsResponse::WebRTCStatsResponse(RTCStatsResponseBase* request)
: private_(request) {}
void WebRTCStatsResponse::Assign(const WebRTCStatsResponse& other) {
private_ = other.private_;
}
void WebRTCStatsResponse::Reset() {
private_.Reset();
}
WebRTCStatsResponse::operator RTCStatsResponseBase*() const {
return private_.Get();
}
void WebRTCStatsResponse::AddStats(const WebRTCLegacyStats& stats) {
DCHECK(!private_.IsNull());
private_->AddStats(stats);
}
} // namespace blink
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