summaryrefslogtreecommitdiffstats
path: root/chromium/third_party/trace-viewer/examples/skia_debugger.html
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/trace-viewer/examples/skia_debugger.html')
-rw-r--r--chromium/third_party/trace-viewer/examples/skia_debugger.html155
1 files changed, 0 insertions, 155 deletions
diff --git a/chromium/third_party/trace-viewer/examples/skia_debugger.html b/chromium/third_party/trace-viewer/examples/skia_debugger.html
deleted file mode 100644
index cea536920dc..00000000000
--- a/chromium/third_party/trace-viewer/examples/skia_debugger.html
+++ /dev/null
@@ -1,155 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-Copyright (c) 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.
--->
-<head>
-<title>Skia Debugger</title>
-<script src="/src/base.js"></script>
-<style>
- picture-ops-list-view {
- height: 500px;
- overflow-y: auto;
- }
-</style>
-</head>
-<body>
- <div class="header">
- <select id="skp_file"></select>
- </div>
-
- <div class="view"></div>
-
- <script>
- base.require('cc.picture');
- base.require('cc.picture_debugger');
- </script>
- <script>
- 'use strict';
-
- var debuggerEl;
-
- function getPicture(skp64) {
- if (!cc.PictureSnapshot.CanGetInfo()) {
- console.error(cc.PictureSnapshot.HowToEnablePictureDebugging());
-
- var infoBar = new ui.InfoBar();
- var view = document.querySelector('.view');
-
- view.removeChild(debuggerEl);
- debuggerEl = undefined;
-
- view.appendChild(infoBar);
-
- infoBar.message = cc.PictureSnapshot.HowToEnablePictureDebugging();
- infoBar.visible = true;
- return undefined;
- }
-
- var size = chrome.skiaBenchmarking.getInfo(skp64);
- if (size === undefined)
- throw new Error('Unable to get picture information');
-
- return new cc.Picture(skp64,
- base.Rect.fromXYWH(0, 0, size.width, size.height),
- base.Rect.fromXYWH(0, 0, size.width, size.height));
- };
-
- function loadSkp(filename, onSkpLoaded) {
- getAsync(filename, function(trace) {
- onSkpLoaded(filename, trace);
- });
- }
-
- function getAsync(url, callback) {
- var req = new XMLHttpRequest();
- req.open('GET', url, true);
- req.onreadystatechange = function(aEvt) {
- if (req.readyState === 4) {
- window.setTimeout(function() {
- if (req.status === 200) {
- callback(req.responseText);
- } else {
- console.log('Failed to load ' + url);
- }
- }, 0);
- }
- };
- req.send(null);
- }
-
- function createViewFromSkp(filename, skp) {
- var p = getPicture(skp);
- if (p === undefined)
- return;
- debuggerEl.picture = p;
- }
-
- function onSelectionChange() {
- var select = document.querySelector('#skp_file');
- window.location.hash = '#' + select[select.selectedIndex].value;
- }
-
- function onHashChange() {
- var file = window.location.hash.substr(1);
- var select = document.querySelector('#skp_file');
- if (select[select.selectedIndex].value != file) {
- for (var i = 0; i < select.children.length; i++) {
- if (select.children[i].value == file) {
- select.selectedIndex = i;
- break;
- }
- }
- }
- reload();
- }
-
- function cleanFilename(file) {
- function upcase(letter) {
- return ' ' + letter.toUpperCase();
- }
- return file.replace(/_/g, ' ')
- .replace(/\.[^\.]*$/, '')
- .replace(/ ([a-z])/g, upcase)
- .replace(/^[a-z]/, upcase);
- }
-
- function reload() {
- var file = window.location.hash.substr(1);
- var filename = '/skp_data/' + file;
- loadSkp(filename, createViewFromSkp);
- }
-
- function onLoad() {
- debuggerEl = new cc.PictureDebugger()
- document.querySelector('.view').appendChild(debuggerEl);
-
- getAsync('/json/examples/skp', function(data) {
- var select = document.querySelector('#skp_file');
- var files = JSON.parse(data);
-
- for (var i = 0; i < files.length; ++i) {
- var opt = document.createElement('option');
- opt.value = files[i];
- opt.textContent = cleanFilename(files[i]);
- select.appendChild(opt);
- }
- select.selectedIndex = 0;
- select.onchange = onSelectionChange;
-
- if (!window.location.hash) {
- // This will trigger an onHashChange so no need to reload directly.
- window.location.hash = '#' + select[select.selectedIndex].value;
- } else {
- onHashChange();
- }
- });
- }
-
- window.addEventListener('hashchange', onHashChange);
- window.addEventListener('load', onLoad);
- </script>
-</body>
-</html>