function onLoad(){reload()}function reload(){if(linuxPerfData){var g=new tracing.TimelineModel;g.importEvents("[]",!0,[linuxPerfData]);var e=document.querySelector(".view");cr.ui.decorate(e,tracing.TimelineView);e.model=g;e.tabIndex=1;e.timeline.focusElement=e}}document.addEventListener("DOMContentLoaded",onLoad);var global=this;
this.cr=function(){function g(a,b,c,f){var e=new cr.Event(b+"Change");e.propertyName=b;e.newValue=c;e.oldValue=f;a.dispatchEvent(e)}function e(a){return a.replace(/([A-Z])/g,"-$1").toLowerCase()}function c(b,c){switch(c){case a.JS:var f=b+"_";return function(){return this[f]};case a.ATTR:var h=e(b);return function(){return this.getAttribute(h)};case a.BOOL_ATTR:return h=e(b),function(){return this.hasAttribute(h)}}}function f(b,c,f){switch(c){case a.JS:var h=b+"_";return function(a){var c=this[h];
a!==c&&(this[h]=a,f&&f.call(this,a,c),g(this,b,a,c))};case a.ATTR:var k=e(b);return function(a){var c=this[k];a!==c&&(void 0==a?this.removeAttribute(k):this.setAttribute(k,a),f&&f.call(this,a,c),g(this,b,a,c))};case a.BOOL_ATTR:return k=e(b),function(a){var c=this[k];a!==c&&(a?this.setAttribute(k,b):this.removeAttribute(k),f&&f.call(this,a,c),g(this,b,a,c))}}}function h(a,b,c){var f=cr.doc.createEvent("Event");f.initEvent(a,!!b,!!c);f.__proto__=global.Event.prototype;return f}var a={JS:"js",ATTR:"attr",
BOOL_ATTR:"boolAttr"},b=1;return{addSingletonGetter:function(a){a.getInstance=function(){return a.instance_||(a.instance_=new a)}},createUid:function(){return b++},define:function(a,b){var c;c=a.split(".");for(var f=global,e;c.length&&(e=c.shift());)f=e in f?f[e]:f[e]={};c=f;var f=b(),h;for(h in f)(e=Object.getOwnPropertyDescriptor(f,h))&&Object.defineProperty(c,h,e)},defineProperty:function(b,e,h,g){"function"==typeof b&&(b=b.prototype);h=h||a.JS;b.__lookupGetter__(e)||b.__defineGetter__(e,c(e,h));
b.__lookupSetter__(e)||b.__defineSetter__(e,f(e,h,g))},dispatchPropertyChange:g,dispatchSimpleEvent:function(a,b,c,f){b=new cr.Event(b,c,f);return a.dispatchEvent(b)},Event:h,getUid:function(a){return a.hasOwnProperty("uid")?a.uid:a.uid=b++},initialize:function(){if(global.document)h.prototype={__proto__:global.Event.prototype},cr.isMac=/Mac/.test(navigator.platform),cr.isWindows=/Win/.test(navigator.platform),cr.isChromeOS=/CrOS/.test(navigator.userAgent),cr.isLinux=/Linux/.test(navigator.userAgent),
cr.isGTK=/GTK/.test(chrome.toolkit),cr.isViews=/views/.test(chrome.toolkit),cr.isTouchOptimized=!!chrome.touchOptimized,cr.isTouchOptimized&&doc.documentElement.setAttribute("touch-optimized","");else{var a=cr;Object.defineProperty(global,"cr",{get:function(){Object.defineProperty(global,"cr",{value:a});a.initialize();return a},configurable:!0})}},PropertyKind:a,get doc(){return document}}}();cr.initialize();cr.define("cr",function(){function g(){}g.prototype={addEventListener:function(e,c){this.listeners_||(this.listeners_=Object.create(null));if(e in this.listeners_){var f=this.listeners_[e];0>f.indexOf(c)&&f.push(c)}else this.listeners_[e]=[c]},removeEventListener:function(e,c){if(this.listeners_&&e in this.listeners_){var f=this.listeners_[e],h=f.indexOf(c);0<=h&&(1==f.length?delete this.listeners_[e]:f.splice(h,1))}},dispatchEvent:function(e){if(!this.listeners_)return!0;var c=this;e.__defineGetter__("target",
function(){return c});e.preventDefault=function(){this.returnValue=!1};var f=e.type,h=0;if(f in this.listeners_)for(var f=this.listeners_[f].concat(),a=0,b;b=f[a];a++)h=b.handleEvent?h|!1===b.handleEvent.call(b,e):h|!1===b.call(this,e);return!h&&e.returnValue}};return{EventTarget:g}});cr.define("cr.ui",function(){function g(e,c){return(c&&c.ownerDocument?c.ownerDocument:cr.doc).createElement(e)}return{decorate:function(e,c){var f;f="string"==typeof e?cr.doc.querySelectorAll(e):[e];for(var h=0,a;a=f[h];h++)a instanceof c||c.decorate(a)},define:function(e){function c(a){var b=f(h,a);c.decorate(b);for(var d in a)b[d]=a[d];return b}var f,h;"function"==typeof e?(f=e,h=""):(f=g,h=e);c.decorate=function(a){a.__proto__=c.prototype;a.decorate()};return c},limitInputWidth:function(e,c,f){function h(){if(e.scrollWidth>
j)e.style.width=j+"px";else{e.style.width=0;var a=e.scrollWidth;e.style.width=a<f?f+"px":a+"px"}}e.style.width="10px";var a=e.ownerDocument.defaultView,b=a.getComputedStyle(e),a=a.getComputedStyle(c),d="rtl"==b.direction,m=e.getBoundingClientRect(),g=c.getBoundingClientRect(),m=d?g.right-m.right:m.left-g.left,b=parseInt(b.borderLeftWidth,10)+parseInt(b.paddingLeft,10)+parseInt(b.paddingRight,10)+parseInt(b.borderRightWidth,10),a=d?parseInt(a.paddingLeft,10):parseInt(a.paddingRight,10),j=c.clientWidth-
m-b-a;e.addEventListener("input",h);h()}}});cr.define("cr.ui",function(){function g(c){this.classList_=c.documentElement.classList;var f=this;c.addEventListener("keydown",function(c){9==c.keyCode&&(f.visible=!0)},!0);c.addEventListener("mousedown",function(){f.visible=!1},!0)}g.prototype={set visible(c){c?this.classList_.add("focus-outline-visible"):this.classList_.remove("focus-outline-visible")},get visible(){this.classList_.contains("focus-outline-visible")}};var e=[];g.forDocument=function(c){for(var f=0;f<e.length;f++)if(c==e[f][0])return e[f][1];
f=new g(c);e.push([c,f]);return f};return{FocusOutlineManager:g}});cr.define("cr.ui",function(){function g(){for(var b={TABBOX:e,TABS:c,TAB:f,TABPANELS:h,TABPANEL:a},d,m=0;d=this.children[m];m++){var g=b[d.tagName];g&&cr.ui.decorate(d,g)}}var e=cr.ui.define("tabbox");e.prototype={__proto__:HTMLElement.prototype,decorate:function(){g.call(this);this.addEventListener("selectedChange",this.handleSelectedChange_,!0);this.selectedIndex=0},handleSelectedChange_:function(a){var d=a.target;a.newValue&&(d.parentElement&&d.parentElement.parentElement)==this&&(this.selectedIndex=
Array.prototype.indexOf.call(d.parentElement.children,d))},selectedIndex_:-1};cr.defineProperty(e,"selectedIndex",cr.PropertyKind.JS_PROP,function(a){for(var d,c,f=0;d=this.children[f];f++)for(var e=0;c=d.children[e];e++)c.selected=e==a});var c=cr.ui.define("tabs");c.prototype={__proto__:HTMLElement.prototype,decorate:function(){g.call(this);this.tabIndex=0;this.addEventListener("keydown",this.handleKeyDown_.bind(this));this.focusOutlineManager_=cr.ui.FocusOutlineManager.forDocument(this.ownerDocument)},
handleKeyDown_:function(a){var d=0;switch(a.keyIdentifier){case "Left":case "Up":d=-1;break;case "Right":case "Down":d=1}d&&("rtl"==this.ownerDocument.defaultView.getComputedStyle(this).direction&&(d*=-1),a=this.children.length,this.parentElement.selectedIndex=(this.parentElement.selectedIndex+d+a)%a,this.focusOutlineManager_.visible=!0)}};var f=cr.ui.define("tab");f.prototype={__proto__:HTMLElement.prototype,decorate:function(){var a=this;this.addEventListener(cr.isMac?"click":"mousedown",function(){a.selected=
!0})}};cr.defineProperty(f,"selected",cr.PropertyKind.BOOL_ATTR);var h=cr.ui.define("tabpanels");h.prototype={__proto__:HTMLElement.prototype,decorate:g};var a=cr.ui.define("tabpanel");a.prototype={__proto__:HTMLElement.prototype,decorate:function(){}};cr.defineProperty(a,"selected",cr.PropertyKind.BOOL_ATTR);return{TabBox:e,Tabs:c,Tab:f,TabPanels:h,TabPanel:a}});global=this;function $(g){return document.getElementById(g)}function chromeSend(g,e,c,f){var h=global[c];global[c]=function(){global[c]=h;var a=Array.prototype.slice.call(arguments);return f.apply(global,a)};chrome.send(g,e)}function url(g){g=g.replace(/(\(|\)|\,|\s|\'|\"|\\)/g,"\\$1");/\\\\$/.test(g)&&(g+=" ");return'url("'+g+'")'}function parseQueryParams(g){for(var e={},g=unescape(g.search.substring(1)).split("&"),c=0;c<g.length;c++){var f=g[c].split("=");e[f[0]]=f[1]}return e}
function findAncestorByClass(g,e){return findAncestor(g,function(c){return c.classList?c.classList.contains(e):null})}function findAncestor(g,e){for(var c=!1;null!=g&&!(c=e(g));)g=g.parentNode;return c?g:null}function swapDomNodes(g,e){var c=g.nextSibling;if(c==e)swapDomNodes(e,g);else{var f=g.parentNode;e.parentNode.replaceChild(g,e);f.insertBefore(e,c)}}
function disableTextSelectAndDrag(){document.onselectstart=function(g){g.preventDefault()};document.ondragstart=function(g){g.preventDefault()}}function isRTL(){return"rtl"==document.documentElement.dir}function assert(g,e){if(!g){var c="Assertion failed";e&&(c=c+": "+e);throw Error(c);}}function getRequiredElement(g){var e=$(g);assert(e,"Missing required element: "+g);return e}
document.addEventListener("click",function(g){if(g.returnValue){var e=g.target;if(e.nodeType==Node.ELEMENT_NODE&&e.webkitMatchesSelector("A, A *")){for(;"A"!=e.tagName;)e=e.parentElement;if(("file:"==e.protocol||"about:"==e.protocol)&&(0==g.button||1==g.button))chrome.send("navigateToUrl",[e.href,e.target,g.button,g.altKey,g.ctrlKey,g.metaKey,g.shiftKey]),g.preventDefault()}}});function appendParam(g,e,c){e=encodeURIComponent(e)+"="+encodeURIComponent(c);return-1==g.indexOf("?")?g+"?"+e:g+"&"+e};cr.define("tracing",function(){var g=cr.ui.define("div");g.prototype={__proto__:HTMLDivElement.prototype,decorate:function(){this.classList.add("overlay-root");this.visible=!1;this.contentHost=this.ownerDocument.createElement("div");this.contentHost.classList.add("content-host");this.tabCatcher=this.ownerDocument.createElement("span");this.tabCatcher.tabIndex=0;this.appendChild(this.contentHost);this.onKeydownBoundToThis_=this.onKeydown_.bind(this);this.onFocusInBoundToThis_=this.onFocusIn_.bind(this);
this.addEventListener("mousedown",this.onMousedown_.bind(this))},showOverlay:function(c){c.oldParent_=c.parentNode;this.contentHost.appendChild(c);this.contentHost.appendChild(this.tabCatcher);this.ownerDocument.body.classList.add("disabled-by-overlay");this.visible=!0;c.tabIndex=0;var f=c.querySelector("button, input, list, select, a");f||(f=c);f.focus();this.ownerDocument.addEventListener("focusin",this.onFocusInBoundToThis_,!0);c.addEventListener("keydown",this.onKeydownBoundToThis_)},onMousedown_:function(c){c.target==
this&&c.preventDefault()},onFocusIn_:function(c){c.target==this.tabCatcher&&window.setTimeout(this.focusOverlay_.bind(this),0)},focusOverlay_:function(){this.contentHost.firstChild.focus()},onKeydown_:function(c){9==c.keyCode&&(c.shiftKey&&c.target==this.contentHost.firstChild)&&c.preventDefault()},hideOverlay:function(c){this.visible=!1;this.ownerDocument.body.classList.remove("disabled-by-overlay");this.lastFocusOut_=void 0;c.parentNode.removeChild(this.tabCatcher);c.oldParent_?(c.oldParent_.appendChild(c),
delete c.oldParent_):this.contentHost.removeChild(c);c.removeEventListener("keydown",this.onKeydownBoundToThis_);this.ownerDocument.removeEventListener("focusin",this.onFocusInBoundToThis_)}};cr.defineProperty(g,"visible",cr.PropertyKind.BOOL_ATTR);var e=cr.ui.define("div");e.prototype={__proto__:HTMLDivElement.prototype,decorate:function(){if(!this.ownerDocument.querySelector(".overlay-root")){var c=this.ownerDocument.createElement("div");cr.ui.decorate(c,g);this.ownerDocument.body.appendChild(c)}this.classList.add("overlay");
this.visible=!1},onVisibleChanged_:function(){var c=this.ownerDocument.querySelector(".overlay-root");this.visible?c.showOverlay(this):c.hideOverlay(this)}};cr.defineProperty(e,"visible",cr.PropertyKind.BOOL_ATTR,e.prototype.onVisibleChanged_);return{Overlay:e}});cr.define("tracing",function(){function g(){this.overlay_=document.createElement("div");this.overlay_.className="tracing-overlay";cr.ui.decorate(this.overlay_,tracing.Overlay);this.statusDiv_=document.createElement("div");this.overlay_.appendChild(this.statusDiv_);this.bufferPercentDiv_=document.createElement("div");this.overlay_.appendChild(this.bufferPercentDiv_);this.stopButton_=document.createElement("button");this.stopButton_.onclick=this.endTracing.bind(this);this.stopButton_.textContent="Stop tracing";
this.overlay_.appendChild(this.stopButton_);this.traceEvents_=[];this.systemTraceEvents_=[];this.onKeydownBoundToThis_=this.onKeydown_.bind(this);this.onKeypressBoundToThis_=this.onKeypress_.bind(this);chrome.send("tracingControllerInitialized")}g.prototype={__proto__:cr.EventTarget.prototype,gpuInfo_:void 0,clientInfo_:void 0,tracingEnabled_:!1,tracingEnding_:!1,systemTraceDataFilename_:void 0,onRequestBufferPercentFullComplete:function(e){this.overlay_.visible&&(window.setTimeout(this.beginRequestBufferPercentFull_.bind(this),
250),this.bufferPercentDiv_.textContent="Buffer usage: "+Math.round(100*e)+"%")},beginRequestBufferPercentFull_:function(){chrome.send("beginRequestBufferPercentFull")},beginTracing:function(e){if(this.tracingEnabled_)throw Error("Tracing already begun.");this.stopButton_.hidden=!1;this.statusDiv_.textContent="Tracing active.";this.tracingEnabled_=this.overlay_.visible=!0;console.log("Beginning to trace...");this.statusDiv_.textContent="Tracing active.";this.traceEvents_=[];this.systemTraceEvents_=
[];chrome.send("beginTracing",[e||!1]);this.beginRequestBufferPercentFull_();e=new cr.Event("traceBegun");e.events=this.traceEvents_;this.dispatchEvent(e);e=new cr.Event("traceEventsChanged");e.numEvents=this.traceEvents_.length;this.dispatchEvent(e);window.addEventListener("keypress",this.onKeypressBoundToThis_);window.addEventListener("keydown",this.onKeydownBoundToThis_)},onKeydown_:function(e){27==e.keyCode&&this.endTracing()},onKeypress_:function(e){"Enter"==e.keyIdentifier&&this.endTracing()},
onClientInfoUpdate:function(e){this.clientInfo_=e},onGpuInfoUpdate:function(e){this.gpuInfo_=e},get isTracingEnabled(){return this.tracingEnabled_},get traceEvents(){return this.traceEvents_},onTraceDataCollected:function(e){this.statusDiv_.textContent="Processing trace...";this.traceEvents_.push.apply(this.traceEvents_,e)},endTracing:function(){if(!this.tracingEnabled_)throw Error("Tracing not begun.");this.tracingEnding_||(this.tracingEnding_=!0,this.statusDiv_.textContent="Ending trace...",console.log("Finishing trace"),
this.statusDiv_.textContent="Downloading trace data...",this.stopButton_.hidden=!0,window.setTimeout(function(){chrome.send("endTracingAsync")},100))},onEndTracingComplete:function(){window.removeEventListener("keydown",this.onKeydownBoundToThis_);window.removeEventListener("keypress",this.onKeypressBoundToThis_);this.tracingEnding_=this.tracingEnabled_=this.overlay_.visible=!1;console.log("onEndTracingComplete p1 with "+this.traceEvents_.length+" events.");var e=new cr.Event("traceEnded");e.events=
this.traceEvents_;this.dispatchEvent(e)},onSystemTraceDataCollected:function(e){console.log("onSystemTraceDataCollected with "+e.length+" chars of data.");this.systemTraceEvents_=e},get systemTraceEvents(){return this.systemTraceEvents_},beginLoadTraceFile:function(){chrome.send("loadTraceFile")},onLoadTraceFileComplete:function(e){e.traceEvents?this.traceEvents_=e.traceEvents:e.length?this.traceEvents_=e:console.log("Expected an array when loading the trace file");e.systemTraceEvents?this.systemTraceEvents_=
e.systemTraceEvents:e.length?this.systemTraceEvents_=e:console.log("Expected an array when loading the trace file");e=new cr.Event("loadTraceFileComplete");e.events=this.traceEvents_;this.dispatchEvent(e)},onLoadTraceFileCanceled:function(){cr.dispatchSimpleEvent(this,"loadTraceFileCanceled")},beginSaveTraceFile:function(){chrome.send("saveTraceFile",[JSON.stringify({traceEvents:this.traceEvents_,systemTraceEvents:this.systemTraceEvents_,clientInfo:this.clientInfo_,gpuInfo:this.gpuInfo_})])},onSaveTraceFileComplete:function(){cr.dispatchSimpleEvent(this,
"saveTraceFileComplete")},onSaveTraceFileCanceled:function(){cr.dispatchSimpleEvent(this,"saveTraceFileCanceled")},selfTest:function(){this.beginTracing();window.setTimeout(this.endTracing.bind(This),500)}};return{TracingController:g}});cr.define("tracing",function(){function g(a,b,d,c,f){this.title=a;this.start=d;this.colorId=b;this.args=c;this.didNotFinish=!1;void 0!==f&&(this.duration=f)}function e(a,b,d,c,f){g.call(this,a,b,d,c,f);this.subSlices=[]}function c(a,b,d,c){g.call(this,a,b,d,c)}function f(a,b){if(!a)throw"Parent must be provided.";this.parent=a;this.tid=b;this.subRows=[[]];this.asyncSlices=new d(this.ptid)}function h(a,b,d){this.parent=a;this.id=b;this.name=d;this.seriesNames=[];this.seriesColors=[];this.timestamps=
[];this.samples=[]}function a(a){this.pid=a;this.threads={};this.counters={}}function b(a){this.cpuNumber=a;this.slices=[];this.counters={}}function d(a){this.name=a;this.slices=[]}function m(a){for(var b=0,d=0;d<a.length;++d)b=(b+37*b+11*a.charCodeAt(d))%4294967295;return b}function i(a,b){this.cpus={};this.processes={};this.importErrors=[];this.asyncSliceGroups={};a&&this.importEvents(a,b)}function j(){}function k(a){this.text_=a}g.prototype={selected:!1,duration:void 0,get end(){return this.start+
this.duration}};e.prototype={__proto__:g.prototype};c.prototype={__proto__:g.prototype,id:void 0,startThread:void 0,endThread:void 0,subSlices:void 0};var l={};f.getPTIDFromPidAndTid=function(a,b){l[a]||(l[a]={});l[a][b]||(l[a][b]=a+":"+b);return l[a][b]};f.prototype={name:void 0,get ptid(){return f.getPTIDFromPidAndTid(this.tid,this.parent.pid)},getSubrow:function(a){for(;a>=this.subRows.length;)this.subRows.push([]);return this.subRows[a]},shiftSubRow_:function(a,b){for(var d=0;d<a.length;d++){var c=
a[d];c.start+=b}},shiftTimestampsForward:function(a){this.cpuSlices&&this.shiftSubRow_(this.cpuSlices,a);for(var b=0;b<this.subRows.length;b++)this.shiftSubRow_(this.subRows[b],a);this.asyncSlices.shiftTimestampsForward(a)},updateBounds:function(){var a=[],b;0!=this.subRows[0].length&&(b=this.subRows[0],a.push(b[0].start),a.push(b[b.length-1].end));this.asyncSlices.slices.length&&(this.asyncSlices.updateBounds(),a.push(this.asyncSlices.minTimestamp),a.push(this.asyncSlices.maxTimestamp));a.length?
(this.minTimestamp=Math.min.apply(Math,a),this.maxTimestamp=Math.max.apply(Math,a)):this.maxTimestamp=this.minTimestamp=void 0},get userFriendlyName(){return this.parent.pid+": "+(this.name||this.tid)},get userFriendlyDetails(){return"pid: "+this.parent.pid+", tid: "+this.tid+(this.name?", name: "+this.name:"")}};f.compare=function(b,d){if(b.parent.pid!=d.parent.pid)return a.compare(b.parent,d.parent.pid);if(b.name&&d.name){var c=b.name.localeCompare(d.name);return 0==c?b.tid-d.tid:c}return b.name?
-1:d.name?1:b.tid-d.tid};h.prototype={__proto__:Object.prototype,get numSeries(){return this.seriesNames.length},get numSamples(){return this.timestamps.length},shiftTimestampsForward:function(a){for(var b=0;b<this.timestamps.length;b++)this.timestamps[b]+=a},updateBounds:function(){if(this.seriesNames.length!=this.seriesColors.length)throw"seriesNames.length must match seriesColors.length";if(this.numSeries*this.numSamples!=this.samples.length)throw"samples.length must be a multiple of numSamples.";
this.totals=[];if(0==this.samples.length)this.maxTimestamp=this.minTimestamp=void 0,this.maxTotal=0;else{this.minTimestamp=this.timestamps[0];this.maxTimestamp=this.timestamps[this.timestamps.length-1];for(var a=this.numSeries,b=-Infinity,d=0;d<this.timestamps.length;d++){for(var c=0,f=0;f<a;f++)c+=this.samples[d*a+f],this.totals.push(c);c>b&&(b=c)}this.maxTotal=b}}};h.compare=function(b,d){if(b.parent.pid!=d.parent.pid)return a.compare(b.parent,d.parent.pid);var c=b.name.localeCompare(d.name);return 0==
c?b.tid-d.tid:c};a.prototype={get numThreads(){var a=0,b;for(b in this.threads)a++;return a},shiftTimestampsForward:function(a){for(var b in this.threads)this.threads[b].shiftTimestampsForward(a);for(var d in this.counters)this.counters[d].shiftTimestampsForward(a)},getOrCreateThread:function(a){this.threads[a]||(this.threads[a]=new f(this,a));return this.threads[a]},getOrCreateCounter:function(a,b){var d=a+"."+b;this.counters[d]||(this.counters[d]=new h(this,d,b));return this.counters[d]}};a.compare=
function(a,b){return a.pid-b.pid};b.prototype={getOrCreateCounter:function(a,b){var d;d=a.length?a+"."+b:b;this.counters[d]||(this.counters[d]=new h(this,d,b));return this.counters[d]},shiftTimestampsForward:function(a){for(var b=0;b<this.slices.length;b++)this.slices[b].start+=a;for(var d in this.counters)this.counters[d].shiftTimestampsForward(a)},updateBounds:function(){this.slices.length?(this.minTimestamp=this.slices[0].start,this.maxTimestamp=this.slices[this.slices.length-1].end):this.maxTimestamp=
this.minTimestamp=void 0}};b.compare=function(a,b){return a.cpuNumber-b.cpuNumber};d.prototype={__proto__:Object.prototype,push:function(a){this.slices.push(a)},get length(){return this.slices.length},subRows_:void 0,sortSlices_:function(){this.slices.sort(function(a,b){return a.start-b.start})},shiftTimestampsForward:function(a){for(var b=0;b<this.slices.length;b++){var d=this.slices[b];d.start+=a;for(var c=0;c<d.subSlices.length;c++)d.subSlices[c].start+=a}},updateBounds:function(){this.sortSlices_();
this.slices.length?(this.minTimestamp=this.slices[0].start,this.maxTimestamp=this.slices[this.slices.length-1].end):this.maxTimestamp=this.minTimestamp=void 0;this.subRows_=void 0},get subRows(){this.subRows_||this.rebuildSubRows_();return this.subRows_},rebuildSubRows_:function(){this.sortSlices_();for(var a=[],b=0;b<this.slices.length;b++){for(var d=this.slices[b],c=!1,f=0;f<a.length;f++){var e=a[f];if(d.start>=e[e.length-1].end){c=!0;if(void 0===d.subSlices||1>d.subSlices.length)throw"TimelineAsyncEvent missing subSlices: "+
d.name;for(f=0;f<d.subSlices.length;f++)e.push(d.subSlices[f]);break}}if(!c&&(e=[],void 0!==d.subSlices)){for(f=0;f<d.subSlices.length;f++)e.push(d.subSlices[f]);a.push(e)}}this.subRows_=a},computeSubGroups:function(){for(var a={},b=0;b<this.slices.length;++b){var c=this.slices[b],f=c.startThread.ptid;a[f]||(a[f]=new d(this.name));a[f].slices.push(c)}var b=[],e;for(e in a)c=a[e],c.updateBounds(),b.push(c);return b}};h.compare=function(b,d){if(b.parent.pid!=d.parent.pid)return a.compare(b.parent,d.parent.pid);
var c=b.name.localeCompare(d.name);return 0==c?b.tid-d.tid:c};var o=[{r:138,g:113,b:152},{r:175,g:112,b:133},{r:127,g:135,b:225},{r:93,g:81,b:137},{r:116,g:143,b:119},{r:178,g:214,b:122},{r:87,g:109,b:147},{r:119,g:155,b:95},{r:114,g:180,b:160},{r:132,g:85,b:103},{r:157,g:210,b:150},{r:148,g:94,b:86},{r:164,g:108,b:138},{r:139,g:191,b:150},{r:110,g:99,b:145},{r:80,g:129,b:109},{r:125,g:140,b:149},{r:93,g:124,b:132},{r:140,g:85,b:140},{r:104,g:163,b:162},{r:132,g:141,b:178},{r:131,g:105,b:147},{r:135,
g:183,b:98},{r:152,g:134,b:177},{r:141,g:188,b:141},{r:133,g:160,b:210},{r:126,g:186,b:148},{r:112,g:198,b:205},{r:180,g:122,b:195},{r:203,g:144,b:152},{r:182,g:125,b:143},{r:126,g:200,b:148},{r:133,g:160,b:210},{r:240,g:240,b:240}],q=o.length-4,u=o.length,v=o.concat(o.map(function(a){var b;b=240<=a.r&&240<=a.g&&240<=a.b?-0.2:0.45;return{r:Math.min(255,a.r+Math.floor(a.r*b)),g:Math.min(255,a.g+Math.floor(a.g*b)),b:Math.min(255,a.b+Math.floor(a.b*b))}})).map(function(a){return"rgb("+a.r+","+a.g+","+
a.b+")"}),t={},y=[];i.registerImporter=function(a){y.push(a)};j.canImport=function(a){return a instanceof Array&&0==a.length?!0:"string"===typeof a||a instanceof String?0==a.length:!1};j.prototype={__proto__:Object.prototype,importEvents:function(){},finalizeImport:function(){}};i.registerImporter(j);i.prototype={__proto__:cr.EventTarget.prototype,get numProcesses(){var a=0,b;for(b in this.processes)a++;return a},getOrCreateCpu:function(a){this.cpus[a]||(this.cpus[a]=new b(a));return this.cpus[a]},
getOrCreateProcess:function(b){this.processes[b]||(this.processes[b]=new a(b));return this.processes[b]},pruneEmptyThreads:function(){for(var a in this.processes){var b=this.processes[a],d={},c;for(c in b.threads){for(var f=b.threads[c],e=!1,q=0;q<f.subRows.length;q++)e|=0<f.subRows[q].length;if(e||0<f.asyncSlices.length)d[c]=f}b.threads=d}},updateBounds:function(){for(var a=Infinity,b=-a,d=!1,c=this.getAllThreads(),f=0;f<c.length;f++){var e=c[f];e.updateBounds();void 0!=e.minTimestamp&&void 0!=e.maxTimestamp&&
(a=Math.min(a,e.minTimestamp),b=Math.max(b,e.maxTimestamp),d=!0)}c=this.getAllCounters();for(f=0;f<c.length;f++)e=c[f],e.updateBounds(),void 0!=e.minTimestamp&&void 0!=e.maxTimestamp&&(d=!0,a=Math.min(a,e.minTimestamp),b=Math.max(b,e.maxTimestamp));for(var q in this.cpus)f=this.cpus[q],f.updateBounds(),void 0!=f.minTimestamp&&void 0!=f.maxTimestamp&&(d=!0,a=Math.min(a,f.minTimestamp),b=Math.max(b,f.maxTimestamp));d?(this.minTimestamp=a,this.maxTimestamp=b):this.minTimestamp=this.maxTimestamp=void 0},
shiftWorldToZero:function(){if(void 0!==this.minTimestamp){var a=this.minTimestamp,b;for(b in this.processes)this.processes[b].shiftTimestampsForward(-a);for(var d in this.cpus)this.cpus[d].shiftTimestampsForward(-a);this.updateBounds()}},getAllThreads:function(){var a=[],b;for(b in this.processes){var d=this.processes[b],c;for(c in d.threads)a.push(d.threads[c])}return a},getAllCpus:function(){var a=[],b;for(b in this.cpus)a.push(this.cpus[b]);return a},getAllProcesses:function(){var a=[],b;for(b in this.processes)a.push(this.processes[b]);
return a},getAllCounters:function(){var a=[],b;for(b in this.processes){var d=this.processes[b],c;for(c in d.counters)a.push(d.counters[c])}for(var f in this.cpus){b=this.cpus[f];for(var e in b.counters)a.push(b.counters[e])}return a},importOneTrace_:function(a,b){for(var d,c=0;c<y.length;++c)if(y[c].canImport(a)){d=y[c];break}if(!d)throw"Could not find an importer for the provided eventData.";d=new d(this,a,b);d.importEvents();return d},importEvents:function(a,b,d){void 0===b&&(b=!0);var c=[],a=
this.importOneTrace_(a,!1);c.push(a);if(d)for(var f=0;f<d.length;++f)a=this.importOneTrace_(d[f],!0),c.push(a);for(f=0;f<c.length;++f)c[f].finalizeImport();for(f=0;f<c.length;++f)this.pruneEmptyThreads();this.updateBounds();b&&this.shiftWorldToZero();b&&(void 0!==this.minTimestamp&&void 0!==this.maxTimestamp)&&(b=0.15*(this.maxTimestamp-this.minTimestamp),this.minTimestamp-=b,this.maxTimestamp+=b)}};k.prototype={__proto__:Object.prototype,matchSlice:function(a){return 0==this.text_.length?!1:-1!=
a.title.indexOf(this.text_)}};return{getPallette:function(){return v},getPalletteHighlightIdBoost:function(){return u},getColorIdByName:function(a){if("iowait"==a)return q;if("running"==a)return q+1;if("runnable"==a)return q+2;if("sleeping"==a)return q+3;throw"Unrecognized color "+a;},getStringHash:m,getStringColorId:function(a){if(void 0===t[a]){var b=m(a);t[a]=b%q}return t[a]},TimelineSlice:g,TimelineThreadSlice:e,TimelineAsyncSlice:c,TimelineThread:f,TimelineCounter:h,TimelineProcess:a,TimelineCpu:b,
TimelineAsyncSliceGroup:d,TimelineModel:i,TimelineFilter:k}});cr.define("tracing",function(){function g(a){this.cpu=a}function e(){this.openSlices=[]}function c(a,b,d){this.isAdditionalImport_=d;this.model_=a;this.events_=b;this.clockSyncRecords_=[];this.cpuStates_={};this.kernelThreadStates_={};this.buildMapFromLinuxPidsToTimelineThreads();this.lineNumber=-1;this.threadStateByKPID_={}}g.prototype={__proto__:Object.prototype,switchRunningLinuxPid:function(a,b,d,c,f,e){if(void 0!==this.lastActivePid&&0!=this.lastActivePid){var h=d-this.lastActiveTs;name=(a=a.threadsByLinuxPid[this.lastActivePid])?
a.userFriendlyName:this.lastActiveComm;this.cpu.slices.push(new tracing.TimelineSlice(name,tracing.getStringColorId(name),this.lastActiveTs,{comm:this.lastActiveComm,tid:this.lastActivePid,prio:this.lastActivePrio,stateWhenDescheduled:b},h))}this.lastActiveTs=d;this.lastActivePid=c;this.lastActiveComm=f;this.lastActivePrio=e}};TestExports={};var f=/^\s*(.+?)\s+\[(\d+)\]\s*([d.][N.][sh.][\d.])?\s*(\d+\.\d+):\s+(\S+):\s(.*)$/;TestExports.lineRE=f;var h=/trace_event_clock_sync: parent_ts=(\d+\.?\d*)/;
TestExports.traceEventClockSyncRE=h;c.canImport=function(a){if(!("string"===typeof a||a instanceof String))return!1;if(/^# tracer:/.exec(a))return!0;var b=/^(.+)\n/.exec(a);b&&(a=b[1]);return f.exec(a)?!0:!1};c.prototype={__proto__:Object.prototype,buildMapFromLinuxPidsToTimelineThreads:function(){this.threadsByLinuxPid={};this.model_.getAllThreads().forEach(function(a){this.threadsByLinuxPid[a.tid]=a}.bind(this))},getOrCreateCpuState:function(a){if(!this.cpuStates_[a]){var b=this.model_.getOrCreateCpu(a);
this.cpuStates_[a]=new g(b)}return this.cpuStates_[a]},parsePid:function(a){a=/.+-(\d+)/.exec(a)[1];return a=parseInt(a)},parseThreadName:function(a){return/(.+)-\d+/.exec(a)[1]},getOrCreateKernelThread:function(a,b,d){this.kernelThreadStates_[a]||(void 0==b&&(b=this.parsePid(a)),void 0==d&&(d=b),d=this.model_.getOrCreateProcess(b).getOrCreateThread(d),d.name=a,this.kernelThreadStates_[a]={pid:b,thread:d,openSlice:void 0,openSliceTS:void 0},this.threadsByLinuxPid[b]=d);return this.kernelThreadStates_[a]},
importEvents:function(){this.importCpuData();this.alignClocks()&&this.buildPerThreadCpuSlicesFromCpuState()},finalizeImport:function(){},buildPerThreadCpuSlicesFromCpuState:function(){for(var a in this.cpuStates_)for(var b=this.cpuStates_[a].cpu,d=0;d<b.slices.length;d++){var c=b.slices[d],f=this.threadsByLinuxPid[c.args.tid];f&&(f.tempCpuSlices||(f.tempCpuSlices=[]),c.index=d,f.tempCpuSlices.push(c))}var e=tracing.getColorIdByName("running"),h=tracing.getColorIdByName("runnable"),g=tracing.getColorIdByName("sleeping"),
o=tracing.getColorIdByName("iowait");this.model_.getAllThreads().forEach(function(a){if(a.tempCpuSlices){var b=a.tempCpuSlices;delete a.tempCpuSlices;b.sort(function(a,b){var d=a.start-b.start;return 0==d?a.index-b.index:d});var d=[];if(b.length){var c=b[0];d.push(new tracing.TimelineSlice("Running",e,c.start,{},c.duration))}for(c=1;c<b.length;c++){var f=b[c-1],m=b[c],i=m.start-f.end;if("S"==f.args.stateWhenDescheduled)d.push(new tracing.TimelineSlice("Sleeping",g,f.end,{},i));else if("R"==f.args.stateWhenDescheduled||
"R+"==f.args.stateWhenDescheduled)d.push(new tracing.TimelineSlice("Runnable",h,f.end,{},i));else if("D"==f.args.stateWhenDescheduled)d.push(new tracing.TimelineSlice("Uninterruptible Sleep",o,f.end,{},i));else if("T"==f.args.stateWhenDescheduled)d.push(new tracing.TimelineSlice("__TASK_STOPPED",o,f.end,{},i));else if("t"==f.args.stateWhenDescheduled)d.push(new tracing.TimelineSlice("debug",o,f.end,{},i));else if("Z"==f.args.stateWhenDescheduled)d.push(new tracing.TimelineSlice("Zombie",o,f.end,{},
i));else if("X"==f.args.stateWhenDescheduled)d.push(new tracing.TimelineSlice("Exit Dead",o,f.end,{},i));else if("x"==f.args.stateWhenDescheduled)d.push(new tracing.TimelineSlice("Task Dead",o,f.end,{},i));else if("W"==f.args.stateWhenDescheduled)d.push(new tracing.TimelineSlice("WakeKill",o,f.end,{},i));else if("D|W"==f.args.stateWhenDescheduled)d.push(new tracing.TimelineSlice("Uninterruptable Sleep | WakeKill",o,f.end,{},i));else throw"Unrecognized state: "+f.args.stateWhenDescheduled;d.push(new tracing.TimelineSlice("Running",
e,m.start,{},m.duration))}a.cpuSlices=d}})},alignClocks:function(){if(0==this.clockSyncRecords_.length){if(!this.isAdditionalImport_)return;this.abortImport();return!1}var a=this.clockSyncRecords_[0];if(0==a.parentTS||a.parentTS==a.perfTS)return!0;var a=a.parentTS-a.perfTS,b;for(b in this.cpuStates_){for(var d=this.cpuStates_[b].cpu,c=0;c<d.slices.length;c++){var f=d.slices[c];f.start+=a;f.duration=f.duration}for(var e in d.counters){c=d.counters[e];for(f=0;f<c.timestamps.length;f++)c.timestamps[f]+=
a}}for(var h in this.kernelThreadStates_){b=this.kernelThreadStates_[h].thread;for(c=0;c<b.subRows[0].length;c++)b.subRows[0][c].start+=a}return!0},abortImport:function(){if(this.pushedEventsToThreads)throw"Cannot abort, have alrady pushedCpuDataToThreads.";for(var a in this.cpuStates_)delete this.model_.cpus[a];for(var b in this.kernelThreadStates_){a=this.kernelThreadStates_[b].thread;var d=a.parent;delete d.threads[a.tid];delete this.model_.processes[d.pid]}this.model_.importErrors.push("Cannot import kernel trace without a clock sync.")},
markPidRunnable:function(){},importError:function(a){this.model_.importErrors.push("Line "+(this.lineNumber+1)+": "+a)},malformedEvent:function(a){this.importError("Malformed "+a+" event")},openSlice:function(a,b,d){a.openSliceTS=d;a.openSlice=b},closeSlice:function(a,b,d){a.openSlice&&(b=new tracing.TimelineSlice(a.openSlice,tracing.getStringColorId(a.openSlice),a.openSliceTS,d,b-a.openSliceTS),a.thread.subRows[0].push(b),a.openSlice=void 0)},getThreadState:function(a){return this.threadStateByKPID_[this.parsePid(a)]},
getOrCreateThreadState:function(a,b){var d=this.parsePid(a),c=this.threadStateByKPID_[d];c||(c=new e,c.threadName=this.parseThreadName(a),c.tid=d,c.pid=b,c.thread=this.model_.getOrCreateProcess(b).getOrCreateThread(d),c.thread.name||(c.thread.name=c.threadName),this.threadStateByKPID_[d]=c);return c},processBegin:function(a,b,d,c){a=this.getOrCreateThreadState(a,c);c=tracing.getStringColorId(b);b=new tracing.TimelineThreadSlice(b,c,d,null);a.openSlices.push(b)},processEnd:function(a,b){var d=this.getThreadState(a);
if(d&&0!=d.openSlices.length){var c=d.openSlices.pop();c.duration=b-c.start;d.thread.getSubrow(d.openSlices.length).push(c);d.openSlices.length&&d.openSlices[d.openSlices.length-1].subSlices.push(c)}},autoCloseOpenSlices:function(){this.model_.updateBounds();var a=[],b;for(b in this.threadStateByKPID_)for(var d=this.threadStateByKPID_[b],c=0;c<d.openSlices.length;c++){var f=d.openSlices[c];a.push(f.start);for(var e=0;e<f.subSlices.length;e++){var h=f.subSlices[e];a.push(h.start);h.duration&&a.push(h.end)}}a=
this.model_.maxTimestamp?Math.max(this.model_.maxTimestamp,Math.max.apply(Math,a)):Math.max.apply(Math,a);for(b in this.threadStateByKPID_)for(d=this.threadStateByKPID_[b];0<d.openSlices.length;)f=d.openSlices.pop(),f.duration=a-f.start,f.didNotFinish=!0,d.thread.getSubrow(d.openSlices.length).push(f),d.openSlices.length&&d.openSlices[d.openSlices.length-1].subSlices.push(f)},processCounter:function(a,b,d,c){a=this.model_.getOrCreateProcess(c).getOrCreateCounter("",a);0==a.numSeries&&(a.seriesNames.push("state"),
a.seriesColors.push(tracing.getStringColorId(a.name+".state")));a.timestamps.push(b);a.samples.push(d)},importCpuData:function(){this.lines_=this.events_.split("\n");for(this.lineNumber=0;this.lineNumber<this.lines_.length;++this.lineNumber){var a=this.lines_[this.lineNumber];if(!(/^#/.exec(a)||0==a.length)){var b=f.exec(a);if(b){var a=b[1],d=b[2],c=b[4],e=b[5],b=b[6],h=this.eventDefinitions[e];if(h){var g;if(h.format){if(g=h.format.exec(b),!g){this.malformedEvent(e);continue}}else g={};g.timestamp=
1E3*parseFloat(c);g.name=e;g.info=b;g.taskId=a;g.cpuState=this.getOrCreateCpuState(parseInt(d));h.handler&&h.handler(this,g)}else console.log("unknown event "+e)}else this.importError("Unrecognized line: "+a)}}},eventDefinitions:{sched_switch:{format:RegExp("prev_comm=(.+) prev_pid=(\\d+) prev_prio=(\\d+) prev_state=(\\S+) ==> next_comm=(.+) next_pid=(\\d+) next_prio=(\\d+)"),handler:function(a,b){var d=b[4],c=b[5],f=parseInt(b[6]),e=parseInt(b[7]);b.cpuState.switchRunningLinuxPid(a,d,b.timestamp,
f,c,e)}},sched_wakeup:{format:/comm=(.+) pid=(\d+) prio=(\d+) success=(\d+) target_cpu=(\d+)/,handler:function(a,b){var d=b[1],c=parseInt(b[2]),f=parseInt(b[3]);a.markPidRunnable(b.timestamp,c,d,f)}},power_start:{format:/type=(\d+) state=(\d) cpu_id=(\d)+/,handler:function(a,b){var d=parseInt(b[3]),d=a.getOrCreateCpuState(d);if("1"==b[1]){d=d.cpu.getOrCreateCounter("","C-State");0==d.numSeries&&(d.seriesNames.push("state"),d.seriesColors.push(tracing.getStringColorId(d.name+".state")));var c=parseInt(b[2]);
d.timestamps.push(b.timestamp);d.samples.push(c)}else a.importError("Don't understand power_start events of type "+b[1])}},power_frequency:{format:/type=(\d+) state=(\d+) cpu_id=(\d)+/,handler:function(a,b){var d=parseInt(b[3]),d=a.getOrCreateCpuState(d).cpu.getOrCreateCounter("","Power Frequency");0==d.numSeries&&(d.seriesNames.push("state"),d.seriesColors.push(tracing.getStringColorId(d.name+".state")));var c=parseInt(b[2]);d.timestamps.push(b.timestamp);d.samples.push(c)}},cpu_frequency:{format:/state=(\d+) cpu_id=(\d)+/,
handler:function(a,b){var d=parseInt(b[2]),d=a.getOrCreateCpuState(d).cpu.getOrCreateCounter("","Clock Frequency");0==d.numSeries&&(d.seriesNames.push("state"),d.seriesColors.push(tracing.getStringColorId(d.name+".state")));var c=parseInt(b[1]);d.timestamps.push(b.timestamp);d.samples.push(c)}},cpu_idle:{format:/state=(\d+) cpu_id=(\d)+/,handler:function(a,b){var d=parseInt(b[2]),d=a.getOrCreateCpuState(d).cpu.getOrCreateCounter("","C-State");0==d.numSeries&&(d.seriesNames.push("state"),d.seriesColors.push(tracing.getStringColorId(d.name)));
var c=parseInt(b[1]);4294967295!=c?d.samples.push(c):d.samples.push(0);d.timestamps.push(b.timestamp)}},workqueue_execute_start:{format:/work struct (.+): function (\S+)/,handler:function(a,b){var d=a.getOrCreateKernelThread(b.taskId);a.openSlice(d,b[2],b.timestamp)}},workqueue_execute_end:{format:/work struct (.+)/,handler:function(a,b){var d=a.getOrCreateKernelThread(b.taskId);a.closeSlice(d,b.timestamp,{})}},workqueue_queue_work:{},workqueue_activate_work:{},i915_gem_object_pwrite:{format:/obj=(.+), offset=(\d+), len=(\d+)/,
handler:function(a,b){var d=b[1],c=parseInt(b[2]),f=parseInt(b[3]),e=a.getOrCreateKernelThread("i915_gem",0,1);a.openSlice(e,"pwrite:"+d,b.timestamp);a.closeSlice(e,b.timestamp,{obj:d,offset:c,len:f})}},i915_flip_request:{format:/plane=(\d+), obj=(.+)/,handler:function(a,b){var d=parseInt(b[1]),c=b[2],f=a.getOrCreateKernelThread("i915_flip",0,2);a.openSlice(f,"flip:"+c+"/"+d,b.timestamp)}},i915_flip_complete:{format:/plane=(\d+), obj=(.+)/,handler:function(a,b){var d=parseInt(b[1]),c=b[2],f=a.getOrCreateKernelThread("i915_flip",
0,2);a.closeSlice(f,b.timestamp,{obj:c,plane:d})}},tracing_mark_write:{handler:function(a,b){var d=h.exec(b.info);if(d)a.clockSyncRecords_.push({perfTS:b.timestamp,parentTS:1E3*d[1]});else switch(d=b.info.split("|"),d[0]){case "B":var c=parseInt(d[1]),f=d[2];a.processBegin(b.taskId,f,b.timestamp,c);break;case "E":a.processEnd(b.taskId,b.timestamp);break;case "C":c=parseInt(d[1]);f=d[2];d=parseInt(d[3]);a.processCounter(f,b.timestamp,d,c);break;default:a.malformedEvent(b.name)}}}}};c.prototype.eventDefinitions["0"]=
c.prototype.eventDefinitions.tracing_mark_write;TestExports.eventDefinitions=c.prototype.eventDefinitions;tracing.TimelineModel.registerImporter(c);return{LinuxPerfImporter:c,_LinuxPerfImporterTestExports:TestExports}});cr.define("tracing",function(){function g(){this.openSlices=[]}function e(c,f){this.model_=c;"string"===typeof f||f instanceof String?("["==f[0]&&(n=f.length,"]"!=f[n-1]&&"\n"!=f[n-1]?f+="]":"]"!=f[n-2]&&"\n"==f[n-1]?f+="]":"]"!=f[n-3]&&("\r"==f[n-2]&&"\n"==f[n-1])&&(f+="]")),this.events_=JSON.parse(f)):this.events_=f;this.events_.traceEvents&&(this.events_=this.events_.traceEvents);this.threadStateByPTID_={};this.allAsyncEvents_=[]}e.canImport=function(c){return"string"===typeof c||c instanceof String?
"{"==c[0]||"["==c[0]:c instanceof Array&&c.length&&c[0].ph?!0:c.traceEvents?c.traceEvents instanceof Array&&c.traceEvents[0].ph:!1};e.prototype={__proto__:Object.prototype,processBeginEvent:function(c,f,e){var a=tracing.getStringColorId(e.name),c={index:c,slice:new tracing.TimelineThreadSlice(e.name,a,e.ts/1E3,e.args)};e.uts&&(c.slice.startInUserTime=e.uts/1E3);"0"===e.args["ui-nest"]?this.model_.importErrors.push("ui-nest no longer supported."):f.openSlices.push(c)},processEndEvent:function(c,f){if("0"===
f.args["ui-nest"])this.model_.importErrors.push("ui-nest no longer supported.");else if(0!=c.openSlices.length){var e=c.openSlices.pop().slice;e.duration=f.ts/1E3-e.start;f.uts&&(e.durationInUserTime=f.uts/1E3-e.startInUserTime);for(var a in f.args)e.args[a]=f.args[a];this.model_.getOrCreateProcess(f.pid).getOrCreateThread(f.tid).getSubrow(c.openSlices.length).push(e);c.openSlices.length&&c.openSlices[c.openSlices.length-1].slice.subSlices.push(e)}},processAsyncEvent:function(c,f,e){c=this.model_.getOrCreateProcess(e.pid).getOrCreateThread(e.tid);
this.allAsyncEvents_.push({event:e,thread:c})},autoCloseOpenSlices:function(){this.model_.updateBounds();var c=[],f;for(f in this.threadStateByPTID_)for(var e=this.threadStateByPTID_[f],a=0;a<e.openSlices.length;a++){var b=e.openSlices[a];c.push(b.slice.start);for(var d=0;d<b.slice.subSlices.length;d++){var g=b.slice.subSlices[d];c.push(g.start);g.duration&&c.push(g.end)}}c=this.model_.maxTimestamp?Math.max(this.model_.maxTimestamp,Math.max.apply(Math,c)):Math.max.apply(Math,c);for(f in this.threadStateByPTID_)for(e=
this.threadStateByPTID_[f];0<e.openSlices.length;)b=e.openSlices.pop(),b.slice.duration=c-b.slice.start,b.slice.didNotFinish=!0,a=this.events_[b.index],this.model_.getOrCreateProcess(a.pid).getOrCreateThread(a.tid).getSubrow(e.openSlices.length).push(b.slice),e.openSlices.length&&e.openSlices[e.openSlices.length-1].slice.subSlices.push(b.slice)},processCounterEvent:function(c){var f;f=void 0!==c.id?c.name+"["+c.id+"]":c.name;f=this.model_.getOrCreateProcess(c.pid).getOrCreateCounter(c.cat,f);if(0==
f.numSeries){for(var e in c.args)f.seriesNames.push(e),f.seriesColors.push(tracing.getStringColorId(f.name+"."+e));if(0==f.numSeries){this.model_.importErrors.push("Expected counter "+c.name+" to have at least one argument to use as a value.");delete f.parent.counters[f.name];return}}f.timestamps.push(c.ts/1E3);for(var a=0;a<f.numSeries;a++)e=f.seriesNames[a],void 0===c.args[e]?f.samples.push(0):f.samples.push(c.args[e])},importEvents:function(){for(var c=this.events_,f=0;f<c.length;f++){var e=c[f],
a=tracing.TimelineThread.getPTIDFromPidAndTid(e.pid,e.tid);a in this.threadStateByPTID_||(this.threadStateByPTID_[a]=new g);var b=this.threadStateByPTID_[a];"B"==e.ph?this.processBeginEvent(f,b,e):"E"==e.ph?this.processEndEvent(b,e):"S"==e.ph?this.processAsyncEvent(f,b,e):"F"==e.ph?this.processAsyncEvent(f,b,e):"T"==e.ph?this.processAsyncEvent(f,b,e):"I"==e.ph?(this.processBeginEvent(f,b,e),this.processEndEvent(b,e)):"C"==e.ph?this.processCounterEvent(e):"M"==e.ph?"thread_name"==e.name?this.model_.getOrCreateProcess(e.pid).getOrCreateThread(e.tid).name=
e.args.name:this.model_.importErrors.push("Unrecognized metadata name: "+e.name):this.model_.importErrors.push("Unrecognized event phase: "+e.ph+"("+e.name+")")}c=!1;for(a in this.threadStateByPTID_)b=this.threadStateByPTID_[a],c|=0<b.openSlices.length;c&&this.autoCloseOpenSlices()},finalizeImport:function(){if(0!=this.allAsyncEvents_.length){this.allAsyncEvents_.sort(function(a,b){return a.event.ts-b.event.ts});for(var c={},f=this.allAsyncEvents_,e=0;e<f.length;e++){var a=f[e],b=a.event,d=b.name;
if(void 0===d)this.model_.importErrors.push("Async events (ph: S, T or F) require an name parameter.");else{var g=b.id;if(void 0===g)this.model_.importErrors.push("Async events (ph: S, T or F) require an id parameter.");else if("S"==b.ph)void 0===c[d]&&(c[d]={}),c[d][g]?this.model_.importErrors.push("At "+b.ts+", an slice of the same id "+g+" was alrady open."):(c[d][g]=[],c[d][g].push(a));else if(void 0===c[d])this.model_.importErrors.push("At "+b.ts+", no slice named "+d+" was open.");else if(void 0===
c[d][g])this.model_.importErrors.push("At "+b.ts+", no slice named "+d+" with id="+g+" was open.");else{var i=c[d][g];i.push(a);if("F"==b.ph){var j=new tracing.TimelineAsyncSlice(d,tracing.getStringColorId(d),i[0].event.ts/1E3);j.duration=b.ts/1E3-i[0].event.ts/1E3;j.startThread=i[0].thread;j.endThread=a.thread;j.id=g;j.args=i[0].event.args;j.subSlices=[];for(a=1;a<i.length;++a){var k=d;"T"==i[a-1].event.ph&&(k=d+":"+i[a-1].event.args.step);k=new tracing.TimelineAsyncSlice(k,tracing.getStringColorId(d+
a),i[a-1].event.ts/1E3);k.duration=i[a].event.ts/1E3-i[a-1].event.ts/1E3;k.startThread=i[a-1].thread;k.endThread=i[a].thread;k.id=g;k.args=i[a-1].event.args;j.subSlices.push(k)}var i=j.subSlices[j.subSlices.length-1],l;for(l in b.args)i.args[l]=b.args[l];j.startThread.asyncSlices.push(j);delete c[d][g]}}}}}}};tracing.TimelineModel.registerImporter(e);return{TraceEventImporter:e}});cr.define("tracing",function(){function g(c,f,e){if(0==c.length)return 1;for(var a=0,b=c.length-1,d,g,i=-1;a<=b;)d=Math.floor((a+b)/2),g=f(c[d])-e,0>g?a=d+1:(0<g||(i=d),b=d-1);return-1!=i?i:a}function e(c,f,e,a,b,d){if(!(a>b)){var m=g(c,f,a);if(-1!=m&&(0<m&&f(c[m-1])+e(c[m-1])>=a&&d(c[m-1]),m!=c.length))for(e=c.length;m<e&&!(f(c[m])>=b);m++)d(c[m])}}return{findLowIndexInSortedArray:g,findLowIndexInSortedIntervals:function(c,f,e,a){var b=g(c,f,a);return 0==b?a>=f(c[0])&&a<f(c[0]+e(c[0]))?0:-1:b<=c.length&&
a>=f(c[b-1])&&a<f(c[b-1])+e(c[b-1])?b-1:c.length},iterateOverIntersectingIntervals:e,getIntersectingIntervals:function(c,f,g,a,b){var d=[];e(c,f,g,a,b,function(a){d.push(a)});return d}}});cr.define("tracing",function(){function g(){var e=document.createElement("iframe");e.style.cssText="width:100%;height:0;border:0;visibility:hidden";document.body.appendChild(e);this._doc=e.contentDocument;this._window=e.contentWindow;this._doc.body.style.cssText="padding:0;margin:0;overflow:hidden";for(var e=document.querySelectorAll("link[rel=stylesheet]"),c=0;c<e.length;c++){var f=e[c],g=this._doc.createElement("link");g.rel="stylesheet";g.href=f.href;this._doc.head.appendChild(g)}}g.prototype=
{__proto__:Object.prototype,measure:function(e){this._doc.body.appendChild(e);var c=this._window.getComputedStyle(e),f=parseInt(c.width,10),c=parseInt(c.height,10);this._doc.body.removeChild(e);return{width:f,height:c}}};return{MeasuringStick:g}});cr.define("tracing",function(){function g(a){this.parentEl_=a;this.scaleX_=1;this.gridTimebase_=this.panX_=0;this.gridStep_=1E3/60;this.hasCalledSetupFunction_=this.gridEnabled_=!1;this.onResizeBoundToThis_=this.onResize_.bind(this);this.checkForAttachInterval_=setInterval(this.checkForAttach_.bind(this),250)}function e(a,b){this.track=a;this.slice=b}function c(a,b,d){this.track=a;this.counter=b;this.sampleIndex=d}function f(){this.range_dirty_=!0;this.range_={};this.length_=0}g.prototype={__proto__:cr.EventTarget.prototype,
setWhenPossible:function(a){this.pendingSetFunction_=a},get isAttachedToDocument_(){for(var a=this.parentEl_;a.parentNode;)a=a.parentNode;return a==this.parentEl_.ownerDocument},onResize_:function(){this.dispatchChangeEvent()},checkForAttach_:function(){if(this.isAttachedToDocument_&&0!=this.clientWidth){this.iframe_||(this.iframe_=document.createElement("iframe"),this.iframe_.style.cssText="position:absolute;width:100%;height:0;border:0;visibility:hidden;",this.parentEl_.appendChild(this.iframe_),
this.iframe_.contentWindow.addEventListener("resize",this.onResizeBoundToThis_));var a=this.clientWidth+"x"+this.clientHeight;this.pendingSetFunction_&&(this.lastSize_=a,this.pendingSetFunction_(),this.pendingSetFunction_=void 0);window.clearInterval(this.checkForAttachInterval_);this.checkForAttachInterval_=void 0}},dispatchChangeEvent:function(){cr.dispatchSimpleEvent(this,"change")},detach:function(){this.checkForAttachInterval_&&(window.clearInterval(this.checkForAttachInterval_),this.checkForAttachInterval_=
void 0);this.iframe_.removeEventListener("resize",this.onResizeBoundToThis_);this.parentEl_.removeChild(this.iframe_)},get scaleX(){return this.scaleX_},set scaleX(a){this.scaleX_!=a&&(this.scaleX_=a,this.dispatchChangeEvent())},get panX(){return this.panX_},set panX(a){this.panX_!=a&&(this.panX_=a,this.dispatchChangeEvent())},setPanAndScale:function(a,b){if(this.scaleX_!=b||this.panX_!=a)this.scaleX_=b,this.panX_=a,this.dispatchChangeEvent()},xWorldToView:function(a){return(a+this.panX_)*this.scaleX_},
xWorldVectorToView:function(a){return a*this.scaleX_},xViewToWorld:function(a){return a/this.scaleX_-this.panX_},xViewVectorToWorld:function(a){return a/this.scaleX_},xPanWorldPosToViewPos:function(a,b,d){if("string"==typeof b)if("left"==b)b=0;else if("center"==b)b=d/2;else if("right"==b)b=d-1;else throw Error("unrecognized string for viewPos. left|center|right");this.panX=b/this.scaleX_-a},xPanWorldRangeIntoView:function(a,b,d){0>this.xWorldToView(a)?this.xPanWorldPosToViewPos(a,"left",d):this.xWorldToView(b)>
d&&this.xPanWorldPosToViewPos(b,"right",d)},xSetWorldRange:function(a,b,d){this.setPanAndScale(-a,d/(b-a))},get gridEnabled(){return this.gridEnabled_},set gridEnabled(a){this.gridEnabled_!=a&&(this.gridEnabled_=a&&!0,this.dispatchChangeEvent())},get gridTimebase(){return this.gridTimebase_},set gridTimebase(a){this.gridTimebase_!=a&&(this.gridTimebase_=a,cr.dispatchSimpleEvent(this,"change"))},get gridStep(){return this.gridStep_},applyTransformToCanavs:function(a){a.transform(this.scaleX_,0,0,1,
this.panX_*this.scaleX_,0)}};e.prototype={get selected(){return this.slice.selected},set selected(a){this.slice.selected=a}};c.prototype={get selected(){return!0==this.track.selectedSamples[this.sampleIndex]},set selected(a){this.track.selectedSamples[this.sampleIndex]=a?!0:!1;this.track.invalidate()}};f.prototype={__proto__:Object.prototype,get range(){if(this.range_dirty_){for(var a=Infinity,b=-a,d=0;d<this.length_;d++){var c=this[d];c.slice&&(a=Math.min(a,c.slice.start),b=Math.max(b,c.slice.end))}this.range_=
{min:a,max:b};this.range_dirty_=!1}return this.range_},get duration(){return this.range.max-this.range.min},get length(){return this.length_},clear:function(){for(var a=0;a<this.length_;++a)delete this[a];this.length_=0;this.range_dirty_=!0},push_:function(a){this[this.length_++]=a;this.range_dirty_=!0;return a},addSlice:function(a,b){return this.push_(new e(a,b))},addCounterSample:function(a,b,d){return this.push_(new c(a,b,d))},subSelection:function(a,b){var b=b||1,d=new f;d.range_dirty_=!0;if(0>
a||a+b>this.length_)throw"Index out of bounds";for(var c=a;c<a+b;c++)d.push_(this[c]);return d},getCounterSampleHits:function(){for(var a=new f,b=0;b<this.length_;b++)this[b]instanceof c&&a.push_(this[b]);return a},getSliceHits:function(){for(var a=new f,b=0;b<this.length_;b++)this[b]instanceof e&&a.push_(this[b]);return a},map:function(a){for(var b=0;b<this.length_;b++)a(this[b])},getShiftedSelection:function(a){for(var b=new f,d=0;d<this.length_;d++){var c=this[d];c.track.addItemNearToProvidedHitToSelection(c,
a,b)}return 0==b.length?void 0:b}};var h=cr.ui.define("div");h.prototype={__proto__:HTMLDivElement.prototype,model_:null,decorate:function(){this.classList.add("timeline");this.viewport_=new g(this);this.viewportTrack=new tracing.TimelineViewportTrack;this.tracks_=this.ownerDocument.createElement("div");this.appendChild(this.tracks_);this.dragBox_=this.ownerDocument.createElement("div");this.dragBox_.className="timeline-drag-box";this.appendChild(this.dragBox_);this.hideDragBox_();this.bindEventListener_(document,
"keypress",this.onKeypress_,this);this.bindEventListener_(document,"keydown",this.onKeydown_,this);this.bindEventListener_(document,"mousedown",this.onMouseDown_,this);this.bindEventListener_(document,"mousemove",this.onMouseMove_,this);this.bindEventListener_(document,"mouseup",this.onMouseUp_,this);this.bindEventListener_(document,"dblclick",this.onDblClick_,this);this.lastMouseViewPos_={x:0,y:0};this.selection_=new f},bindEventListener_:function(a,b,d,c){this.boundListeners_||(this.boundListeners_=
[]);d=d.bind(c);this.boundListeners_.push({object:a,event:b,boundFunc:d});a.addEventListener(b,d)},detach:function(){for(var a=0;a<this.tracks_.children.length;a++)this.tracks_.children[a].detach();for(a=0;a<this.boundListeners_.length;a++){var b=this.boundListeners_[a];b.object.removeEventListener(b.event,b.boundFunc)}this.boundListeners_=void 0;this.viewport_.detach()},get viewport(){return this.viewport_},get model(){return this.model_},set model(a){if(!a)throw Error("Model cannot be null");if(this.model)throw Error("Cannot set model twice.");
this.model_=a;var b=[];a.getAllThreads().forEach(function(a){b.push(a.userFriendlyName)});a.getAllCounters().forEach(function(a){b.push(a.name)});a.getAllCpus().forEach(function(a){b.push("CPU "+a.cpuNumber)});var d=0,c=new tracing.MeasuringStick,f=document.createElement("div");f.style.position="fixed";f.className="timeline-canvas-based-track-title";b.forEach(function(a){f.textContent=a+":__";a=c.measure(f).width;300<a&&(a=300);a>d&&(d=a)});for(var d=d+"px",e=0;e<this.tracks_.children.length;e++)this.tracks_.children[e].detach();
this.tracks_.textContent="";this.viewportTrack.headingWidth=d;this.viewportTrack.viewport=this.viewport_;e=a.getAllCpus();e.sort(tracing.TimelineCpu.compare);e.forEach(function(a){var b=new tracing.TimelineCpuTrack;b.heading="CPU "+a.cpuNumber+":";b.headingWidth=d;b.viewport=this.viewport_;b.cpu=a;this.tracks_.appendChild(b);for(var c in a.counters){var f=a.counters[c],b=new tracing.TimelineCounterTrack;b.heading="CPU "+a.cpuNumber+" "+f.name+":";b.headingWidth=d;b.viewport=this.viewport_;b.counter=
f;this.tracks_.appendChild(b)}}.bind(this));a=a.getAllProcesses();a.sort(tracing.TimelineProcess.compare);a.forEach(function(a){var b=[],c;for(c in a.counters)b.push(a.counters[c]);b.sort(tracing.TimelineCounter.compare);b.forEach(function(a){var b=new tracing.TimelineCounterTrack;b.heading=a.name+":";b.headingWidth=d;b.viewport=this.viewport_;b.counter=a;this.tracks_.appendChild(b)}.bind(this));b=[];for(c in a.threads)b.push(a.threads[c]);b.sort(tracing.TimelineThread.compare);b.forEach(function(a){var b=
new tracing.TimelineThreadTrack;b.heading=a.userFriendlyName+":";b.tooltip=a.userFriendlyDetails;b.headingWidth=d;b.viewport=this.viewport_;b.thread=a;this.tracks_.appendChild(b)}.bind(this))}.bind(this));this.viewport_.setWhenPossible(function(){this.viewport_.xSetWorldRange(this.model_.minTimestamp,this.model_.maxTimestamp,this.firstCanvas.width)}.bind(this))},addAllObjectsMatchingFilterToSelection:function(a,b){for(var d=0;d<this.tracks_.children.length;++d)this.tracks_.children[d].addAllObjectsMatchingFilterToSelection(a,
b)},get focusElement(){return this.focusElement_?this.focusElement_:this.parentElement},set focusElement(a){this.focusElement_=a},get listenToKeys_(){return!this.viewport_.isAttachedToDocument_?!1:!this.focusElement_?!0:0<=this.focusElement.tabIndex?document.activeElement==this.focusElement:!0},onKeypress_:function(a){var b=this.viewport_;if(this.firstCanvas&&this.listenToKeys_){var d=this.firstCanvas.clientWidth;switch(a.keyCode){case 101:a=b.xViewToWorld(this.lastMouseViewPos_.x);b.xPanWorldPosToViewPos(a,
"center",d);break;case 119:this.zoomBy_(1.5);break;case 115:this.zoomBy_(1/1.5);break;case 103:this.onGridToggle_(!0);break;case 71:this.onGridToggle_(!1);break;case 87:this.zoomBy_(10);break;case 83:this.zoomBy_(0.1);break;case 97:b.panX+=b.xViewVectorToWorld(0.1*d);break;case 100:b.panX-=b.xViewVectorToWorld(0.1*d);break;case 65:b.panX+=b.xViewVectorToWorld(0.5*d);break;case 68:b.panX-=b.xViewVectorToWorld(0.5*d)}}},onKeydown_:function(a){if(this.listenToKeys_){var b;switch(a.keyCode){case 37:if(b=
this.selection.getShiftedSelection(-1))this.setSelectionAndMakeVisible(b),a.preventDefault();break;case 39:if(b=this.selection.getShiftedSelection(1))this.setSelectionAndMakeVisible(b),a.preventDefault();break;case 9:-1==this.focusElement.tabIndex&&(a.shiftKey?this.selectPrevious_(a):this.selectNext_(a),a.preventDefault())}}},zoomBy_:function(a){if(this.firstCanvas){var b=this.viewport_,d=this.firstCanvas.clientWidth,c=this.lastMouseViewPos_.x,f=b.xViewToWorld(c);b.scaleX*=a;b.xPanWorldPosToViewPos(f,
c,d)}},get keyHelp(){var a="Keyboard shortcuts:\n w/s     : Zoom in/out    (with shift: go faster)\n a/d     : Pan left/right\n e       : Center on mouse\n g/G     : Shows grid at the start/end of the selected task\n",a=this.focusElement.tabIndex?a+" <-      : Select previous event on current timeline\n ->      : Select next event on current timeline\n":a+" <-,^TAB : Select previous event on current timeline\n ->, TAB : Select next event on current timeline\n";return a+"\nDbl-click to zoom in; Shift dbl-click to zoom out\n"},
get selection(){return this.selection_},set selection(a){if(!(a instanceof f))throw"Expected TimelineSelection";var b;for(b=0;b<this.selection_.length;b++)this.selection_[b].selected=!1;this.selection_=a;cr.dispatchSimpleEvent(this,"selectionChange");for(b=0;b<this.selection_.length;b++)this.selection_[b].selected=!0;this.viewport_.dispatchChangeEvent()},setSelectionAndMakeVisible:function(a,b){if(!(a instanceof f))throw"Expected TimelineSelection";this.selection=a;var d=this.selection.range,c=this.viewport_.xWorldVectorToView(d.max-
d.min);b&&50>c?(c=d.min+0.5*(d.max-d.min),d=5*(d.max-d.min),this.viewport_.xSetWorldRange(c-0.5*d,c+0.5*d,this.firstCanvas.width)):this.viewport_.xPanWorldRangeIntoView(d.min,d.max,this.firstCanvas.width)},get firstCanvas(){return this.tracks_.firstChild?this.tracks_.firstChild.firstCanvas:void 0},hideDragBox_:function(){this.dragBox_.style.left="-1000px";this.dragBox_.style.top="-1000px";this.dragBox_.style.width=0;this.dragBox_.style.height=0},setDragBoxPosition_:function(a,b){var c=Math.min(a.clientX,
b.clientX),f=Math.max(a.clientX,b.clientX),e=Math.min(a.clientY,b.clientY),g=Math.max(a.clientY,b.clientY);this.dragBox_.style.left=c+"px";this.dragBox_.style.top=e+"px";this.dragBox_.style.width=f-c+"px";this.dragBox_.style.height=g-e+"px";e=this.firstCanvas;c=this.viewport_.xViewToWorld(c-e.offsetLeft);f=this.viewport_.xViewToWorld(f-e.offsetLeft);this.dragBox_.textContent=Math.round(100*(f-c))/100+"ms";e=new cr.Event("selectionChanging");e.loWX=c;e.hiWX=f;this.dispatchEvent(e)},onGridToggle_:function(a){var a=
a?this.selection_.range.min:this.selection_.range.max,b=Math.ceil((a-this.model_.minTimestamp)/this.viewport_.gridStep_);this.viewport_.gridTimebase=a-(b+1)*this.viewport_.gridStep_;this.viewport_.gridEnabled=!0},onMouseDown_:function(a){var b=this.firstCanvas,c=this.tracks_.getClientRects()[0];c&&(a.clientX>=c.left&&a.clientX<c.right&&a.clientY>=c.top&&a.clientY<c.bottom&&a.x>=b.offsetLeft)&&(this.viewport_.xViewToWorld(a.clientX-b.offsetLeft),this.dragBeginEvent_=a,a.preventDefault(),0<=this.focusElement.tabIndex&&
this.focusElement.focus())},onMouseMove_:function(a){if(this.firstCanvas){var b=this.firstCanvas;this.lastMouseViewPos_={x:a.clientX-b.offsetLeft,y:a.clientY-b.offsetTop};this.dragBeginEvent_&&this.setDragBoxPosition_(this.dragBeginEvent_,a)}},onMouseUp_:function(a){var b;if(this.dragBeginEvent_){this.hideDragBox_();var c=this.dragBeginEvent_;this.dragBeginEvent_=null;var e=Math.min(c.clientX,a.clientX);b=Math.max(c.clientX,a.clientX);var g=Math.min(c.clientY,a.clientY),a=Math.max(c.clientY,a.clientY),
c=this.firstCanvas,e=this.viewport_.xViewToWorld(e-c.offsetLeft),c=this.viewport_.xViewToWorld(b-c.offsetLeft),h=new f;for(b=0;b<this.tracks_.children.length;b++){var k=this.tracks_.children[b],l=k.getBoundingClientRect(),o=Math.max(g,l.top),l=Math.min(a,l.bottom);o<=l&&k.addIntersectingItemsInRangeToSelection(e,c,g,a,h)}this.selection=h}},onDblClick_:function(a){if(!(a.x<this.firstCanvas.offsetLeft)){var b=4;a.shiftKey&&(b=1/b);this.zoomBy_(b);a.preventDefault()}}};cr.defineProperty(h,"model",cr.PropertyKind.JS);
return{Timeline:h,TimelineSelectionSliceHit:e,TimelineSelectionCounterSampleHit:c,TimelineSelection:f,TimelineViewport:g}});cr.define("tracing",function(){function g(a){return Math.round(1E3*a)/1E3}function e(a,c){c=c||0;"string"!=typeof a&&(a=""+a);if(a.length>=c)return"";for(var f="",e=0;e<c-a.length;e++)f+=" ";return f}function c(a,c){return a+e(a,c)}function f(a,c){return e(a,c)+a}function h(a){var d="",e=a.getSliceHits(),h=a.getCounterSampleHits();if(1==e.length){var a=14,j=e[0].slice,d="Selected item:\n"+(c("Title",a)+": "+j.title+"\n"),d=d+(c("Start",a)+": "+g(j.start)+" ms\n"),d=d+(c("Duration",a)+": "+g(j.duration)+
" ms\n");j.durationInUserTime&&(d+=c("Duration (U)",a)+": "+g(j.durationInUserTime)+" ms\n");var k=0,l;for(l in j.args)k+=1;if(0<k)for(l in d+=c("Args",a)+":\n",j.args)k=j.args[l],d+=c(" "+l,a)+": "+k+"\n"}else if(1<e.length){var a=55,d="Slices:\n",o=e.range.min,q=e.range.max;e.map(function(a){return a.slice.title});var u={};for(l=0;l<e.length;l++)j=e[l].slice,u[j.title]||(u[j.title]={slices:[]}),u[j.title].slices.push(j);j=0;for(k in u){var v=u[k],t=0;for(l=0;l<v.slices.length;l++)t+=v.slices[l].duration;
j+=t;d+=" "+c(k,a)+": "+f(g(t)+"ms",12)+"   "+f(""+v.slices.length,5)+" occurrences\n"}d+=c("*Totals",a)+" : "+f(g(j)+"ms",12)+"   "+f(""+e.length,5)+" occurrences\n";d=d+"\n"+(c("Selection start",a)+" : "+f(g(o)+"ms",12)+"\n");d+=c("Selection extent",a)+" : "+f(g(q-o)+"ms",12)+"\n"}if(1==h.length){d="Selected counter:\n";a=55;h=h[0];e=h.counter;h=h.sampleIndex;k=[];for(l=0;l<e.numSeries;++l)k.push(e.samples[e.numSeries*h+l]);d+=c("Title",a)+": "+e.name+"\n";d+=c("Timestamp",a)+": "+g(e.timestamps[h])+
" ms\n";d=1<e.numSeries?d+(c("Values",a)+": "+k.join("\n")+"\n"):d+(c("Value",a)+": "+k.join("\n")+"\n")}else 1<h.length&&0==e.length&&(d+="Analysis of multiple counters not yet implemented. Pick a single counter.");return d}var a=cr.ui.define("div");a.prototype={__proto__:HTMLDivElement.prototype,decorate:function(){this.className="timeline-analysis"},set selection(a){this.textContent=h(a)}};return{TimelineAnalysisView:a}});cr.define("tracing",function(){function g(a,b){var c=document.createElement("div");c.classList.add("timeline-track-button");c.classList.add("timeline-track-close-button");c.textContent=String.fromCharCode(215);c.addEventListener("click",function(){a.style.display="None"});a.appendChild(c);if(b){var d=document.createElement("div");d.classList.add("timeline-track-button");d.classList.add("timeline-track-collapse-button");d.textContent="\u2212";var f=!1;d.addEventListener("click",function(){f=!f;a.collapsedDidChange(f);
d.textContent=f?"+":"\u2212"});a.appendChild(d)}}function e(a,b){this.string=a;this.width=b}function c(){}var f=tracing.getPallette(),h=tracing.getPalletteHighlightIdBoost(),a={},b={},d=cr.ui.define("div");d.prototype={__proto__:HTMLDivElement.prototype,decorate:function(){this.tracks_=[]},detach:function(){for(var a=0;a<this.tracks_.length;a++)this.tracks_[a].detach()},get viewport(){return this.viewport_},set viewport(a){this.viewport_=a;for(var b=0;b<this.tracks_.length;b++)this.tracks_[b].viewport=
a;this.updateChildTracks_()},get firstCanvas(){if(this.tracks_.length)return this.tracks_[0].firstCanvas},addIntersectingItemsToSelection:function(a,b,c){for(var d=0;d<this.tracks_.length;d++){var f=this.tracks_[d].getBoundingClientRect();b>=f.top&&b<f.bottom&&this.tracks_[d].addIntersectingItemsToSelection(a,b,c)}return!1},addIntersectingItemsInRangeToSelection:function(a,b,c,d,f){for(var e=0;e<this.tracks_.length;e++){var g=this.tracks_[e].getBoundingClientRect(),h=Math.max(c,g.top),g=Math.min(d,
g.bottom);h<=g&&this.tracks_[e].addIntersectingItemsInRangeToSelection(a,b,c,d,f)}},addAllObjectsMatchingFilterToSelection:function(a,b){for(var c=0;c<this.tracks_.length;c++)this.tracks_[c].addAllObjectsMatchingFilterToSelection(a,b)}};var m=cr.ui.define(d);m.prototype={__proto__:d.prototype,decorate:function(){this.classList.add("timeline-thread-track")},get thread(){return this.thread_},set thread(a){this.thread_=a;this.updateChildTracks_()},get tooltip(){return this.tooltip_},set tooltip(a){this.tooltip_=
a;this.updateChildTracks_()},get heading(){return this.heading_},set heading(a){this.heading_=a;this.updateChildTracks_()},get headingWidth(){return this.headingWidth_},set headingWidth(a){this.headingWidth_=a;this.updateChildTracks_()},addTrack_:function(a){var b=new j;b.heading="";b.slices=a;b.headingWidth=this.headingWidth_;b.viewport=this.viewport_;this.tracks_.push(b);this.appendChild(b);return b},updateChildTracks_:function(){this.detach();this.textContent="";this.tracks_=[];if(this.thread_){if(this.thread_.cpuSlices){var a=
this.addTrack_(this.thread_.cpuSlices);a.height="4px";a.decorateHit=function(a){a.thread=this.thread_}}if(this.thread_.asyncSlices.length)for(var b=this.thread_.asyncSlices.subRows,c=0;c<b.length;c++)a=this.addTrack_(b[c]),a.decorateHit=function(){},a.asyncStyle=!0;for(c=0;c<this.thread_.subRows.length;c++)a=this.addTrack_(this.thread_.subRows[c]),a.decorateHit=function(a){a.thread=this.thread_};0<this.tracks_.length&&(this.thread_.cpuSlices?(this.tracks_[1].heading=this.heading_,this.tracks_[1].tooltip=
this.tooltip_):(this.tracks_[0].heading=this.heading_,this.tracks_[0].tooltip=this.tooltip_))}g(this,4<=this.tracks_.length)},collapsedDidChange:function(a){if(a)for(var a=parseInt(this.tracks_[0].height),b=0;b<this.tracks_.length;++b)2<a?this.tracks_[b].height=Math.floor(a)+"px":this.tracks_[b].style.display="None",a*=0.5;else for(b=0;b<this.tracks_.length;++b)this.tracks_[b].height=this.tracks_[0].height,this.tracks_[b].style.display=""}};var i=cr.ui.define(d);i.prototype={__proto__:d.prototype,
decorate:function(){this.classList.add("timeline-thread-track")},get cpu(){return this.cpu_},set cpu(a){this.cpu_=a;this.updateChildTracks_()},get tooltip(){return this.tooltip_},set tooltip(a){this.tooltip_=a;this.updateChildTracks_()},get heading(){return this.heading_},set heading(a){this.heading_=a;this.updateChildTracks_()},get headingWidth(){return this.headingWidth_},set headingWidth(a){this.headingWidth_=a;this.updateChildTracks_()},updateChildTracks_:function(){this.detach();this.textContent=
"";this.tracks_=[];if(this.cpu_){var a=new j;a.slices=this.cpu_.slices;a.headingWidth=this.headingWidth_;a.viewport=this.viewport_;this.tracks_.push(a);this.appendChild(a);this.tracks_[0].heading=this.heading_;this.tracks_[0].tooltip=this.tooltip_}g(this,!1)}};d=cr.ui.define("div");d.prototype={__proto__:HTMLDivElement.prototype,decorate:function(){this.className="timeline-canvas-based-track";this.slices_=null;this.headingDiv_=document.createElement("div");this.headingDiv_.className="timeline-canvas-based-track-title";
this.headingDiv_.onselectstart=function(){return!1};this.appendChild(this.headingDiv_);this.canvasContainer_=document.createElement("div");this.canvasContainer_.className="timeline-canvas-based-track-canvas-container";this.appendChild(this.canvasContainer_);this.canvas_=document.createElement("canvas");this.canvas_.className="timeline-canvas-based-track-canvas";this.canvasContainer_.appendChild(this.canvas_);this.ctx_=this.canvas_.getContext("2d")},detach:function(){this.viewport_&&this.viewport_.removeEventListener("change",
this.viewportChangeBoundToThis_)},set headingWidth(a){this.headingDiv_.style.width=a},get heading(){return this.headingDiv_.textContent},set heading(a){this.headingDiv_.textContent=a},set tooltip(a){this.headingDiv_.title=a},get viewport(){return this.viewport_},set viewport(a){(this.viewport_=a)&&this.viewport_.removeEventListener("change",this.viewportChangeBoundToThis_);if(this.viewport_=a)this.viewportChangeBoundToThis_=this.viewportChange_.bind(this),this.viewport_.addEventListener("change",
this.viewportChangeBoundToThis_);this.invalidate()},viewportChange_:function(){this.invalidate()},invalidate:function(){this.rafPending_||(webkitRequestAnimationFrame(function(){this.rafPending_=!1;if(this.viewport_){var a=window.getComputedStyle(this.canvasContainer_),b=parseInt(a.width),a=parseInt(a.height);this.canvas_.width!=b&&(this.canvas_.width=b);this.canvas_.height!=a&&(this.canvas_.height=a);this.redraw()}}.bind(this),this),this.rafPending_=!0)},get firstCanvas(){return this.canvas_}};c.prototype=
{get:function(a,c,d,f,g){var h=b[d];h||(h={},b[d]=h);f=h[c];f||(h[c]={},f=h[c]);h=f[g];if(void 0===h){for(h=!1;a.labelWidthWorld(d,c)>g;)d=d.substring(0,0.75*d.length),h=!0;h&&3<d.length&&(d=d.substring(0,d.length-3)+"...");h=new e(d,a.labelWidth(d));f[g]=h}return h}};var j=cr.ui.define(d);j.prototype={__proto__:d.prototype,SHOULD_ELIDE_TEXT:!0,decorate:function(){this.classList.add("timeline-slice-track");this.elidedTitleCache=new c;this.asyncStyle_=!1},decorateHit:function(){},get asyncStyle(){return this.asyncStyle_},
set asyncStyle(a){this.asyncStyle_=!!a;this.invalidate()},get slices(){return this.slices_},set slices(a){this.slices_=a;this.invalidate()},get height(){return window.getComputedStyle(this).height},set height(a){this.style.height=a;this.invalidate()},labelWidth:function(b){var c=a[b];c||(c=this.ctx_.measureText(b).width,a[b]=c);return c+2},labelWidthWorld:function(a,b){return this.labelWidth(a)*b},redraw:function(){var a=this.ctx_,b=this.canvas_.width,c=this.canvas_.height;a.clearRect(0,0,b,c);var d=
this.viewport_,e=d.xViewVectorToWorld(1),g=d.xViewToWorld(0),b=d.xViewToWorld(b);if(d.gridEnabled){var j=d.gridTimebase;for(a.beginPath();j<b;){if(j>=g){var i=d.xWorldToView(j);a.moveTo(i,0);a.lineTo(i,c)}j+=d.gridStep}a.strokeStyle="rgba(255,0,0,0.25)";a.stroke()}a.save();d.applyTransformToCanavs(a);this.asyncStyle_&&(a.globalAlpha=0.25);var k=new tracing.FastRectRenderer(a,g,2*e,2*e,b,f);k.setYandH(0,c);g=this.slices_;for(b=0;b<g.length;++b){var i=g[b],j=i.start,l=Math.max(i.duration,0.001),m=i.selected?
i.colorId+h:i.colorId;l<e&&(l=e);0<i.duration?k.fillRect(j,l,m):0.001<e?k.fillRect(j,e,m):(a.fillStyle=f[m],a.beginPath(),a.moveTo(j-4*e,c),a.lineTo(j,0),a.lineTo(j+4*e,c),a.closePath(),a.fill())}k.flush();a.restore();if(8<c){a.textAlign="center";a.textBaseline="top";a.font="10px sans-serif";a.strokeStyle="rgb(0,0,0)";a.fillStyle="rgb(0,0,0)";c=20*e;j=this.SHOULD_ELIDE_TEXT;for(b=0;b<g.length;++b)if(i=g[b],i.duration>c&&(k=i.title,i.didNotFinish&&(k+=" (Did Not Finish)"),l=this.labelWidth(k),j&&this.labelWidthWorld(k,
e)>i.duration&&(l=this.elidedTitleCache.get(this,e,k,l,i.duration),k=l.string,l=l.width),l*e<i.duration))i=d.xWorldToView(i.start+0.5*i.duration),a.fillText(k,i,2.5,l)}},addIntersectingItemsToSelection:function(a,b,c){var d=this.getBoundingClientRect();if(b<d.top||b>=d.bottom)return!1;a=tracing.findLowIndexInSortedIntervals(this.slices_,function(a){return a.start},function(a){return a.duration},a);return 0<=a&&a<this.slices_.length?(this.decorateHit(c.addSlice(this,this.slices_[a])),!0):!1},addIntersectingItemsInRangeToSelection:function(a,
b,c,d,f){function e(a){a=f.addSlice(h,a);h.decorateHit(a)}var g=this.getBoundingClientRect(),c=Math.max(c,g.top),d=Math.min(d,g.bottom);if(!(c>d)){var h=this;tracing.iterateOverIntersectingIntervals(this.slices_,function(a){return a.start},function(a){return a.duration},a,b,e)}},indexOfSlice_:function(a){for(var b=tracing.findLowIndexInSortedArray(this.slices_,function(a){return a.start},a.start);b<this.slices_.length&&a.start==this.slices_[b].start&&a.colorId!=this.slices_[b].colorId;)b++;return b<
this.slices_.length?b:void 0},addItemNearToProvidedHitToSelection:function(a,b,c){if(!a.slice)return!1;a=this.indexOfSlice_(a.slice);if(void 0===a)return!1;b=a+b;if(0>b||b>=this.slices_.length)return!1;a=c.addSlice(this,this.slices_[b]);this.decorateHit(a);return!0},addAllObjectsMatchingFilterToSelection:function(a,b){for(var c=0;c<this.slices_.length;++c)a.matchSlice(this.slices_[c])&&this.decorateHit(b.addSlice(this,this.slices_[c]))}};var k=cr.ui.define(d),l=Math.log(10);k.prototype={__proto__:d.prototype,
decorate:function(){this.classList.add("timeline-viewport-track");this.strings_secs_=[];this.strings_msecs_=[]},redraw:function(){var a=this.ctx_,b=this.canvas_.width,c=this.canvas_.height;a.clearRect(0,0,b,c);var d=this.viewport_;d.xViewVectorToWorld(1);for(var f=d.xViewToWorld(0),e=d.xViewToWorld(b),g=d.xViewVectorToWorld(150),h=Math.pow(10,Math.ceil(Math.log(g)/l)),i=[10,5,2,1],g=0;g<i.length;++g)if(!(150>d.xWorldVectorToView(h/i[g]))){majorMarkDistanceWorld=h/i[g-1];break}h=void 0;100>majorMarkDistanceWorld?
(unit="ms",unitDivisor=1,h=this.strings_msecs_):(unit="s",unitDivisor=1E3,h=this.strings_secs_);i=d.xWorldVectorToView(majorMarkDistanceWorld/5);g=Math.floor(f/majorMarkDistanceWorld)*majorMarkDistanceWorld;f=Math.floor(0.25*c);a.fillStyle="rgb(0, 0, 0)";a.strokeStyle="rgb(0, 0, 0)";a.textAlign="left";a.textBaseline="top";a.font="9px sans-serif";for(var j=g;j<e;j+=majorMarkDistanceWorld){var k=Math.floor(d.xWorldToView(j)),g=Math.floor(1E5*(j/unitDivisor))/1E5;h[g]||(h[g]=g+" "+unit);a.fillText(h[g],
k+2,0);a.beginPath();a.moveTo(k,0);a.lineTo(k,b);for(g=1;5>g;++g){var m=Math.floor(k+i*g);a.moveTo(m,c-f);a.lineTo(m,c)}a.stroke()}},addIntersectingItemsToSelection:function(){},addIntersectingItemsInRangeToSelection:function(){},addAllObjectsMatchingFilterToSelection:function(){}};var o=cr.ui.define(d);o.prototype={__proto__:d.prototype,decorate:function(){this.classList.add("timeline-counter-track");g(this,!1);this.selectedSamples_={}},decorateHit:function(){},get counter(){return this.counter_},
set counter(a){this.counter_=a;this.invalidate()},get selectedSamples(){return this.selectedSamples_},redraw:function(){var a=this.counter_,b=this.ctx_,c=this.canvas_.width,d=this.canvas_.height;b.clearRect(0,0,c,d);var e=this.viewport_,g=e.xViewVectorToWorld(1),h=e.xViewToWorld(0),c=e.xViewToWorld(c),i=e.xViewVectorToWorld(1);b.save();e.applyTransformToCanavs(b);for(var e=a.numSeries,j=a.numSamples,k=tracing.findLowIndexInSortedArray(a.timestamps,function(){},h),l=d/a.maxTotal,m=a.numSeries-1;0<=
m;m--){b.fillStyle=f[a.seriesColors[m]];b.beginPath();for(var o=k-1,w=0<=o?a.timestamps[o]-i:-1,x=d,A=!1;;){var r=o+1;if(r>=j){b.lineTo(w,x);b.lineTo(w+8*g,x);b.lineTo(w+8*g,d);break}var s=a.timestamps[r],o=a.totals[r*e+m],z=d-l*o;if(s>c){b.lineTo(s,x);b.lineTo(s,d);break}s-w<i?o=r:(A||(b.moveTo(h,d),A=!0),b.lineTo(s,x),b.lineTo(s,z),o=r,w=s,x=z)}b.closePath();b.fill()}b.fillStyle="rgba(255, 0, 0, 1)";for(r in this.selectedSamples_)if(this.selectedSamples_[r]){s=a.timestamps[r];for(m=a.numSeries-
1;0<=m;m--)o=a.totals[r*e+m],z=d-l*o,b.fillRect(s-g,z-1,3*g,3)}b.restore()},addIntersectingItemsToSelection:function(a,b,c){var d=this.getBoundingClientRect();if(b<d.top||b>=d.bottom)return!1;b=this.counter_;if(a<this.counter_.timestamps[0])return!1;d=tracing.findLowIndexInSortedArray(b.timestamps,function(a){return a},a);if(0>d||d>=b.timestamps.length)return!1;0<d&&a>this.counter_.timestamps[d-1]&&d--;this.getBoundingClientRect();this.decorateHit(c.addCounterSample(this,this.counter,d));return!0},
addIntersectingItemsInRangeToSelection:function(a,b,c,d,e){var f=this.getBoundingClientRect(),c=Math.max(c,f.top),d=Math.min(d,f.bottom);if(!(c>d)){d=this.counter_;c=tracing.findLowIndexInSortedArray(d.timestamps,function(a){return a},a);f=tracing.findLowIndexInSortedArray(d.timestamps,function(a){return a},b);0<c&&a>d.timestamps[c-1]&&c--;0<f&&b>d.timestamps[f-1]&&f--;for(a=c;a<=f;a++)a>=d.timestamps.length||this.decorateHit(e.addCounterSample(this,this.counter,a))}},addAllObjectsMatchingFilterToSelection:function(){}};
return{TimelineCounterTrack:o,TimelineSliceTrack:j,TimelineThreadTrack:m,TimelineViewportTrack:k,TimelineCpuTrack:i}});cr.define("tracing",function(){function g(e,c,f,g,a,b){this.ctx_=e;this.vpLeft_=c;this.minRectSize_=f;this.maxMergeDist_=g;this.vpRight_=a;this.pallette_=b}g.prototype={y_:0,h_:0,merging_:!1,mergeStartX_:0,mergeCurRight_:0,setYandH:function(e,c){this.flush();this.y_=e;this.h_=c},fillRect:function(e,c,f){var g=e+c;g<this.vpLeft_||e>this.vpRight_||(c<this.minRectSize_?(g-this.mergeStartX_>this.maxMergeDist_&&this.flush(),this.merging_?(this.mergeCurRight_=g,this.mergedColorId=Math.max(this.mergedColorId,
f)):(this.merging_=!0,this.mergeStartX_=e,this.mergeCurRight_=g,this.mergedColorId=f)):(this.merging_&&this.flush(),this.ctx_.fillStyle=this.pallette_[f],this.ctx_.fillRect(e,this.y_,c,this.h_)))},flush:function(){this.merging_&&(this.ctx_.fillStyle=this.pallette_[this.mergedColorId],this.ctx_.fillRect(this.mergeStartX_,this.y_,this.mergeCurRight_-this.mergeStartX_,this.h_),this.merging_=!1)}};return{FastRectRenderer:g}});cr.define("tracing",function(){var g=cr.ui.define(cr.ui.TabPanel);g.prototype={__proto__:cr.ui.TabPanel.prototype,traceEvents_:[],systemTraceEvents_:[],decorate:function(){cr.ui.TabPanel.prototype.decorate.apply(this);this.classList.add("profiling-view");this.recordBn_=document.createElement("button");this.recordBn_.className="record";this.recordBn_.textContent="Record";this.recordBn_.addEventListener("click",this.onRecord_.bind(this));this.saveBn_=document.createElement("button");this.saveBn_.textContent=
"Save";this.saveBn_.addEventListener("click",this.onSave_.bind(this));this.loadBn_=document.createElement("button");this.loadBn_.textContent="Load";this.loadBn_.addEventListener("click",this.onLoad_.bind(this));if(cr.isChromeOS){this.systemTracingBn_=document.createElement("input");this.systemTracingBn_.type="checkbox";this.systemTracingBn_.checked=!0;var e=document.createElement("div");e.className="label";e.textContent="System events";e.appendChild(this.systemTracingBn_)}this.timelineView_=new tracing.TimelineView;
this.timelineView_.leftControls.appendChild(this.recordBn_);this.timelineView_.leftControls.appendChild(this.saveBn_);this.timelineView_.leftControls.appendChild(this.loadBn_);cr.isChromeOS&&this.timelineView_.leftControls.appendChild(this.systemTracingBn_);this.appendChild(this.timelineView_);document.addEventListener("keypress",this.onKeypress_.bind(this));this.refresh_()},didSetTracingController_:function(e,c){if(c)throw"Can only set tracing controller once.";this.tracingController_.addEventListener("traceEnded",
this.onRecordDone_.bind(this));this.tracingController_.addEventListener("loadTraceFileComplete",this.onLoadTraceFileComplete_.bind(this));this.tracingController_.addEventListener("saveTraceFileComplete",this.onSaveTraceFileComplete_.bind(this));this.tracingController_.addEventListener("loadTraceFileCanceled",this.onLoadTraceFileCanceled_.bind(this));this.tracingController_.addEventListener("saveTraceFileCanceled",this.onSaveTraceFileCanceled_.bind(this));this.refresh_()},refresh_:function(){if(this.tracingController_){var e=
this.tracingController_.traceEvents,c=e&&e.length;this.saveBn_.disabled=!c;c&&(c=new tracing.TimelineModel,c.importEvents(e,!0,[this.tracingController_.systemTraceEvents]),this.timelineView_.model=c)}},onKeypress_:function(e){if(114==e.keyCode&&!this.tracingController_.isTracingEnabled)this.onRecord_()},get timelineView(){return this.timelineView_},onRecord_:function(){this.tracingController_.beginTracing(this.systemTracingBn_?this.systemTracingBn_.checked:!1)},onRecordDone_:function(){this.refresh_()},
onSave_:function(){this.overlayEl_=new tracing.Overlay;this.overlayEl_.className="profiling-overlay";var e=document.createElement("div");e.className="label";e.textContent="Saving...";this.overlayEl_.appendChild(e);this.overlayEl_.visible=!0;this.tracingController_.beginSaveTraceFile()},onSaveTraceFileComplete_:function(){this.overlayEl_.visible=!1;this.overlayEl_=void 0},onSaveTraceFileCanceled_:function(){this.overlayEl_.visible=!1;this.overlayEl_=void 0},onLoad_:function(){this.overlayEl_=new tracing.Overlay;
this.overlayEl_.className="profiling-overlay";var e=document.createElement("div");e.className="label";e.textContent="Loading...";this.overlayEl_.appendChild(e);this.overlayEl_.visible=!0;this.tracingController_.beginLoadTraceFile()},onLoadTraceFileComplete_:function(){this.overlayEl_.visible=!1;this.overlayEl_=void 0;this.refresh_()},onLoadTraceFileCanceled_:function(){this.overlayEl_.visible=!1;this.overlayEl_=void 0}};cr.defineProperty(g,"tracingController",cr.PropertyKind.JS,g.prototype.didSetTracingController_);
return{ProfilingView:g}});cr.define("tracing",function(){function g(){this.model_=this.timeline_=void 0;this.filterText_="";this.filterHits_=new tracing.TimelineSelection;this.filterHitsDirty_=!0;this.currentHitIndex_=0}var e=cr.ui.define("div");e.prototype={__proto__:tracing.Overlay.prototype,decorate:function(){tracing.Overlay.prototype.decorate.call(this);this.className="timeline-find-control";this.hitCountEl_=document.createElement("div");this.hitCountEl_.className="hit-count-label";this.hitCountEl_.textContent="1 of 7";
var c=document.createElement("div");c.className="timeline-button find-previous";c.textContent="\u2190";c.addEventListener("click",function(){this.controller.findPrevious();this.updateHitCountEl_()}.bind(this));var e=document.createElement("div");e.className="timeline-button find-next";e.textContent="\u2192";e.addEventListener("click",function(){this.controller.findNext();this.updateHitCountEl_()}.bind(this));this.filterEl_=document.createElement("input");this.filterEl_.type="input";this.filterEl_.addEventListener("input",
function(){this.controller.filterText=this.filterEl_.value;this.updateHitCountEl_()}.bind(this));this.filterEl_.addEventListener("keydown",function(a){13==a.keyCode?e.click():27==a.keyCode&&(this.filterEl_.blur(),this.updateHitCountEl_())}.bind(this));this.filterEl_.addEventListener("blur",function(){this.updateHitCountEl_()}.bind(this));this.filterEl_.addEventListener("focus",function(){this.updateHitCountEl_()}.bind(this));this.appendChild(this.filterEl_);this.appendChild(c);this.appendChild(e);
this.appendChild(this.hitCountEl_);this.updateHitCountEl_()},get controller(){return this.controller_},set controller(c){this.controller_=c;this.updateHitCountEl_()},focus:function(){this.filterEl_.selectionStart=0;this.filterEl_.selectionEnd=this.filterEl_.value.length;this.filterEl_.focus()},updateHitCountEl_:function(){if(!this.controller||document.activeElement!=this.filterEl_)this.hitCountEl_.textContent="";else{var c=this.controller.currentHitIndex,e=this.controller.filterHits.length;this.hitCountEl_.textContent=
0==e?"0 of 0":c+1+" of "+e}}};g.prototype={__proto__:Object.prototype,get timeline(){return this.timeline_},set timeline(c){this.timeline_=c;this.filterHitsDirty_=!0},get filterText(){return this.filterText_},set filterText(c){c!=this.filterText_&&(this.filterText_=c,this.filterHitsDirty_=!0,this.findNext())},get filterHits(){if(this.filterHitsDirty_)if(this.filterHitsDirty_=!1,this.timeline_){var c=new tracing.TimelineFilter(this.filterText);this.filterHits_.clear();this.timeline.addAllObjectsMatchingFilterToSelection(c,
this.filterHits_);this.currentHitIndex_=this.filterHits_.length-1}else this.filterHits_.clear(),this.currentHitIndex_=0;return this.filterHits_},get currentHitIndex(){return this.currentHitIndex_},find_:function(c){if(this.timeline){var e=this.filterHits.length;this.currentHitIndex_+=c;0>this.currentHitIndex_&&(this.currentHitIndex_=e-1);this.currentHitIndex_>=e&&(this.currentHitIndex_=0);0>this.currentHitIndex_||this.currentHitIndex_>=e?this.timeline.selection=new tracing.TimelineSelection:(c=0==
this.currentHitIndex_,this.timeline.setSelectionAndMakeVisible(this.filterHits.subSelection(this.currentHitIndex_),c))}},findNext:function(){this.find_(1)},findPrevious:function(){this.find_(-1)}};var c=cr.ui.define("div");c.prototype={__proto__:HTMLDivElement.prototype,decorate:function(){this.classList.add("timeline-view");this.titleEl_=document.createElement("div");this.titleEl_.textContent="Tracing: ";this.controlDiv_=document.createElement("div");this.controlDiv_.className="control";this.leftControlsEl_=
document.createElement("div");this.leftControlsEl_.className="controls";this.rightControlsEl_=document.createElement("div");this.rightControlsEl_.className="controls";var c=document.createElement("div");c.className="spacer";this.timelineContainer_=document.createElement("div");this.timelineContainer_.className="timeline-container";var h=document.createElement("div");h.className="analysis-container";this.analysisEl_=new tracing.TimelineAnalysisView;this.findCtl_=new e;this.findCtl_.controller=new g;
this.rightControls.appendChild(this.findCtl_);this.controlDiv_.appendChild(this.titleEl_);this.controlDiv_.appendChild(this.leftControlsEl_);this.controlDiv_.appendChild(c);this.controlDiv_.appendChild(this.rightControlsEl_);this.appendChild(this.controlDiv_);this.appendChild(this.timelineContainer_);h.appendChild(this.analysisEl_);this.appendChild(h);this.rightControls.appendChild(this.createHelpButton_());this.onSelectionChangedBoundToThis_=this.onSelectionChanged_.bind(this);document.addEventListener("keypress",
this.onKeypress_.bind(this),!0)},createHelpButton_:function(){function c(a){if(e.visible&&(27==a.keyCode||63==a.keyCode))a.preventDefault(),document.removeEventListener("keydown",c),e.visible=!1}var e=new tracing.Overlay;e.classList.add("timeline-view-help-overlay");var a=document.createElement("div");a.className="timeline-button timeline-view-help-button";a.textContent="?";var b=document.createElement("div");b.style.whiteSpace="pre";b.style.fontFamily="monospace";a.addEventListener("click",function(){e.visible=
!0;b.textContent=this.timeline_.keyHelp;document.addEventListener("keydown",c,!0)}.bind(this));e.appendChild(b);return a},get leftControls(){return this.leftControlsEl_},get rightControls(){return this.rightControlsEl_},get title(){return this.titleEl_.textContent.substring(this.titleEl_.textContent.length-2)},set title(c){this.titleEl_.textContent=c+":"},set traceData(c){this.model=new tracing.TimelineModel(c)},get model(){return this.timelineModel_},set model(c){this.timelineModel_=c;this.timelineContainer_.textContent=
"";void 0!==this.timelineModel_.minTimestamp?(this.timeline_&&(this.timeline_.viewportTrack.detach(),this.timeline_.detach()),this.timeline_=new tracing.Timeline,this.timeline_.model=this.timelineModel_,this.timeline_.focusElement=this.focusElement_?this.focusElement_:this.parentElement,this.insertBefore(this.timeline_.viewportTrack,this.timelineContainer_),this.timelineContainer_.appendChild(this.timeline_),this.timeline_.addEventListener("selectionChange",this.onSelectionChangedBoundToThis_),this.findCtl_.controller.timeline=
this.timeline_,this.onSelectionChanged_()):(this.timeline_=void 0,this.findCtl_.controller.timeline=void 0)},get timeline(){return this.timeline_},set focusElement(c){this.focusElement_=c;this.timeline_&&(this.timeline_.focusElement=c)},get focusElement(){return this.focusElement_?this.focusElement_:this.parentElement},get isAttachedToDocument_(){for(var c=this;c.parentNode;)c=c.parentNode;return c==this.ownerDocument},get listenToKeys_(){if(this.isAttachedToDocument_)return!this.focusElement_?!0:
0<=this.focusElement.tabIndex?document.activeElement==this.focusElement:!0},onKeypress_:function(c){this.listenToKeys_&&(47==event.keyCode?(this.findCtl_.focus(),event.preventDefault()):63==c.keyCode&&(this.querySelector(".timeline-view-help-button").click(),c.preventDefault()))},beginFind:function(){if(!this.findInProgress_){this.findInProgress_=!0;var c=e();c.controller=new g;c.controller.timeline=this.timeline;c.visible=!0;c.addEventListener("close",function(){this.findInProgress_=!1}.bind(this));
c.addEventListener("findNext",function(){});c.addEventListener("findPrevious",function(){})}},onSelectionChanged_:function(){var c=this.timelineContainer_.scrollTop;this.analysisEl_.selection=this.timeline_.selection;this.timelineContainer_.scrollTop=c}};return{TimelineFindControl:e,TimelineFindController:g,TimelineView:c}});
