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

Side by Side Diff: content/browser/resources/media/webrtc_internals.js

Issue 171263002: Requests stats on webrtc-internals as soon as the initial peer connection records are received. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 10 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 var tabView = null; 5 var tabView = null;
6 var ssrcInfoManager = null; 6 var ssrcInfoManager = null;
7 var peerConnectionUpdateTable = null; 7 var peerConnectionUpdateTable = null;
8 var statsTable = null; 8 var statsTable = null;
9 var dumpCreator = null; 9 var dumpCreator = null;
10 /** A map from peer connection id to the PeerConnectionRecord. */ 10 /** A map from peer connection id to the PeerConnectionRecord. */
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 function initialize() { 92 function initialize() {
93 dumpCreator = new DumpCreator($('content-root')); 93 dumpCreator = new DumpCreator($('content-root'));
94 tabView = new TabView($('content-root')); 94 tabView = new TabView($('content-root'));
95 ssrcInfoManager = new SsrcInfoManager(); 95 ssrcInfoManager = new SsrcInfoManager();
96 peerConnectionUpdateTable = new PeerConnectionUpdateTable(); 96 peerConnectionUpdateTable = new PeerConnectionUpdateTable();
97 statsTable = new StatsTable(ssrcInfoManager); 97 statsTable = new StatsTable(ssrcInfoManager);
98 98
99 chrome.send('finishedDOMLoad'); 99 chrome.send('finishedDOMLoad');
100 100
101 // Requests stats from all peer connections every second. 101 // Requests stats from all peer connections every second.
102 window.setInterval(function() { 102 window.setInterval(requestStats, 1000);
103 if (Object.keys(peerConnectionDataStore).length > 0)
104 chrome.send('getAllStats');
105 }, 1000);
106 } 103 }
107 document.addEventListener('DOMContentLoaded', initialize); 104 document.addEventListener('DOMContentLoaded', initialize);
108 105
109 106
107 /** Sends a request to the browser to get peer connection statistics. */
108 function requestStats() {
109 if (Object.keys(peerConnectionDataStore).length > 0)
110 chrome.send('getAllStats');
111 }
112
113
110 /** 114 /**
111 * A helper function for getting a peer connection element id. 115 * A helper function for getting a peer connection element id.
112 * 116 *
113 * @param {!Object.<string, number>} data The object containing the pid and lid 117 * @param {!Object.<string, number>} data The object containing the pid and lid
114 * of the peer connection. 118 * of the peer connection.
115 * @return {string} The peer connection element id. 119 * @return {string} The peer connection element id.
116 */ 120 */
117 function getPeerConnectionId(data) { 121 function getPeerConnectionId(data) {
118 return data.pid + '-' + data.lid; 122 return data.pid + '-' + data.lid;
119 } 123 }
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 for (var i = 0; i < data.length; ++i) { 218 for (var i = 0; i < data.length; ++i) {
215 var peerConnection = addPeerConnection(data[i]); 219 var peerConnection = addPeerConnection(data[i]);
216 220
217 var log = data[i].log; 221 var log = data[i].log;
218 if (!log) 222 if (!log)
219 continue; 223 continue;
220 for (var j = 0; j < log.length; ++j) { 224 for (var j = 0; j < log.length; ++j) {
221 addPeerConnectionUpdate(peerConnection, log[j]); 225 addPeerConnectionUpdate(peerConnection, log[j]);
222 } 226 }
223 } 227 }
228 requestStats();
224 } 229 }
225 230
226 231
227 /** 232 /**
228 * Handles the report of stats. 233 * Handles the report of stats.
229 * 234 *
230 * @param {!Object} data The object containing pid, lid, and reports, where 235 * @param {!Object} data The object containing pid, lid, and reports, where
231 * reports is an array of stats reports. Each report contains id, type, 236 * reports is an array of stats reports. Each report contains id, type,
232 * and stats, where stats is the object containing timestamp and values, 237 * and stats, where stats is the object containing timestamp and values,
233 * which is an array of strings, whose even index entry is the name of the 238 * which is an array of strings, whose even index entry is the name of the
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 userMediaRequests.splice(i, 1); 275 userMediaRequests.splice(i, 1);
271 } 276 }
272 } 277 }
273 278
274 /** 279 /**
275 * Set 280 * Set
276 */ 281 */
277 function enableAecRecording() { 282 function enableAecRecording() {
278 dumpCreator.enableAecRecording(); 283 dumpCreator.enableAecRecording();
279 } 284 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698