OLD | NEW |
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 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 if (header.querySelector('input') != undefined) return; | 341 if (header.querySelector('input') != undefined) return; |
342 var checkbox = document.createElement('input'); | 342 var checkbox = document.createElement('input'); |
343 checkbox.type = 'checkbox'; | 343 checkbox.type = 'checkbox'; |
344 checkbox.checked = content.className.indexOf('hidden') == -1; | 344 checkbox.checked = content.className.indexOf('hidden') == -1; |
345 checkbox.contentNode = content; | 345 checkbox.contentNode = content; |
346 checkbox.addEventListener('click', handleToggleContentVisibility); | 346 checkbox.addEventListener('click', handleToggleContentVisibility); |
347 header.insertBefore(checkbox, header.childNodes[0]); | 347 header.insertBefore(checkbox, header.childNodes[0]); |
348 }); | 348 }); |
349 } | 349 } |
350 | 350 |
| 351 window.addEventListener('popstate', (event) => { |
| 352 popHistoryState(event.state); |
| 353 }); |
| 354 |
| 355 function popHistoryState(state) { |
| 356 if (!state.version) return false; |
| 357 if (!versions) return false; |
| 358 var version = versions.getByName(state.version); |
| 359 if (!version) return false; |
| 360 var page = version.get(state.page); |
| 361 if (!page) return false; |
| 362 if (!state.entry) { |
| 363 showPage(page); |
| 364 } else { |
| 365 var entry = page.get(state.entry); |
| 366 if (!entry) { |
| 367 showPage(page); |
| 368 } else { |
| 369 showEntry(entry); |
| 370 } |
| 371 } |
| 372 return true; |
| 373 } |
| 374 |
| 375 function pushHistoryState() { |
| 376 var selection = selectedEntry ? selectedEntry : selectedPage; |
| 377 if (!selection) return; |
| 378 var state = selection.urlParams(); |
| 379 // Don't push a history state if it didn't change. |
| 380 if (JSON.stringify(window.history.state) === JSON.stringify(state)) return
; |
| 381 var params = "?"; |
| 382 for (var pairs of Object.entries(state)) { |
| 383 params += encodeURIComponent(pairs[0]) + "=" |
| 384 + encodeURIComponent(pairs[1]) + "&"; |
| 385 } |
| 386 window.history.pushState(state, selection.toString(), params); |
| 387 } |
| 388 |
351 function showPage(firstPage) { | 389 function showPage(firstPage) { |
352 var changeSelectedEntry = selectedEntry !== undefined | 390 var changeSelectedEntry = selectedEntry !== undefined |
353 && selectedEntry.page === selectedPage; | 391 && selectedEntry.page === selectedPage; |
| 392 pushHistoryState(); |
354 selectedPage = firstPage; | 393 selectedPage = firstPage; |
355 selectedPage.sort(); | 394 selectedPage.sort(); |
356 showPageInColumn(firstPage, 0); | 395 showPageInColumn(firstPage, 0); |
357 // Show the other versions of this page in the following columns. | 396 // Show the other versions of this page in the following columns. |
358 var pageVersions = versions.getPageVersions(firstPage); | 397 var pageVersions = versions.getPageVersions(firstPage); |
359 var index = 1; | 398 var index = 1; |
360 pageVersions.forEach((page) => { | 399 pageVersions.forEach((page) => { |
361 if (page !== firstPage) { | 400 if (page !== firstPage) { |
362 showPageInColumn(page, index); | 401 showPageInColumn(page, index); |
363 index++; | 402 index++; |
364 } | 403 } |
365 }); | 404 }); |
366 if (changeSelectedEntry) { | 405 if (changeSelectedEntry) { |
367 showEntryDetail(selectedPage.getEntry(selectedEntry)); | 406 showEntryDetail(selectedPage.getEntry(selectedEntry)); |
368 } | 407 } |
369 showImpactList(selectedPage); | 408 showImpactList(selectedPage); |
| 409 pushHistoryState(); |
370 } | 410 } |
371 | 411 |
372 function showPageInColumn(page, columnIndex) { | 412 function showPageInColumn(page, columnIndex) { |
373 page.sort(); | 413 page.sort(); |
374 var showDiff = (baselineVersion === undefined && columnIndex !== 0) || | 414 var showDiff = (baselineVersion === undefined && columnIndex !== 0) || |
375 (baselineVersion !== undefined && page.version !== baselineVersion); | 415 (baselineVersion !== undefined && page.version !== baselineVersion); |
376 var diffStatus = (td, a, b) => {}; | 416 var diffStatus = (td, a, b) => {}; |
377 if (showDiff) { | 417 if (showDiff) { |
378 if (baselineVersion !== undefined) { | 418 if (baselineVersion !== undefined) { |
379 diffStatus = (td, a, b) => { | 419 diffStatus = (td, a, b) => { |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
484 } | 524 } |
485 } | 525 } |
486 }); | 526 }); |
487 table.replaceChild(tbody, oldTbody); | 527 table.replaceChild(tbody, oldTbody); |
488 var versionSelect = column.querySelector('select.version'); | 528 var versionSelect = column.querySelector('select.version'); |
489 selectOption(versionSelect, (index, option) => { | 529 selectOption(versionSelect, (index, option) => { |
490 return option.version == page.version | 530 return option.version == page.version |
491 }); | 531 }); |
492 } | 532 } |
493 | 533 |
| 534 function showEntry(entry) { |
| 535 selectedEntry = entry; |
| 536 selectEntry(entry, true); |
| 537 } |
| 538 |
494 function selectEntry(entry, updateSelectedPage) { | 539 function selectEntry(entry, updateSelectedPage) { |
495 if (updateSelectedPage) { | 540 if (updateSelectedPage) { |
496 entry = selectedPage.version.getEntry(entry); | 541 entry = selectedPage.version.getEntry(entry); |
497 } | 542 } |
498 var rowIndex = 0; | 543 var rowIndex = 0; |
499 var needsPageSwitch = updateSelectedPage && entry.page != selectedPage; | 544 var needsPageSwitch = updateSelectedPage && entry.page != selectedPage; |
500 // If clicked in the detail row change the first column to that page. | 545 // If clicked in the detail row change the first column to that page. |
501 if (needsPageSwitch) showPage(entry.page); | 546 if (needsPageSwitch) showPage(entry.page); |
502 var childNodes = $('column_0').querySelector('.list tbody').childNodes; | 547 var childNodes = $('column_0').querySelector('.list tbody').childNodes; |
503 for (var i = 0; i < childNodes.length; i++) { | 548 for (var i = 0; i < childNodes.length; i++) { |
(...skipping 22 matching lines...) Expand all Loading... |
526 } | 571 } |
527 selectedEntry = entry; | 572 selectedEntry = entry; |
528 showEntryDetail(entry); | 573 showEntryDetail(entry); |
529 } | 574 } |
530 | 575 |
531 function showEntryDetail(entry) { | 576 function showEntryDetail(entry) { |
532 showVersionDetails(entry); | 577 showVersionDetails(entry); |
533 showPageDetails(entry); | 578 showPageDetails(entry); |
534 showImpactList(entry.page); | 579 showImpactList(entry.page); |
535 showGraphs(entry.page); | 580 showGraphs(entry.page); |
| 581 pushHistoryState(); |
536 } | 582 } |
537 | 583 |
538 function showVersionDetails(entry) { | 584 function showVersionDetails(entry) { |
539 var table, tbody, entries; | 585 var table, tbody, entries; |
540 table = $('detailView').querySelector('.versionDetailTable'); | 586 table = $('detailView').querySelector('.versionDetailTable'); |
541 tbody = document.createElement('tbody'); | 587 tbody = document.createElement('tbody'); |
542 if (entry !== undefined) { | 588 if (entry !== undefined) { |
543 $('detailView').querySelector('.versionDetail h3 span').textContent = | 589 $('detailView').querySelector('.versionDetail h3 span').textContent = |
544 entry.name + ' in ' + entry.page.name; | 590 entry.name + ' in ' + entry.page.name; |
545 entries = versions.getPageVersions(entry.page).map( | 591 entries = versions.getPageVersions(entry.page).map( |
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1039 reader.onload = function(evt) { | 1085 reader.onload = function(evt) { |
1040 handleLoadText(this.result); | 1086 handleLoadText(this.result); |
1041 } | 1087 } |
1042 reader.readAsText(file); | 1088 reader.readAsText(file); |
1043 } | 1089 } |
1044 | 1090 |
1045 function handleLoadText(text) { | 1091 function handleLoadText(text) { |
1046 handleLoadJSON(JSON.parse(text)); | 1092 handleLoadJSON(JSON.parse(text)); |
1047 } | 1093 } |
1048 | 1094 |
| 1095 function getStateFromParams() { |
| 1096 var query = window.location.search.substr(1); |
| 1097 var result = {}; |
| 1098 query.split("&").forEach((part) => { |
| 1099 var item = part.split("="); |
| 1100 var key = decodeURIComponent(item[0]) |
| 1101 result[key] = decodeURIComponent(item[1]); |
| 1102 }); |
| 1103 return result; |
| 1104 } |
| 1105 |
1049 function handleLoadJSON(json) { | 1106 function handleLoadJSON(json) { |
| 1107 var state = getStateFromParams(); |
1050 pages = new Pages(); | 1108 pages = new Pages(); |
1051 versions = Versions.fromJSON(json); | 1109 versions = Versions.fromJSON(json); |
1052 initialize() | 1110 initialize() |
1053 showPage(versions.versions[0].pages[0]); | 1111 showPage(versions.versions[0].pages[0]); |
1054 selectEntry(selectedPage.total); | 1112 if (!popHistoryState(state)) { |
| 1113 selectEntry(selectedPage.total); |
| 1114 } |
1055 } | 1115 } |
1056 | 1116 |
1057 function handleToggleGroup(event) { | 1117 function handleToggleGroup(event) { |
1058 var group = event.target.parentNode.parentNode.entry; | 1118 var group = event.target.parentNode.parentNode.entry; |
1059 toggleGroup(selectedPage.get(group.name)); | 1119 toggleGroup(selectedPage.get(group.name)); |
1060 } | 1120 } |
1061 | 1121 |
1062 function handleSelectPage(select, event) { | 1122 function handleSelectPage(select, event) { |
1063 var option = select.options[select.selectedIndex]; | 1123 var option = select.options[select.selectedIndex]; |
1064 if (select.id == "select_0") { | 1124 if (select.id == "select_0") { |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1181 var versionPage = version.get(page.name); | 1241 var versionPage = version.get(page.name); |
1182 if (versionPage !== undefined) result.push(versionPage); | 1242 if (versionPage !== undefined) result.push(versionPage); |
1183 }); | 1243 }); |
1184 return result; | 1244 return result; |
1185 } | 1245 } |
1186 get length() { | 1246 get length() { |
1187 return this.versions.length | 1247 return this.versions.length |
1188 } | 1248 } |
1189 get(index) { | 1249 get(index) { |
1190 return this.versions[index] | 1250 return this.versions[index] |
1191 }; | 1251 } |
| 1252 getByName(name) { |
| 1253 return this.versions.find((each) => each.name == name); |
| 1254 } |
1192 forEach(f) { | 1255 forEach(f) { |
1193 this.versions.forEach(f); | 1256 this.versions.forEach(f); |
1194 } | 1257 } |
1195 sort() { | 1258 sort() { |
1196 this.versions.sort(NameComparator); | 1259 this.versions.sort(NameComparator); |
1197 } | 1260 } |
1198 getEnabledPage(name) { | 1261 getEnabledPage(name) { |
1199 for (var i = 0; i < this.versions.length; i++) { | 1262 for (var i = 0; i < this.versions.length; i++) { |
1200 var version = this.versions[i]; | 1263 var version = this.versions[i]; |
1201 if (!version.enabled) continue; | 1264 if (!version.enabled) continue; |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1374 Group.groups.get('runtime').entry(), | 1437 Group.groups.get('runtime').entry(), |
1375 this.unclassified | 1438 this.unclassified |
1376 ]; | 1439 ]; |
1377 this.entryDict = new Map(); | 1440 this.entryDict = new Map(); |
1378 this.groups.forEach((entry) => { | 1441 this.groups.forEach((entry) => { |
1379 entry.page = this; | 1442 entry.page = this; |
1380 this.entryDict.set(entry.name, entry); | 1443 this.entryDict.set(entry.name, entry); |
1381 }); | 1444 }); |
1382 this.version = version; | 1445 this.version = version; |
1383 } | 1446 } |
| 1447 toString() { |
| 1448 return this.version.name + ": " + this.name; |
| 1449 } |
| 1450 urlParams() { |
| 1451 return { version: this.version.name, page: this.name}; |
| 1452 } |
1384 add(entry) { | 1453 add(entry) { |
1385 // Ignore accidentally added Group entries. | 1454 // Ignore accidentally added Group entries. |
1386 if (entry.name.startsWith(GroupedEntry.prefix)) return; | 1455 if (entry.name.startsWith(GroupedEntry.prefix)) return; |
1387 entry.page = this; | 1456 entry.page = this; |
1388 this.entryDict.set(entry.name, entry); | 1457 this.entryDict.set(entry.name, entry); |
1389 var added = false; | 1458 var added = false; |
1390 this.groups.forEach((group) => { | 1459 this.groups.forEach((group) => { |
1391 if (!added) added = group.add(entry); | 1460 if (!added) added = group.add(entry); |
1392 }); | 1461 }); |
1393 if (added) return; | 1462 if (added) return; |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1467 this._time = time; | 1536 this._time = time; |
1468 this._timeVariance = timeVariance; | 1537 this._timeVariance = timeVariance; |
1469 this._timeVariancePercent = timeVariancePercent; | 1538 this._timeVariancePercent = timeVariancePercent; |
1470 this._count = count; | 1539 this._count = count; |
1471 this.countVariance = countVariance; | 1540 this.countVariance = countVariance; |
1472 this.countVariancePercent = countVariancePercent; | 1541 this.countVariancePercent = countVariancePercent; |
1473 this.page = undefined; | 1542 this.page = undefined; |
1474 this.parent = undefined; | 1543 this.parent = undefined; |
1475 this.isTotal = false; | 1544 this.isTotal = false; |
1476 } | 1545 } |
| 1546 urlParams() { |
| 1547 var params = this.page.urlParams(); |
| 1548 params.entry = this.name; |
| 1549 return params; |
| 1550 } |
1477 getCompareWithBaseline(value, property) { | 1551 getCompareWithBaseline(value, property) { |
1478 if (baselineVersion == undefined) return value; | 1552 if (baselineVersion == undefined) return value; |
1479 var baselineEntry = baselineVersion.getEntry(this); | 1553 var baselineEntry = baselineVersion.getEntry(this); |
1480 if (!baselineEntry) return value; | 1554 if (!baselineEntry) return value; |
1481 if (baselineVersion === this.page.version) return value; | 1555 if (baselineVersion === this.page.version) return value; |
1482 return value - baselineEntry[property]; | 1556 return value - baselineEntry[property]; |
1483 } | 1557 } |
1484 cssClass() { | 1558 cssClass() { |
1485 return '' | 1559 return '' |
1486 } | 1560 } |
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1887 </tr> | 1961 </tr> |
1888 <tr> | 1962 <tr> |
1889 <td>Overall Impact:</td> | 1963 <td>Overall Impact:</td> |
1890 <td class="timeImpact"></td><td>±</td><td class="timePercentImpact"></td
> | 1964 <td class="timeImpact"></td><td>±</td><td class="timePercentImpact"></td
> |
1891 <td class="compare timeImpact"></td><td class="compare"> ± </td><td clas
s="compare timePercentImpact"></td> | 1965 <td class="compare timeImpact"></td><td class="compare"> ± </td><td clas
s="compare timePercentImpact"></td> |
1892 </tr> | 1966 </tr> |
1893 </table> | 1967 </table> |
1894 </div> | 1968 </div> |
1895 </body> | 1969 </body> |
1896 </html> | 1970 </html> |
OLD | NEW |