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

Side by Side 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 28 matching lines...) Expand all
39 #include "bindings/core/v8/ScriptState.h" 39 #include "bindings/core/v8/ScriptState.h"
40 #include "bindings/core/v8/ScriptValue.h" 40 #include "bindings/core/v8/ScriptValue.h"
41 #include "bindings/core/v8/V8ThrowException.h" 41 #include "bindings/core/v8/V8ThrowException.h"
42 #include "bindings/modules/v8/RTCIceCandidateInitOrRTCIceCandidate.h" 42 #include "bindings/modules/v8/RTCIceCandidateInitOrRTCIceCandidate.h"
43 #include "bindings/modules/v8/V8RTCCertificate.h" 43 #include "bindings/modules/v8/V8RTCCertificate.h"
44 #include "core/dom/DOMException.h" 44 #include "core/dom/DOMException.h"
45 #include "core/dom/DOMTimeStamp.h" 45 #include "core/dom/DOMTimeStamp.h"
46 #include "core/dom/Document.h" 46 #include "core/dom/Document.h"
47 #include "core/dom/ExceptionCode.h" 47 #include "core/dom/ExceptionCode.h"
48 #include "core/dom/ExecutionContext.h" 48 #include "core/dom/ExecutionContext.h"
49 #include "core/frame/HostsUsingFeatures.h"
49 #include "core/frame/LocalFrame.h" 50 #include "core/frame/LocalFrame.h"
50 #include "core/frame/UseCounter.h" 51 #include "core/frame/UseCounter.h"
51 #include "core/html/VoidCallback.h" 52 #include "core/html/VoidCallback.h"
52 #include "core/loader/FrameLoader.h" 53 #include "core/loader/FrameLoader.h"
53 #include "core/loader/FrameLoaderClient.h" 54 #include "core/loader/FrameLoaderClient.h"
54 #include "modules/crypto/CryptoResultImpl.h" 55 #include "modules/crypto/CryptoResultImpl.h"
55 #include "modules/mediastream/MediaConstraintsImpl.h" 56 #include "modules/mediastream/MediaConstraintsImpl.h"
56 #include "modules/mediastream/MediaStreamEvent.h" 57 #include "modules/mediastream/MediaStreamEvent.h"
57 #include "modules/mediastream/RTCAnswerOptions.h" 58 #include "modules/mediastream/RTCAnswerOptions.h"
58 #include "modules/mediastream/RTCDTMFSender.h" 59 #include "modules/mediastream/RTCDTMFSender.h"
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 return true; 389 return true;
389 } 390 }
390 391
391 DEFINE_TRACE(RTCPeerConnection::EventWrapper) 392 DEFINE_TRACE(RTCPeerConnection::EventWrapper)
392 { 393 {
393 visitor->trace(m_event); 394 visitor->trace(m_event);
394 } 395 }
395 396
396 RTCPeerConnection* RTCPeerConnection::create(ExecutionContext* context, const Di ctionary& rtcConfiguration, const Dictionary& mediaConstraints, ExceptionState& exceptionState) 397 RTCPeerConnection* RTCPeerConnection::create(ExecutionContext* context, const Di ctionary& rtcConfiguration, const Dictionary& mediaConstraints, ExceptionState& exceptionState)
397 { 398 {
399 Document* document = toDocument(context);
400 HostsUsingFeatures::countAnyWorld(*document, HostsUsingFeatures::Feature::RT CPeerConnectionCreated);
401
398 if (mediaConstraints.isObject()) 402 if (mediaConstraints.isObject())
399 UseCounter::count(context, UseCounter::RTCPeerConnectionConstructorConst raints); 403 UseCounter::count(context, UseCounter::RTCPeerConnectionConstructorConst raints);
400 else 404 else
401 UseCounter::count(context, UseCounter::RTCPeerConnectionConstructorCompl iant); 405 UseCounter::count(context, UseCounter::RTCPeerConnectionConstructorCompl iant);
402 406
403 // Record the RtcpMuxPolicy for histogram "WebRTC.PeerConnection.SelectedRtc pMuxPolicy". 407 // Record the RtcpMuxPolicy for histogram "WebRTC.PeerConnection.SelectedRtc pMuxPolicy".
404 RtcpMuxPolicy selectedRtcpMuxPolicy = RtcpMuxPolicyDefault; 408 RtcpMuxPolicy selectedRtcpMuxPolicy = RtcpMuxPolicyDefault;
405 RTCConfiguration* configuration = parseConfiguration(rtcConfiguration, excep tionState, &selectedRtcpMuxPolicy); 409 RTCConfiguration* configuration = parseConfiguration(rtcConfiguration, excep tionState, &selectedRtcpMuxPolicy);
406 if (exceptionState.hadException()) 410 if (exceptionState.hadException())
407 return 0; 411 return 0;
(...skipping 742 matching lines...) Expand 10 before | Expand all | Expand 10 after
1150 1154
1151 m_dispatchScheduledEventRunner->stop(); 1155 m_dispatchScheduledEventRunner->stop();
1152 1156
1153 m_peerHandler.reset(); 1157 m_peerHandler.reset();
1154 } 1158 }
1155 1159
1156 void RTCPeerConnection::changeSignalingState(SignalingState signalingState) 1160 void RTCPeerConnection::changeSignalingState(SignalingState signalingState)
1157 { 1161 {
1158 if (m_signalingState != SignalingStateClosed && m_signalingState != signalin gState) { 1162 if (m_signalingState != SignalingStateClosed && m_signalingState != signalin gState) {
1159 m_signalingState = signalingState; 1163 m_signalingState = signalingState;
1164 if (m_signalingState == SignalingStateStable) {
1165 Document* document = toDocument(getExecutionContext());
1166 HostsUsingFeatures::countAnyWorld(*document, HostsUsingFeatures::Fea ture::RTCPeerConnectionStable);
1167 }
1160 scheduleDispatchEvent(Event::create(EventTypeNames::signalingstatechange )); 1168 scheduleDispatchEvent(Event::create(EventTypeNames::signalingstatechange ));
1161 } 1169 }
1162 } 1170 }
1163 1171
1164 void RTCPeerConnection::changeIceGatheringState(ICEGatheringState iceGatheringSt ate) 1172 void RTCPeerConnection::changeIceGatheringState(ICEGatheringState iceGatheringSt ate)
1165 { 1173 {
1166 m_iceGatheringState = iceGatheringState; 1174 m_iceGatheringState = iceGatheringState;
1167 } 1175 }
1168 1176
1169 bool RTCPeerConnection::setIceConnectionState(ICEConnectionState iceConnectionSt ate) 1177 bool RTCPeerConnection::setIceConnectionState(ICEConnectionState iceConnectionSt ate)
1170 { 1178 {
1171 if (m_iceConnectionState != ICEConnectionStateClosed && m_iceConnectionState != iceConnectionState) { 1179 if (m_iceConnectionState != ICEConnectionStateClosed && m_iceConnectionState != iceConnectionState) {
1172 m_iceConnectionState = iceConnectionState; 1180 m_iceConnectionState = iceConnectionState;
1181 if (m_iceConnectionState == ICEConnectionStateConnected) {
1182 Document* document = toDocument(getExecutionContext());
1183 HostsUsingFeatures::countAnyWorld(*document, HostsUsingFeatures::Fea ture::RTCPeerConnectionConnected);
1184 }
1173 return true; 1185 return true;
1174 } 1186 }
1175 return false; 1187 return false;
1176 } 1188 }
1177 1189
1178 void RTCPeerConnection::changeIceConnectionState(ICEConnectionState iceConnectio nState) 1190 void RTCPeerConnection::changeIceConnectionState(ICEConnectionState iceConnectio nState)
1179 { 1191 {
1180 if (m_iceConnectionState != ICEConnectionStateClosed) { 1192 if (m_iceConnectionState != ICEConnectionStateClosed) {
1181 scheduleDispatchEvent(Event::create(EventTypeNames::iceconnectionstatech ange), 1193 scheduleDispatchEvent(Event::create(EventTypeNames::iceconnectionstatech ange),
1182 WTF::bind(&RTCPeerConnection::setIceConnectionState, wrapPersistent( this), iceConnectionState)); 1194 WTF::bind(&RTCPeerConnection::setIceConnectionState, wrapPersistent( this), iceConnectionState));
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
1229 { 1241 {
1230 visitor->trace(m_localStreams); 1242 visitor->trace(m_localStreams);
1231 visitor->trace(m_remoteStreams); 1243 visitor->trace(m_remoteStreams);
1232 visitor->trace(m_dispatchScheduledEventRunner); 1244 visitor->trace(m_dispatchScheduledEventRunner);
1233 visitor->trace(m_scheduledEvents); 1245 visitor->trace(m_scheduledEvents);
1234 EventTargetWithInlineData::trace(visitor); 1246 EventTargetWithInlineData::trace(visitor);
1235 ActiveDOMObject::trace(visitor); 1247 ActiveDOMObject::trace(visitor);
1236 } 1248 }
1237 1249
1238 } // namespace blink 1250 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698