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

Side by Side Diff: tools/callstats.html

Issue 2376103003: [tools] Add support for replacing the default content in callstats.html (Closed)
Patch Set: formatting Created 4 years, 2 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 <html> 1 <html>
2 <!-- 2 <!--
3 Copyright 2016 the V8 project authors. All rights reserved. Use of this source 3 Copyright 2016 the V8 project authors. All rights reserved. Use of this source
4 code is governed by a BSD-style license that can be found in the LICENSE file. 4 code is governed by a BSD-style license that can be found in the LICENSE file.
5 --> 5 -->
6 6
7 <head> 7 <head>
8 <meta charset="UTF-8"> 8 <meta charset="UTF-8">
9 <style> 9 <style>
10 body { 10 body {
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 func(this[i]); 240 func(this[i]);
241 } 241 }
242 } 242 }
243 } 243 }
244 244
245 var versions; 245 var versions;
246 var pages; 246 var pages;
247 var selectedPage; 247 var selectedPage;
248 var baselineVersion; 248 var baselineVersion;
249 var selectedEntry; 249 var selectedEntry;
250
251 // Marker to programatically replace the defaultData.
252 var defaultData = /*default-data-start*/undefined/*default-data-end*/;
250 253
251 function initialize() { 254 function initialize() {
252 // Initialize the stats table and toggle lists. 255 // Initialize the stats table and toggle lists.
253 var original = $("column"); 256 var original = $("column");
254 var view = document.createElement('div'); 257 var view = document.createElement('div');
255 view.id = 'view'; 258 view.id = 'view';
256 var i = 0; 259 var i = 0;
257 versions.forEach((version) => { 260 versions.forEach((version) => {
258 if (!version.enabled) return; 261 if (!version.enabled) return;
259 // add column 262 // add column
(...skipping 741 matching lines...) Expand 10 before | Expand all | Expand 10 after
1001 return diffSign(value, 1, '%', showDiff); 1004 return diffSign(value, 1, '%', showDiff);
1002 } 1005 }
1003 1006
1004 </script> 1007 </script>
1005 <script type="text/javascript"> 1008 <script type="text/javascript">
1006 "use strict" 1009 "use strict"
1007 // ========================================================================= 1010 // =========================================================================
1008 // EventHandlers 1011 // EventHandlers
1009 function handleBodyLoad() { 1012 function handleBodyLoad() {
1010 $('uploadInput').focus(); 1013 $('uploadInput').focus();
1011 if (window.location.protocol !== 'file:') tryLoadDefaultResults(); 1014 if (defaultData) {
1015 handleLoadJSON(defaultData);
1016 } else if (window.location.protocol !== 'file:') {
1017 tryLoadDefaultResults();
1018 }
1012 } 1019 }
1013 1020
1014 function tryLoadDefaultResults() { 1021 function tryLoadDefaultResults() {
1015 // Try to load a results.json file adjacent to this day. 1022 // Try to load a results.json file adjacent to this day.
1016 var xhr = new XMLHttpRequest(); 1023 var xhr = new XMLHttpRequest();
1017 xhr.open('GET', 'results.json', true); 1024 // The markers on the following line can be used to replace the url easily
1025 // with scripts.
1026 xhr.open('GET', /*results-url-start*/'results.json'/*results-url-end*/, tru e);
1018 xhr.onreadystatechange = function(e) { 1027 xhr.onreadystatechange = function(e) {
1019 if (this.readyState != 4 || this.status != 200) return; 1028 if(this.readyState !== XMLHttpRequest.DONE || this.status !== 200) return ;
1020 handleLoadText(this.responseText); 1029 handleLoadText(this.responseText);
1021 }; 1030 };
1022 xhr.send(); 1031 xhr.send();
1023 } 1032 }
1024 1033
1025 function handleLoadFile() { 1034 function handleLoadFile() {
1026 var files = document.getElementById("uploadInput").files; 1035 var files = document.getElementById("uploadInput").files;
1027 var file = files[0]; 1036 var file = files[0];
1028 var reader = new FileReader(); 1037 var reader = new FileReader();
1029 1038
1030 reader.onload = function(evt) { 1039 reader.onload = function(evt) {
1031 handleLoadText(this.result); 1040 handleLoadText(this.result);
1032 } 1041 }
1033 reader.readAsText(file); 1042 reader.readAsText(file);
1034 } 1043 }
1035 1044
1036 function handleLoadText(text) { 1045 function handleLoadText(text) {
1037 pages = new Pages(); 1046 pages = new Pages();
1038 versions = Versions.fromJSON(JSON.parse(text)); 1047 handleLoadJSON(JSON.parse(text));
1048 }
1049
1050 function handleLoadJSON(json) {
1051 versions = Versions.fromJSON(json);
1039 initialize() 1052 initialize()
1040 showPage(versions.versions[0].pages[0]); 1053 showPage(versions.versions[0].pages[0]);
1041 selectEntry(selectedPage.total); 1054 selectEntry(selectedPage.total);
1042 } 1055 }
1043 1056
1044 function handleToggleGroup(event) { 1057 function handleToggleGroup(event) {
1045 var group = event.target.parentNode.parentNode.entry; 1058 var group = event.target.parentNode.parentNode.entry;
1046 toggleGroup(selectedPage.get(group.name)); 1059 toggleGroup(selectedPage.get(group.name));
1047 } 1060 }
1048 1061
(...skipping 816 matching lines...) Expand 10 before | Expand all | Expand 10 after
1865 </tr> 1878 </tr>
1866 <tr> 1879 <tr>
1867 <td>Overall Impact:</td> 1880 <td>Overall Impact:</td>
1868 <td class="timeImpact"></td><td>±</td><td class="timePercentImpact"></td > 1881 <td class="timeImpact"></td><td>±</td><td class="timePercentImpact"></td >
1869 <td class="compare timeImpact"></td><td class="compare"> ± </td><td clas s="compare timePercentImpact"></td> 1882 <td class="compare timeImpact"></td><td class="compare"> ± </td><td clas s="compare timePercentImpact"></td>
1870 </tr> 1883 </tr>
1871 </table> 1884 </table>
1872 </div> 1885 </div>
1873 </body> 1886 </body>
1874 </html> 1887 </html>
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