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

Unified Diff: tools/perf/metrics/speedindex.js

Issue 185413005: [Telemetry] Move page quiescence test to WebContents (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 9 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
« no previous file with comments | « no previous file | tools/perf/metrics/speedindex.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/perf/metrics/speedindex.js
diff --git a/tools/perf/metrics/speedindex.js b/tools/perf/metrics/speedindex.js
deleted file mode 100644
index c64f38b1667be1901935f3ec6afb6b9cc3a8f2a5..0000000000000000000000000000000000000000
--- a/tools/perf/metrics/speedindex.js
+++ /dev/null
@@ -1,76 +0,0 @@
-// Copyright 2013 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.
-
-'use strict';
-
-/**
- * @fileoverview This file provides a JavaScript helper function that
- * determines when the last resource was received.
- */
-(function() {
-
- // Set the Resource Timing interface functions that will be used below
- // to use whatever version is available currently regardless of vendor
- // prefix.
- window.performance.clearResourceTimings =
- (window.performance.clearResourceTimings ||
- window.performance.mozClearResourceTimings ||
- window.performance.msClearResourceTimings ||
- window.performance.oClearResourceTimings ||
- window.performance.webkitClearResourceTimings);
-
- window.performance.getEntriesByType =
- (window.performance.getEntriesByType ||
- window.performance.mozGetEntriesByType ||
- window.performance.msGetEntriesByType ||
- window.performance.oGetEntriesByType ||
- window.performance.webkitGetEntriesByType);
-
- // This variable will available to the function below and it will be
- // persistent across different function calls. It stores the last
- // entry in the list of PerformanceResourceTiming objects returned by
- // window.performance.getEntriesByType('resource').
- //
- // The reason for doing it this way is because the buffer for
- // PerformanceResourceTiming objects has a limit, and once it's full,
- // new entries are not added. We're only interested in the last entry,
- // so we can clear new entries when they're added.
- var lastEntry = null;
-
- /**
- * This method uses the Resource Timing interface, which is described at
- * http://www.w3.org/TR/resource-timing/. It provides information about
- * timings for resources such as images and script files, and it includes
- * resources requested via XMLHttpRequest.
- *
- * @return {number} The time since either the load event, or the last
- * the last resource was received after the load event. If the load
- * event hasn't yet happened, return 0.
- */
- window.timeSinceLastResponseAfterLoadMs = function() {
- if (window.document.readyState !== 'complete') {
- return 0;
- }
-
- var resourceTimings = window.performance.getEntriesByType('resource');
- if (resourceTimings.length > 0) {
- lastEntry = resourceTimings.pop();
- window.performance.clearResourceTimings();
- }
-
- // The times for performance.now() and in the PerformanceResourceTiming
- // objects are all in milliseconds since performance.timing.navigationStart,
- // so we must also get load time in the same terms.
- var timing = window.performance.timing;
- var loadTime = timing.loadEventEnd - timing.navigationStart;
-
- // If there have been no resource timing entries, or the last entry was
- // before the load event, then return the time since the load event.
- if (!lastEntry || lastEntry.responseEnd < loadTime) {
- return window.performance.now() - loadTime;
- }
- return window.performance.now() - lastEntry.responseEnd;
- }
-
-})();
« no previous file with comments | « no previous file | tools/perf/metrics/speedindex.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698