Home | History | Annotate | Download | only in chromium-trace

Lines Matching defs:cr

1 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;
2 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];
3 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",
5 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),
6 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",
7 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>
9 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];
10 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 i=b[d.tagName];i&&cr.ui.decorate(d,i)}}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=
11 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)},
12 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=
13 !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}
16 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);
19 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");
20 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";
21 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),
23 [];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()},
25 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=
27 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,
28 "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=
42 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]},
49 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])?
74 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?
84 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&&
85 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=
86 {__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,
88 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_=
91 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,
95 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,
106 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-
108 b.clientX),c=Math.max(a.clientX,b.clientX),f=Math.min(a.clientY,b.clientY),e=Math.max(a.clientY,b.clientY);this.dragBox_.style.left=d+"px";this.dragBox_.style.top=f+"px";this.dragBox_.style.width=c-d+"px";this.dragBox_.style.height=e-f+"px";f=this.firstCanvas;d=this.viewport_.xViewToWorld(d-f.offsetLeft);c=this.viewport_.xViewToWorld(c-f.offsetLeft);this.dragBox_.textContent=Math.round(100*(c-d))/100+"ms";f=new cr.Event("selectionChanging");f.loWX=d;f.hiWX=c;this.dispatchEvent(f)},onGridToggle_:function(a){var a=
111 d=this.firstCanvas,c=this.viewport_.xViewToWorld(c-d.offsetLeft),d=this.viewport_.xViewToWorld(b-d.offsetLeft),g=new f;for(b=0;b<this.tracks_.children.length;b++){var h=this.tracks_.children[b],l=h.getBoundingClientRect(),o=Math.max(e,l.top),l=Math.min(a,l.bottom);o<=l&&h.addIntersectingItemsInRangeToSelection(c,d,e,a,g)}this.selection=g}},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);
112 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,d){d=d||0;"string"!=typeof a&&(a=""+a);if(a.length>=d)return"";for(var c="",f=0;f<d-a.length;f++)c+=" ";return c}function c(a,d){return a+e(a,d)}function f(a,d){return e(a,d)+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)+
115 " 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 d=document.createElement("div");d.classList.add("timeline-track-button");d.classList.add("timeline-track-close-button");d.textContent=String.fromCharCode(215);d.addEventListener("click",function(){a.style.display="None"});a.appendChild(d);if(b){var c=document.createElement("div");c.classList.add("timeline-track-button");c.classList.add("timeline-track-collapse-button");c.textContent="\u2212";var f=!1;c.addEventListener("click",function(){f=!f;a.collapsedDidChange(f);
116 c.textContent=f?"+":"\u2212"});a.appendChild(c)}}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=
118 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_=
121 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,
123 "";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";
127 {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_},
133 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,
136 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_},
141 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,
142 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=
143 "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;
144 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",
148 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_);
149 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";
155 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_=