diff options
author | Andras Becsi <andras.becsi@digia.com> | 2013-12-11 21:33:03 +0100 |
---|---|---|
committer | Andras Becsi <andras.becsi@digia.com> | 2013-12-13 12:34:07 +0100 |
commit | f2a33ff9cbc6d19943f1c7fbddd1f23d23975577 (patch) | |
tree | 0586a32aa390ade8557dfd6b4897f43a07449578 /chromium/content/browser/resources/media/metrics.js | |
parent | 5362912cdb5eea702b68ebe23702468d17c3017a (diff) | |
download | qtwebengine-chromium-f2a33ff9cbc6d19943f1c7fbddd1f23d23975577.tar.gz |
Update Chromium to branch 1650 (31.0.1650.63)
Change-Id: I57d8c832eaec1eb2364e0a8e7352a6dd354db99f
Reviewed-by: Jocelyn Turcotte <jocelyn.turcotte@digia.com>
Diffstat (limited to 'chromium/content/browser/resources/media/metrics.js')
-rw-r--r-- | chromium/content/browser/resources/media/metrics.js | 116 |
1 files changed, 0 insertions, 116 deletions
diff --git a/chromium/content/browser/resources/media/metrics.js b/chromium/content/browser/resources/media/metrics.js deleted file mode 100644 index c812d44f56c..00000000000 --- a/chromium/content/browser/resources/media/metrics.js +++ /dev/null @@ -1,116 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -cr.define('media', function() { - 'use strict'; - - // A set of parameter names. An entry of 'abc' allows metrics to specify - // events with specific values of 'abc'. - var metricProperties = { - 'pipeline_state': true, - }; - - // A set of metrics to measure. The user will see the most recent and average - // measurement of the time between each metric's start and end events. - var metrics = { - 'seek': { - 'start': 'SEEK', - 'end': 'pipeline_state=started' - }, - 'first frame': { - 'start': 'WEBMEDIAPLAYER_CREATED', - 'end': 'pipeline_state=started' - }, - }; - - /** - * This class measures times between the events specified above. It inherits - * <li> and contains a table that displays the measurements. - */ - var Metrics = cr.ui.define('li'); - - Metrics.prototype = { - __proto__: HTMLLIElement.prototype, - - /** - * Decorate this <li> as a Metrics. - */ - decorate: function() { - this.table_ = document.createElement('table'); - var details = document.createElement('details'); - var summary = media.makeElement('summary', 'Metrics:'); - details.appendChild(summary); - details.appendChild(this.table_); - this.appendChild(details); - - var hRow = document.createElement('tr'); - hRow.appendChild(media.makeElement('th', 'Metric:')); - hRow.appendChild(media.makeElement('th', 'Last Measure:')); - hRow.appendChild(media.makeElement('th', 'Average:')); - var header = document.createElement('thead'); - header.appendChild(hRow); - this.table_.appendChild(header); - - for (var metric in metrics) { - var last = document.createElement('td'); - var avg = document.createElement('td'); - this[metric] = { - count: 0, - total: 0, - start: null, - last: last, - avg: avg - }; - var row = document.createElement('tr'); - row.appendChild(media.makeElement('td', metric + ':')); - row.appendChild(last); - row.appendChild(avg); - this.table_.appendChild(row); - } - }, - - /** - * An event has occurred. Update any metrics that refer to this type - * of event. Can be called multiple times by addEvent below if the metrics - * refer to specific parameters. - * @param {Object} event The MediaLogEvent that has occurred. - * @param {string} type The type of event. - */ - addEventInternal: function(event, type) { - for (var metric in metrics) { - var m = this[metric]; - if (type == metrics[metric].start && !m.start) { - m.start = event.ticksMillis; - } else if (type == metrics[metric].end && m.start != null) { - var last = event.ticksMillis - m.start; - m.last.textContent = last.toFixed(1); - m.total += last; - m.count++; - if (m.count > 1) - m.avg.textContent = (m.total / m.count).toFixed(1); - m.start = null; - } - } - }, - - /** - * An event has occurred. Update any metrics that refer to events of this - * type or with this event's parameters. - * @param {Object} event The MediaLogEvent that has occurred. - */ - addEvent: function(event) { - this.addEventInternal(event, event.type); - for (var p in event.params) { - if (p in metricProperties) { - var type = p + '=' + event.params[p]; - this.addEventInternal(event, type); - } - } - }, - }; - - return { - Metrics: Metrics, - }; -}); |