Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(381)

Unified Diff: third_party/WebKit/Source/modules/mediastream/RTCPeerConnection.cpp

Issue 2095643002: Add RTCPeerConnection RAPPOR metrics. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/modules/mediastream/RTCPeerConnection.cpp
diff --git a/third_party/WebKit/Source/modules/mediastream/RTCPeerConnection.cpp b/third_party/WebKit/Source/modules/mediastream/RTCPeerConnection.cpp
index 1c63506d55dc2271ff042304b52afe6372f0c1d6..8833e93f3918c5bba84e86f3a0e7500fb5703841 100644
--- a/third_party/WebKit/Source/modules/mediastream/RTCPeerConnection.cpp
+++ b/third_party/WebKit/Source/modules/mediastream/RTCPeerConnection.cpp
@@ -46,6 +46,7 @@
#include "core/dom/Document.h"
#include "core/dom/ExceptionCode.h"
#include "core/dom/ExecutionContext.h"
+#include "core/frame/HostsUsingFeatures.h"
#include "core/frame/LocalFrame.h"
#include "core/frame/UseCounter.h"
#include "core/html/VoidCallback.h"
@@ -395,6 +396,9 @@ DEFINE_TRACE(RTCPeerConnection::EventWrapper)
RTCPeerConnection* RTCPeerConnection::create(ExecutionContext* context, const Dictionary& rtcConfiguration, const Dictionary& mediaConstraints, ExceptionState& exceptionState)
{
+ Document* document = toDocument(context);
+ HostsUsingFeatures::countAnyWorld(*document, HostsUsingFeatures::Feature::RTCPeerConnectionCreated);
+
if (mediaConstraints.isObject())
UseCounter::count(context, UseCounter::RTCPeerConnectionConstructorConstraints);
else
@@ -1157,6 +1161,10 @@ void RTCPeerConnection::changeSignalingState(SignalingState signalingState)
{
if (m_signalingState != SignalingStateClosed && m_signalingState != signalingState) {
m_signalingState = signalingState;
+ if (m_signalingState == SignalingStateStable) {
+ Document* document = toDocument(getExecutionContext());
+ HostsUsingFeatures::countAnyWorld(*document, HostsUsingFeatures::Feature::RTCPeerConnectionStable);
+ }
scheduleDispatchEvent(Event::create(EventTypeNames::signalingstatechange));
}
}
@@ -1170,6 +1178,10 @@ bool RTCPeerConnection::setIceConnectionState(ICEConnectionState iceConnectionSt
{
if (m_iceConnectionState != ICEConnectionStateClosed && m_iceConnectionState != iceConnectionState) {
m_iceConnectionState = iceConnectionState;
+ if (m_iceConnectionState == ICEConnectionStateConnected) {
+ Document* document = toDocument(getExecutionContext());
+ HostsUsingFeatures::countAnyWorld(*document, HostsUsingFeatures::Feature::RTCPeerConnectionConnected);
+ }
return true;
}
return false;

Powered by Google App Engine
This is Rietveld 408576698