Gilles has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/174928

Change subject: Rename Performance to PerformanceLogger
......................................................................

Rename Performance to PerformanceLogger

Change-Id: Iacfde35851cf8f617c4672d3ea466d4f0e2e448f
---
M MultimediaViewer.php
M MultimediaViewerHooks.php
M resources/mmv/logging/mmv.logging.Api.js
R resources/mmv/logging/mmv.logging.PerformanceLogger.js
M resources/mmv/provider/mmv.provider.Image.js
R tests/qunit/mmv/logging/mmv.logging.PerformanceLogger.test.js
6 files changed, 41 insertions(+), 41 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MultimediaViewer 
refs/changes/28/174928/1

diff --git a/MultimediaViewer.php b/MultimediaViewer.php
index d6aea6f..7a47510 100644
--- a/MultimediaViewer.php
+++ b/MultimediaViewer.php
@@ -323,7 +323,7 @@
                        'mmv.model.Repo',
                        'mmv.model.Thumbnail',
                        'mmv.model.User',
-                       'mmv.logging.Performance',
+                       'mmv.logging.PerformanceLogger',
                        'oojs',
                ),
        ),
@@ -849,9 +849,9 @@
                ),
        ),
 
-       'mmv.logging.Performance' => $wgMediaViewerResourceTemplate + array(
+       'mmv.logging.PerformanceLogger' => $wgMediaViewerResourceTemplate + 
array(
                'scripts' => array(
-                       'mmv/logging/mmv.logging.Performance.js',
+                       'mmv/logging/mmv.logging.PerformanceLogger.js',
                ),
 
                'dependencies' => array(
@@ -1065,7 +1065,7 @@
 
        if ( isset( $wgResourceModules['ext.eventLogging'] ) ) {
                
$wgResourceModules['mmv.logging.ActionLogger']['dependencies'][] = 
'ext.eventLogging';
-               $wgResourceModules['mmv.logging.Performance']['dependencies'][] 
= 'ext.eventLogging';
+               
$wgResourceModules['mmv.logging.PerformanceLogger']['dependencies'][] = 
'ext.eventLogging';
                
$wgResourceModules['mmv.logging.DurationLogger']['dependencies'][] = 
'ext.eventLogging';
                
$wgResourceModules['mmv.logging.AttributionLogger']['dependencies'][] = 
'ext.eventLogging';
                
$wgResourceModules['mmv.logging.DimensionLogger']['dependencies'][] = 
'ext.eventLogging';
diff --git a/MultimediaViewerHooks.php b/MultimediaViewerHooks.php
index 55a9067..2d6eecd 100644
--- a/MultimediaViewerHooks.php
+++ b/MultimediaViewerHooks.php
@@ -198,7 +198,7 @@
                                'tests/qunit/mmv/mmv.Config.test.js',
                                'tests/qunit/mmv/mmv.HtmlUtils.test.js',
                                
'tests/qunit/mmv/logging/mmv.logging.DurationLogger.test.js',
-                               
'tests/qunit/mmv/logging/mmv.logging.Performance.test.js',
+                               
'tests/qunit/mmv/logging/mmv.logging.PerformanceLogger.test.js',
                                
'tests/qunit/mmv/logging/mmv.logging.ActionLogger.test.js',
                                
'tests/qunit/mmv/logging/mmv.logging.AttributionLogger.test.js',
                                
'tests/qunit/mmv/logging/mmv.logging.DimensionLogger.test.js',
diff --git a/resources/mmv/logging/mmv.logging.Api.js 
b/resources/mmv/logging/mmv.logging.Api.js
index aa92f36..ff3d0c0 100644
--- a/resources/mmv/logging/mmv.logging.Api.js
+++ b/resources/mmv/logging/mmv.logging.Api.js
@@ -17,7 +17,7 @@
 
 ( function ( mw, $, oo ) {
        /**
-        * Runs performance analysis on requests via mw.mmv.logging.Performance
+        * Runs performance analysis on requests via 
mw.mmv.logging.PerformanceLogger
         * @class mw.mmv.logging.Api
         * @extends mw.Api
         * @constructor
@@ -27,8 +27,8 @@
        function Api( type, options ) {
                mw.Api.call( this, options );
 
-               /** @property {mw.mmv.logging.Performance} performance Used to 
record performance data. */
-               this.performance = new mw.mmv.logging.Performance();
+               /** @property {mw.mmv.logging.PerformanceLogger} performance 
Used to record performance data. */
+               this.performance = new mw.mmv.logging.PerformanceLogger();
 
                /** @property {string} type Type of requests being sent via 
this API. */
                this.type = type;
diff --git a/resources/mmv/logging/mmv.logging.Performance.js 
b/resources/mmv/logging/mmv.logging.PerformanceLogger.js
similarity index 91%
rename from resources/mmv/logging/mmv.logging.Performance.js
rename to resources/mmv/logging/mmv.logging.PerformanceLogger.js
index 677fa0f..bfde462 100644
--- a/resources/mmv/logging/mmv.logging.Performance.js
+++ b/resources/mmv/logging/mmv.logging.PerformanceLogger.js
@@ -16,37 +16,37 @@
  */
 
 ( function ( mw, $, oo ) {
-       var P;
+       var PL;
 
        /**
         * Measures the network performance
         * See 
<https://meta.wikimedia.org/wiki/Schema:MultimediaViewerNetworkPerformance>
-        * @class mw.mmv.logging.Performance
+        * @class mw.mmv.logging.PerformanceLogger
         * @extends mw.mmv.logging.Logger
         * @constructor
         */
-       function Performance() {}
+       function PerformanceLogger() {}
 
-       oo.inheritClass( Performance, mw.mmv.logging.Logger );
+       oo.inheritClass( PerformanceLogger, mw.mmv.logging.Logger );
 
-       P = Performance.prototype;
+       PL = PerformanceLogger.prototype;
 
        /**
         * @override
         * @inheritdoc
         */
-       P.samplingFactor = mw.config.get( 'wgMultimediaViewer' 
).networkPerformanceSamplingFactor;
+       PL.samplingFactor = mw.config.get( 'wgMultimediaViewer' 
).networkPerformanceSamplingFactor;
 
        /**
         * @override
         * @inheritdoc
         */
-       P.schema = 'MultimediaViewerNetworkPerformance';
+       PL.schema = 'MultimediaViewerNetworkPerformance';
 
        /**
         * Global setup that should be done while the page loads
         */
-       P.init = function () {
+       PL.init = function () {
                var performance = this.getWindowPerformance();
 
                // by default logging is cut off after 150 resources, which is 
not enough in debug mode
@@ -64,7 +64,7 @@
         * @param {string} url URL to be measured
         * @returns {jQuery.Promise} A promise that resolves when the contents 
of the URL have been fetched
         */
-       P.record = function ( type, url ) {
+       PL.record = function ( type, url ) {
                var deferred = $.Deferred(),
                        request,
                        perf = this,
@@ -112,7 +112,7 @@
         * @param {string} url URL of that was measured
         * @param {XMLHttpRequest} request HTTP request that just completed
         */
-       P.recordEntry = function ( type, total, url, request ) {
+       PL.recordEntry = function ( type, total, url, request ) {
                var matches,
                        stats = { type: type,
                                contentHost: window.location.host,
@@ -173,7 +173,7 @@
         * @param {Object} stats stats object to extend with additional 
statistics fields
         * @param {XMLHttpRequest} request
         */
-       P.populateStatsFromXhr = function ( stats, request ) {
+       PL.populateStatsFromXhr = function ( stats, request ) {
                var age,
                        contentLength,
                        xcache,
@@ -223,7 +223,7 @@
         * @param {Object} stats
         * @param {string} url
         */
-       P.populateStatsFromPerformance = function( stats, url ) {
+       PL.populateStatsFromPerformance = function( stats, url ) {
                var performance = this.getWindowPerformance(),
                        timingEntries, timingEntry;
 
@@ -265,7 +265,7 @@
         * @param {number} total the total load time tracked with a basic 
technique
         * @param {jqXHR} jqxhr
         */
-       P.recordJQueryEntry = function ( type, total, jqxhr ) {
+       PL.recordJQueryEntry = function ( type, total, jqxhr ) {
                var perf = this;
 
                // We take advantage of the fact that the context of the jqXHR 
deferred is the AJAX
@@ -306,7 +306,7 @@
         * @param {string} url URL of that was measured
         * @param {XMLHttpRequest} request HTTP request that just completed
         */
-       P.recordEntryDelayed = function ( type, total, url, request ) {
+       PL.recordEntryDelayed = function ( type, total, url, request ) {
                var perf = this;
 
                // The timeout is necessary because if there's an entry in 
window.performance,
@@ -322,7 +322,7 @@
         * @param {number} total the total load time tracked with a basic 
technique
         * @param {jqXHR} jqxhr
         */
-       P.recordJQueryEntryDelayed = function ( type, total, jqxhr ) {
+       PL.recordJQueryEntryDelayed = function ( type, total, jqxhr ) {
                var perf = this;
 
                // The timeout is necessary because if there's an entry in 
window.performance,
@@ -337,7 +337,7 @@
         * @param {string} header The X-Cache header from the request
         * @returns {Object} The parsed X-Cache data
         */
-       P.parseVarnishXCacheHeader = function ( header ) {
+       PL.parseVarnishXCacheHeader = function ( header ) {
                var parts,
                        part,
                        subparts,
@@ -380,7 +380,7 @@
         * Allows us to override for unit tests
         * @returns {Object} The window's Performance object
         */
-       P.getWindowPerformance = function () {
+       PL.getWindowPerformance = function () {
                return window.performance;
        };
 
@@ -389,7 +389,7 @@
         * Allows us to override for unit tests
         * @returns {Object} The navigator's Connection object
         */
-       P.getNavigatorConnection = function () {
+       PL.getNavigatorConnection = function () {
                return navigator.connection || navigator.mozConnection || 
navigator.webkitConnection;
        };
 
@@ -398,12 +398,12 @@
         * Allows us to override for unit tests
         * @returns {XMLHttpRequest} New XMLHttpRequest
         */
-       P.newXHR = function () {
+       PL.newXHR = function () {
                return new XMLHttpRequest();
        };
 
-       new Performance().init();
+       new PerformanceLogger().init();
 
-       mw.mmv.logging.Performance = Performance;
+       mw.mmv.logging.PerformanceLogger = PerformanceLogger;
 
 }( mediaWiki, jQuery, OO ) );
diff --git a/resources/mmv/provider/mmv.provider.Image.js 
b/resources/mmv/provider/mmv.provider.Image.js
index 58e4cf9..2eccd43 100644
--- a/resources/mmv/provider/mmv.provider.Image.js
+++ b/resources/mmv/provider/mmv.provider.Image.js
@@ -25,10 +25,10 @@
         */
        function Image( imageQueryParameter ) {
                /**
-                * @property {mw.mmv.logging.Performance}
+                * @property {mw.mmv.logging.PerformanceLogger}
                 * @private
                 */
-               this.performance = new mw.mmv.logging.Performance();
+               this.performance = new mw.mmv.logging.PerformanceLogger();
 
                this.imageQueryParameter = imageQueryParameter;
 
@@ -41,7 +41,7 @@
        }
 
        /**
-        * Loads an image and returns it. Includes performance metrics via 
mw.mmv.logging.Performance.
+        * Loads an image and returns it. Includes performance metrics via 
mw.mmv.logging.PerformanceLogger.
         * When the browser supports it, the image is loaded as an AJAX request.
         * @param {string} url
         * @return {jQuery.Promise.<HTMLImageElement>} A promise which resolves 
to the image object.
diff --git a/tests/qunit/mmv/logging/mmv.logging.Performance.test.js 
b/tests/qunit/mmv/logging/mmv.logging.PerformanceLogger.test.js
similarity index 94%
rename from tests/qunit/mmv/logging/mmv.logging.Performance.test.js
rename to tests/qunit/mmv/logging/mmv.logging.PerformanceLogger.test.js
index 5583169..be38879 100644
--- a/tests/qunit/mmv/logging/mmv.logging.Performance.test.js
+++ b/tests/qunit/mmv/logging/mmv.logging.PerformanceLogger.test.js
@@ -16,7 +16,7 @@
  */
 
 ( function ( mw, $ ) {
-       QUnit.module( 'mmv.logging.Performance', QUnit.newMwEnvironment() );
+       QUnit.module( 'mmv.logging.PerformanceLogger', QUnit.newMwEnvironment() 
);
 
        function createFakeXHR( response )  {
                return {
@@ -37,7 +37,7 @@
        }
 
        QUnit.test( 'recordEntry: basic', 7, function ( assert ) {
-               var performance = new mw.mmv.logging.Performance(),
+               var performance = new mw.mmv.logging.PerformanceLogger(),
                        fakeEventLog = { logEvent : this.sandbox.stub() },
                        type = 'gender',
                        total = 100;
@@ -110,7 +110,7 @@
                        },
                        country = 'FR',
                        type = 'image',
-                       performance = new mw.mmv.logging.Performance(),
+                       performance = new mw.mmv.logging.PerformanceLogger(),
                        status = 200,
                        metered = true,
                        bandwidth = 45.67,
@@ -191,7 +191,7 @@
                        varnish2 = 'cp3006',
                        varnish3 = 'cp3005',
                        testString = varnish1 + ' miss (0), ' + varnish2  + ' 
miss (0), ' + varnish3 + ' frontend hit (1)',
-                       performance = new mw.mmv.logging.Performance(),
+                       performance = new mw.mmv.logging.PerformanceLogger(),
                        varnishXCache = performance.parseVarnishXCacheHeader( 
testString );
 
                assert.strictEqual( varnishXCache.varnish1, varnish1, 'First 
varnish server name extracted' );
@@ -221,7 +221,7 @@
                var type = 'foo',
                        url = 'http://example.com/',
                        response = {},
-                       performance = new mw.mmv.logging.Performance();
+                       performance = new mw.mmv.logging.PerformanceLogger();
 
                performance.newXHR = function () { return createFakeXHR( 
response ); };
 
@@ -243,7 +243,7 @@
        QUnit.asyncTest( 'record() with old browser', 1, function ( assert ) {
                var type = 'foo',
                        url = 'http://example.com/',
-                       performance = new mw.mmv.logging.Performance();
+                       performance = new mw.mmv.logging.PerformanceLogger();
 
                performance.newXHR = function () { throw 'XMLHttpRequest? 
What\'s that?'; };
 
@@ -255,7 +255,7 @@
 
        QUnit.test( 'mw.mmv.logging.Api', 3, function ( assert ) {
                var api,
-                       oldRecord = 
mw.mmv.logging.Performance.prototype.recordJQueryEntryDelayed,
+                       oldRecord = 
mw.mmv.logging.PerformanceLogger.prototype.recordJQueryEntryDelayed,
                        oldAjax = mw.Api.prototype.ajax,
                        ajaxCalled = false,
                        fakeJqxhr = {};
@@ -265,7 +265,7 @@
                        return $.Deferred().resolve( {}, fakeJqxhr );
                };
 
-               mw.mmv.logging.Performance.prototype.recordJQueryEntryDelayed = 
function ( type, total, jqxhr ) {
+               
mw.mmv.logging.PerformanceLogger.prototype.recordJQueryEntryDelayed = function 
( type, total, jqxhr ) {
                        assert.strictEqual( type, 'foo', 'type was passed 
correctly' );
                        assert.strictEqual( jqxhr, fakeJqxhr, 'jqXHR was passed 
correctly' );
                };
@@ -276,7 +276,7 @@
 
                assert.ok( ajaxCalled, 'parent ajax() function was called' );
 
-               mw.mmv.logging.Performance.prototype.recordJQueryEntryDelayed = 
oldRecord;
+               
mw.mmv.logging.PerformanceLogger.prototype.recordJQueryEntryDelayed = oldRecord;
                mw.Api.prototype.ajax = oldAjax;
        } );
 }( mediaWiki, jQuery ) );

-- 
To view, visit https://gerrit.wikimedia.org/r/174928
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iacfde35851cf8f617c4672d3ea466d4f0e2e448f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MultimediaViewer
Gerrit-Branch: master
Gerrit-Owner: Gilles <gdu...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to