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

Unified Diff: tools/callstats.html

Issue 2376103003: [tools] Add support for replacing the default content in callstats.html (Closed)
Patch Set: formatting Created 4 years, 3 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/callstats.html
diff --git a/tools/callstats.html b/tools/callstats.html
index d47425b435ed7e1a2c46398caacf0856edd09d9a..2140706c3a7933bcf535dbcd7074048fcb00b360 100644
--- a/tools/callstats.html
+++ b/tools/callstats.html
@@ -247,6 +247,9 @@ code is governed by a BSD-style license that can be found in the LICENSE file.
var selectedPage;
var baselineVersion;
var selectedEntry;
+
+ // Marker to programatically replace the defaultData.
+ var defaultData = /*default-data-start*/undefined/*default-data-end*/;
function initialize() {
// Initialize the stats table and toggle lists.
@@ -1008,15 +1011,21 @@ code is governed by a BSD-style license that can be found in the LICENSE file.
// EventHandlers
function handleBodyLoad() {
$('uploadInput').focus();
- if (window.location.protocol !== 'file:') tryLoadDefaultResults();
+ if (defaultData) {
+ handleLoadJSON(defaultData);
+ } else if (window.location.protocol !== 'file:') {
+ tryLoadDefaultResults();
+ }
}
function tryLoadDefaultResults() {
- // Try to load a results.json file adjacent to this day.
+ // Try to load a results.json file adjacent to this day.
var xhr = new XMLHttpRequest();
- xhr.open('GET', 'results.json', true);
+ // The markers on the following line can be used to replace the url easily
+ // with scripts.
+ xhr.open('GET', /*results-url-start*/'results.json'/*results-url-end*/, true);
xhr.onreadystatechange = function(e) {
- if (this.readyState != 4 || this.status != 200) return;
+ if(this.readyState !== XMLHttpRequest.DONE || this.status !== 200) return;
handleLoadText(this.responseText);
};
xhr.send();
@@ -1035,7 +1044,11 @@ code is governed by a BSD-style license that can be found in the LICENSE file.
function handleLoadText(text) {
pages = new Pages();
- versions = Versions.fromJSON(JSON.parse(text));
+ handleLoadJSON(JSON.parse(text));
+ }
+
+ function handleLoadJSON(json) {
+ versions = Versions.fromJSON(json);
initialize()
showPage(versions.versions[0].pages[0]);
selectEntry(selectedPage.total);
« 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