blob: 063918fe9feed1d13c965b826c27c3b6a01ff04d [file] [log] [blame]
window.FLATTENED={};window.FLATTENED[".usr.local.android.jb1.external.chromium-trace.trace-viewer.src.base"]=!0;window.FLATTENED.event_target=!0;window.FLATTENED.measuring_stick=!0;window.FLATTENED.timeline_filter=!0;window.FLATTENED.timeline_selection=!0;window.FLATTENED.timeline_viewport=!0;window.FLATTENED.ui=!0;window.FLATTENED["tracks.timeline_track"]=!0;window.FLATTENED["tracks.timeline_container_track"]=!0;window.FLATTENED.fast_rect_renderer=!0;window.FLATTENED.timeline_color_scheme=!0;
window.FLATTENED["tracks.timeline_canvas_based_track"]=!0;window.FLATTENED.sorted_array_utils=!0;window.FLATTENED["tracks.timeline_slice_track"]=!0;window.FLATTENED.timeline_slice=!0;window.FLATTENED.timeline_slice_group=!0;window.FLATTENED.timeline_async_slice_group=!0;window.FLATTENED.timeline_thread=!0;window.FLATTENED.timeline_counter=!0;window.FLATTENED.timeline_process=!0;window.FLATTENED.timeline_cpu=!0;window.FLATTENED.timeline_model=!0;window.FLATTENED["tracks.timeline_cpu_track"]=!0;
window.FLATTENED["tracks.timeline_counter_track"]=!0;window.FLATTENED["tracks.timeline_slice_group_track"]=!0;window.FLATTENED["tracks.timeline_async_slice_group_track"]=!0;window.FLATTENED["tracks.timeline_thread_track"]=!0;window.FLATTENED["tracks.timeline_process_track"]=!0;window.FLATTENED["tracks.timeline_model_track"]=!0;window.FLATTENED["tracks.timeline_viewport_track"]=!0;window.FLATTENED.timeline=!0;window.FLATTENED.timeline_analysis=!0;window.FLATTENED.overlay=!0;
window.FLATTENED.timeline_category_filter_dialog=!0;window.FLATTENED.timeline_find_control=!0;window.FLATTENED.trace_event_importer=!0;window.FLATTENED.linux_perf_parser=!0;window.FLATTENED.linux_perf_cpufreq_parser=!0;window.FLATTENED.linux_perf_drm_parser=!0;window.FLATTENED.linux_perf_exynos_parser=!0;window.FLATTENED.linux_perf_gesture_parser=!0;window.FLATTENED.linux_perf_i915_parser=!0;window.FLATTENED.linux_perf_mali_parser=!0;window.FLATTENED.linux_perf_power_parser=!0;
window.FLATTENED.linux_perf_sched_parser=!0;window.FLATTENED.linux_perf_workqueue_parser=!0;window.FLATTENED.linux_perf_android_parser=!0;window.FLATTENED.linux_perf_importer=!0;window.FLATTENED.settings=!0;window.FLATTENED[".usr.local.android.jb1.external.chromium-trace.trace-viewer.src.timeline_view"]=!0;"use strict";var global=this;
this.base=function(){function e(a){"/"==a[a.length-1]&&(a=a.substring(0,a.length-1));p=a}function d(a,b){o[a]||(o[a]=[]);for(var c=o[a],f=!1,g=0;g<c.length;g++)c[g]==b&&(f=!0);f||c.push(b)}function a(a,b){r[a]||(r[a]=[]);for(var c=r[a],f=!1,g=0;g<c.length;g++)c[g]==b&&(f=!0);f||c.push(b)}function b(){if(!m){m=!0;var b=new XMLHttpRequest;b.open("GET",p+"/deps.js",!1);b.send(null);if(200!=b.status)throw Error("Could not find "+deps+". Run calcdeps.py and try again.");base.addModuleStylesheet=a;base.addModuleDependency=
d;try{eval(b.responseText)}catch(c){throw Error("When loading deps, got "+c.stack?c.stack:c);}delete base.addModuleDependency;delete base.addModuleStylesheet}}function c(a,g){var d=g||0;if(window.FLATTENED){if(!window.FLATTENED[a])throw Error("Somehow, module "+a+" didn't get flattened!");}else if(b(),"APPENDED"!=s[a]){if("RESOLVING"==s[a])throw Error("Circular dependency betwen modules. Cannot continue!");s[a]="RESOLVING";for(var l=r[a]||[],h=0;h<l.length;h++)f(l[h]);l=o[a]||[];for(h=0;h<l.length;h++)c(l[h],
d+1);d=a.replace(/\./g,"/")+".js";base.doc.write('<script type="text/javascript" src="'+(p+"/"+d)+'"><\/script>');s[a]="APPENDED"}}function f(a){if(!window.FLATTENED&&!t[a]){t[a]=!0;var a=a.replace(/\./g,"/")+".css",a=p+"/"+a,b=document.createElement("link");b.setAttribute("rel","stylesheet");b.setAttribute("href",a);base.doc.head.appendChild(b)}}function g(a,b,c,f){var g=new base.Event(b+"Change");g.propertyName=b;g.newValue=c;g.oldValue=f;a.dispatchEvent(g)}function l(a){return a.replace(/([A-Z])/g,
"-$1").toLowerCase()}function h(a,b){switch(b){case q.JS:var c=a+"_";return function(){return this[c]};case q.ATTR:var f=l(a);return function(){return this.getAttribute(f)};case q.BOOL_ATTR:return f=l(a),function(){return this.hasAttribute(f)}}}function j(a,b,c){switch(b){case q.JS:var f=a+"_";return function(b){var d=this[f];b!==d&&(this[f]=b,c&&c.call(this,b,d),g(this,a,b,d))};case q.ATTR:var d=l(a);return function(b){var f=this[d];b!==f&&(void 0==b?this.removeAttribute(d):this.setAttribute(d,b),
c&&c.call(this,b,f),g(this,a,b,f))};case q.BOOL_ATTR:return d=l(a),function(b){var f=this[d];b!==f&&(b?this.setAttribute(d,a):this.removeAttribute(d),c&&c.call(this,b,f),g(this,a,b,f))}}}function k(a,b,c){var f=base.doc.createEvent("Event");f.initEvent(a,!!b,!!c);f.__proto__=global.Event.prototype;return f}var p=".",m=!1,o={},r={},s={},t={},q={JS:"js",ATTR:"attr",BOOL_ATTR:"boolAttr"},v=1;return{set moduleBasePath(a){e(a)},get moduleBasePath(){return p},require:c,requireStylesheet:f,exportTo:function(a,
b){var c;c=a.split(".");for(var f=global,g;c.length&&(g=c.shift());)f=g in f?f[g]:f[g]={};c=f;try{var d=b()}catch(l){console.log("While running exports for ",name,":");console.log(l.stack||l);return}for(var h in d)(f=Object.getOwnPropertyDescriptor(d,h))&&Object.defineProperty(c,h,f)},addSingletonGetter:function(a){a.getInstance=function(){return a.instance_||(a.instance_=new a)}},createUid:function(){return v++},defineProperty:function(a,b,c,f){"function"==typeof a&&(a=a.prototype);c=c||q.JS;a.__lookupGetter__(b)||
a.__defineGetter__(b,h(b,c));a.__lookupSetter__(b)||a.__defineSetter__(b,j(b,c,f))},dispatchPropertyChange:g,dispatchSimpleEvent:function(a,b,c,f){b=new base.Event(b,c,f);return a.dispatchEvent(b)},Event:k,getUid:function(a){return a.hasOwnProperty("uid")?a.uid:a.uid=v++},initialize:function(){if(global.document)k.prototype={__proto__:global.Event.prototype},base.doc=document,base.isMac=/Mac/.test(navigator.platform),base.isWindows=/Win/.test(navigator.platform),base.isChromeOS=/CrOS/.test(navigator.userAgent),
base.isLinux=/Linux/.test(navigator.userAgent),base.isGTK=/GTK/.test(chrome.toolkit),base.isViews=/views/.test(chrome.toolkit),e("/src");else{var a=cr;Object.defineProperty(global,"cr",{get:function(){Object.defineProperty(global,"cr",{value:a});originalBase.initialize();return a},configurable:!0})}},PropertyKind:q}}();base.initialize();
base.exportTo("base",function(){function e(){}e.prototype={addEventListener:function(d,a){this.listeners_||(this.listeners_=Object.create(null));if(d in this.listeners_){var b=this.listeners_[d];0>b.indexOf(a)&&b.push(a)}else this.listeners_[d]=[a]},removeEventListener:function(d,a){if(this.listeners_&&d in this.listeners_){var b=this.listeners_[d],c=b.indexOf(a);0<=c&&(1==b.length?delete this.listeners_[d]:b.splice(c,1))}},dispatchEvent:function(d){if(!this.listeners_)return!0;var a=this;d.__defineGetter__("target",
function(){return a});d.preventDefault=function(){this.returnValue=!1};var b=d.type,c=0;if(b in this.listeners_)for(var b=this.listeners_[b].concat(),f=0,g;g=b[f];f++)c=g.handleEvent?c|!1===g.handleEvent.call(g,d):c|!1===g.call(this,d);return!c&&d.returnValue}};return{EventTarget:e}});
base.exportTo("tracing",function(){function e(){this.iframe_=void 0}e.prototype={__proto__:Object.prototype,measure:function(d){this.iframe_.contentDocument.body.appendChild(d);var a=this.iframe_.contentWindow.getComputedStyle(d),b=parseInt(a.width,10),a=parseInt(a.height,10);this.iframe_.contentDocument.body.removeChild(d);return{width:b,height:a}},attach:function(){var d=document.createElement("iframe");d.style.cssText="width:100%;height:0;border:0;visibility:hidden";document.body.appendChild(d);
this.iframe_=d;this.iframe_.contentDocument.body.style.cssText="padding:0;margin:0;overflow:hidden";for(var d=document.querySelectorAll("link[rel=stylesheet]"),a=0;a<d.length;a++){var b=d[a],c=this.iframe_.contentDocument.createElement("link");c.rel="stylesheet";c.href=b.href;this.iframe_.contentDocument.head.appendChild(c)}},detach:function(){document.body.removeChild(this.iframe_);this.iframe_=void 0}};return{MeasuringStick:e}});"use strict";
base.exportTo("tracing",function(){function e(){}function d(a){this.text_=a}function a(a){this.categories_={};for(var a=a||[],c=0;c<a.length;c++)this.addCategory(a[c])}e.prototype={__proto__:Object.prototype,matchCounter:function(){return!0},matchCpu:function(){return!0},matchProcess:function(){return!0},matchSlice:function(){return!0},matchThread:function(){return!0}};d.prototype={__proto__:e.prototype,matchSlice:function(a){return 0==this.text_.length||void 0===a.title?!1:-1!=a.title.indexOf(this.text_)}};
a.prototype={__proto__:e.prototype,addCategory:function(a){this.categories_[a]=!0},matchSlice:function(a){return!a.category?!0:!this.categories_[a.category]}};return{filterSliceArray:function(a,c){if(void 0===a)return c;for(var f=[],g=0;g<c.length;++g)a.matchSlice(c[g])&&f.push(c[g]);return f},TimelineFilter:e,TimelineTitleFilter:d,TimelineCategoryFilter:a}});"use strict";base.require("event_target");
base.exportTo("tracing",function(){function e(a,c){this.track=a;this.slice=c}function d(a,c,f){this.track=a;this.counter=c;this.sampleIndex=f}function a(){this.range_dirty_=!0;this.range_={};this.length_=0}e.prototype={get selected(){return this.slice.selected},set selected(a){this.slice.selected=a}};d.prototype={get selected(){return!0==this.track.selectedSamples[this.sampleIndex]},set selected(a){this.track.selectedSamples[this.sampleIndex]=a?!0:!1;this.track.invalidate()}};a.prototype={__proto__:Object.prototype,
get range(){if(this.range_dirty_){for(var a=Infinity,c=-a,f=0;f<this.length_;f++){var g=this[f];g.slice&&(a=Math.min(a,g.slice.start),c=Math.max(c,g.slice.end))}this.range_={min:a,max:c};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,
c){return this.push_(new e(a,c))},addCounterSample:function(a,c,f){return this.push_(new d(a,c,f))},subSelection:function(b,c){var c=c||1,f=new a;f.range_dirty_=!0;if(0>b||b+c>this.length_)throw Error("Index out of bounds");for(var g=b;g<b+c;g++)f.push_(this[g]);return f},getCounterSampleHits:function(){for(var b=new a,c=0;c<this.length_;c++)this[c]instanceof d&&b.push_(this[c]);return b},getSliceHits:function(){for(var b=new a,c=0;c<this.length_;c++)this[c]instanceof e&&b.push_(this[c]);return b},
map:function(a){for(var c=0;c<this.length_;c++)a(this[c])},getShiftedSelection:function(b){for(var c=new a,f=0;f<this.length_;f++){var g=this[f];g.track.addItemNearToProvidedHitToSelection(g,b,c)}return 0==c.length?void 0:c}};return{TimelineSelectionSliceHit:e,TimelineSelectionCounterSampleHit:d,TimelineSelection:a}});"use strict";base.require("event_target");
base.exportTo("tracing",function(){function e(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);this.markers=[]}function d(a,b){this.viewport_=a;this.positionWorld_=b;this.selected_=!1}e.prototype={__proto__:base.EventTarget.prototype,drawUnderContent:function(){},drawOverContent:function(a,
b,c,f){if(this.gridEnabled){var g=this.gridTimebase;for(a.beginPath();g<c;){if(g>=b){var d=this.xWorldToView(g);a.moveTo(d,0);a.lineTo(d,f)}g+=this.gridStep}a.strokeStyle="rgba(255,0,0,0.25)";a.stroke()}for(g=0;g<this.markers.length;++g)this.markers[g].drawLine(a,b,c,f,this)},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;if(this.pendingSetFunction_){this.lastSize_=a;try{this.pendingSetFunction_()}catch(b){console.log("While running setWhenPossible:",
b)}this.pendingSetFunction_=void 0}window.clearInterval(this.checkForAttachInterval_);this.checkForAttachInterval_=void 0}},dispatchChangeEvent:function(){base.dispatchSimpleEvent(this,"change")},dispatchMarkersChangeEvent_:function(){base.dispatchSimpleEvent(this,"markersChange")},detach:function(){this.checkForAttachInterval_&&(window.clearInterval(this.checkForAttachInterval_),this.checkForAttachInterval_=void 0);this.iframe_&&(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,c){if("string"==typeof b)if("left"==b)b=0;else if("center"==b)b=c/2;else if("right"==b)b=c-1;else throw Error("unrecognized string for viewPos. left|center|right");this.panX=b/this.scaleX_-a},xPanWorldRangeIntoView:function(a,b,c){0>this.xWorldToView(a)?this.xPanWorldPosToViewPos(a,"left",c):this.xWorldToView(b)>c&&this.xPanWorldPosToViewPos(b,"right",c)},xSetWorldRange:function(a,b,c){this.setPanAndScale(-a,
c/(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,base.dispatchSimpleEvent(this,"change"))},get gridStep(){return this.gridStep_},applyTransformToCanvas:function(a){a.transform(this.scaleX_,0,0,1,this.panX_*this.scaleX_,0)},addMarker:function(a){a=new d(this,a);this.markers.push(a);this.dispatchChangeEvent();
this.dispatchMarkersChangeEvent_();return a},removeMarker:function(a){for(var b=0;b<this.markers.length;++b)if(this.markers[b]===a)return this.markers.splice(b,1),this.dispatchChangeEvent(),this.dispatchMarkersChangeEvent_(),!0},findMarkerNear:function(a,b){for(var c=this.xViewVectorToWorld(b),f=0;f<this.markers.length;++f)if(Math.abs(this.markers[f].positionWorld-a)<=c)return this.markers[f]}};d.prototype={get positionWorld(){return this.positionWorld_},set positionWorld(a){this.positionWorld_=a;
this.viewport_.dispatchChangeEvent()},set selected(a){this.selected_=a;this.viewport_.dispatchChangeEvent()},get selected(){return this.selected_},get color(){return this.selected?"rgb(255,0,0)":"rgb(0,0,0)"},drawTriangle_:function(a,b,c,f,g,d){a.beginPath();var h=this.positionWorld_;h>=b&&h<c&&(b=d.xWorldToView(h),a.moveTo(b,g),a.lineTo(b-3,g/2),a.lineTo(b+3,g/2),a.lineTo(b,g),a.closePath(),a.fillStyle=this.color,a.fill(),g!=f&&(a.beginPath(),a.moveTo(b,g),a.lineTo(b,f),a.closePath(),a.strokeStyle=
this.color,a.stroke()))},drawLine:function(a,b,c,f,g){a.beginPath();var d=this.positionWorld_;d>=b&&d<c&&(b=g.xWorldToView(d),a.moveTo(b,0),a.lineTo(b,f));a.strokeStyle=this.color;a.stroke()}};return{TimelineViewport:e,TimelineViewportMarker:d}});
base.exportTo("base.ui",function(){function e(d,a){return(a&&a.ownerDocument?a.ownerDocument:base.doc).createElement(d)}return{decorate:function(d,a){var b;b="string"==typeof d?base.doc.querySelectorAll(d):[d];for(var c=0,f;f=b[c];c++)f instanceof a||a.decorate(f)},define:function(d){function a(f){var g=b(c,f);a.decorate(g);for(var d in f)g[d]=f[d];return g}var b,c;"function"==typeof d?(b=d,c=""):(b=e,c=d);a.decorate=function(b){b.__proto__=a.prototype;b.decorate()};return a},limitInputWidth:function(d,
a,b){function c(){if(d.scrollWidth>k)d.style.width=k+"px";else{d.style.width=0;var a=d.scrollWidth;d.style.width=a<b?b+"px":a+"px"}}d.style.width="10px";var f=d.ownerDocument.defaultView,g=f.getComputedStyle(d),f=f.getComputedStyle(a),l="rtl"==g.direction,h=d.getBoundingClientRect(),e=a.getBoundingClientRect(),h=l?e.right-h.right:h.left-e.left,g=parseInt(g.borderLeftWidth,10)+parseInt(g.paddingLeft,10)+parseInt(g.paddingRight,10)+parseInt(g.borderRightWidth,10),f=l?parseInt(f.paddingLeft,10):parseInt(f.paddingRight,
10),k=a.clientWidth-h-g-f;d.addEventListener("input",c);c()},toCssPx:function(d){window.isFinite(d)||console.error("Pixel value is not a number: "+d);return Math.round(d)+"px"}}});base.requireStylesheet("tracks.timeline_track");base.require("ui");
base.exportTo("tracks",function(){var e=base.ui.define("div");e.prototype={__proto__:HTMLDivElement.prototype,decorate:function(){},get visible(){return"none"!==this.style.display},set visible(d){this.style.display=d?"":"none"},get numVisibleTracks(){return this.visible?1:0},addControlButtonElements_:function(d){var a=document.createElement("div");a.classList.add("timeline-track-button");a.classList.add("timeline-track-close-button");a.textContent=String.fromCharCode(215);var b=this;a.addEventListener("click",
function(){b.style.display="None"});this.appendChild(a);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;this.collapsedDidChange(f);c.textContent=f?"+":"\u2212"});this.appendChild(c);d||(c.style.display="None")}};return{TimelineTrack:e}});"use strict";base.require("tracks.timeline_track");base.require("timeline_filter");base.require("ui");
base.exportTo("tracks",function(){var e=base.ui.define(tracks.TimelineTrack);e.prototype={__proto__:tracks.TimelineTrack.prototype,decorate:function(){this.categoryFilter_=new tracing.TimelineFilter;this.headingWidth_=void 0;this.tracks_=[]},detach:function(){this.detachAllChildren()},detachAllChildren:function(){for(var d=0;d<this.tracks_.length;d++)this.tracks_[d].detach();this.tracks_=[];this.textContent=""},get viewport(){return this.viewport_},set viewport(d){this.viewport_=d;for(var a=0;a<this.tracks_.length;a++)this.tracks_[a].viewport=
d},get firstCanvas(){for(var d=0;d<this.tracks_.length;d++)if(this.tracks_[d].visible)return this.tracks_[d].firstCanvas},get numVisibleTracks(){return!this.visible?0:this.numVisibleChildTracks},get numVisibleChildTracks(){for(var d=0,a=0;a<this.tracks_.length;++a)d+=this.tracks_[a].numVisibleTracks;return d},get headingWidth(){return this.headingWidth_},set headingWidth(d){this.headingWidth_=d;for(var a=0;a<this.tracks_.length;++a)this.tracks_[a].headingWidth=d},get categoryFilter(){return this.categoryFilter_},
set categoryFilter(d){this.categoryFilter_=d;for(var a=0;a<this.tracks_.length;++a)this.tracks_[a].categoryFilter=d;this.applyCategoryFilter_();this.updateFirstVisibleChildCSS()},applyCategoryFilter_:function(){},addTrack_:function(d){d.headingWidth=this.headingWidth_;d.viewport=this.viewport_;d.categoryFilter=this.categoryFilter;this.tracks_.push(d);this.appendChild(d);return d},updateFirstVisibleChildCSS:function(){for(var d=!0,a=0;a<this.tracks_.length;++a){var b=this.tracks_[a];d&&b.visible?(b.classList.add("first-visible-child"),
d=!1):b.classList.remove("first-visible-child")}},addIntersectingItemsToSelection:function(d,a,b){for(var c=0;c<this.tracks_.length;c++){var f=this.tracks_[c].getBoundingClientRect();a>=f.top&&a<f.bottom&&this.tracks_[c].addIntersectingItemsToSelection(d,a,b)}return!1},addIntersectingItemsInRangeToSelection:function(d,a,b,c,f){for(var g=0;g<this.tracks_.length;g++){var l=this.tracks_[g].getBoundingClientRect(),h=Math.max(b,l.top),l=Math.min(c,l.bottom);h<=l&&this.tracks_[g].addIntersectingItemsInRangeToSelection(d,
a,b,c,f)}},addAllObjectsMatchingFilterToSelection:function(d,a){for(var b=0;b<this.tracks_.length;b++)this.tracks_[b].addAllObjectsMatchingFilterToSelection(d,a)}};return{TimelineContainerTrack:e}});
base.exportTo("tracing",function(){function e(d,a,b,c){this.ctx_=d;this.minRectSize_=a;this.maxMergeDist_=b;this.pallette_=c}e.prototype={y_:0,h_:0,merging_:!1,mergeStartX_:0,mergeCurRight_:0,setYandH:function(d,a){this.flush();this.y_=d;this.h_=a},fillRect:function(d,a,b){var c=d+a;a<this.minRectSize_?(c-this.mergeStartX_>this.maxMergeDist_&&this.flush(),this.merging_?(this.mergeCurRight_=c,this.mergedColorId=Math.max(this.mergedColorId,b)):(this.merging_=!0,this.mergeStartX_=d,this.mergeCurRight_=
c,this.mergedColorId=b)):(this.merging_&&this.flush(),this.ctx_.fillStyle=this.pallette_[b],this.ctx_.fillRect(d,this.y_,a,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:e}});"use strict";
base.exportTo("tracing",function(){function e(a){for(var b=0,c=0;c<a.length;++c)b=(b+37*b+11*a.charCodeAt(c))%4294967295;return b}var d=[{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}],a=d.length-4,b=d.length,c=d.concat(d.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+")"}),f={};return{getColorPalette:function(){return c},getColorPaletteHighlightIdBoost:function(){return b},getColorIdByName:function(b){if("iowait"==b)return a;if("running"==b)return a+1;if("runnable"==b)return a+2;if("sleeping"==b)return a+3;throw Error("Unrecognized color ")+b;},getStringHash:e,getStringColorId:function(b){if(void 0===f[b]){var c=e(b);f[b]=c%a}return f[b]}}});"use strict";base.requireStylesheet("tracks.timeline_canvas_based_track");
base.require("tracks.timeline_track");base.require("fast_rect_renderer");base.require("timeline_color_scheme");base.require("ui");
base.exportTo("tracks",function(){var e=base.ui.define(tracks.TimelineTrack);e.prototype={__proto__:tracks.TimelineTrack.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.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_),this.viewport_.removeEventListener("markersChange",this.viewportMarkersChangeBoundToThis_))},set headingWidth(d){this.headingDiv_.style.width=d},get heading(){return this.headingDiv_.textContent},
set heading(d){this.headingDiv_.textContent=d},set tooltip(d){this.headingDiv_.title=d},get viewport(){return this.viewport_},set viewport(d){if(this.viewport_=d)this.viewport_.removeEventListener("change",this.viewportChangeBoundToThis_),this.viewport_.removeEventListener("markersChange",this.viewportMarkersChangeBoundToThis_);if(this.viewport_=d)this.viewportChangeBoundToThis_=this.viewportChange_.bind(this),this.viewport_.addEventListener("change",this.viewportChangeBoundToThis_),this.viewportMarkersChangeBoundToThis_=
this.viewportMarkersChange_.bind(this),this.viewport_.addEventListener("markersChange",this.viewportMarkersChangeBoundToThis_),this.isAttachedToDocument_&&this.updateCanvasSizeIfNeeded_();this.invalidate()},viewportChange_:function(){this.invalidate()},viewportMarkersChange_:function(){2>this.viewport_.markers.length?this.classList.remove("timeline-viewport-track-with-distance-measurements"):this.classList.add("timeline-viewport-track-with-distance-measurements")},invalidate:function(){this.rafPending_||
(webkitRequestAnimationFrame(function(){this.rafPending_=!1;this.viewport_&&(this.updateCanvasSizeIfNeeded_(),this.redraw())}.bind(this),this),this.rafPending_=!0)},get isAttachedToDocument_(){var d=this.parentNode;if(d){for(;d.parentNode;)d=d.parentNode;return d==this.ownerDocument}},updateCanvasSizeIfNeeded_:function(){var d=window.getComputedStyle(this.canvasContainer_),a=parseInt(d.width)-parseInt(d.paddingLeft)-parseInt(d.paddingRight)-parseInt(d.borderLeftWidth)-parseInt(d.borderRightWidth),
d=parseInt(d.height)-parseInt(d.paddingTop)-parseInt(d.paddingBottom)-parseInt(d.borderTopWidth)-parseInt(d.borderBottomWidth),b=window.devicePixelRatio||1;this.canvas_.width!=a&&(this.canvas_.width=a*b,this.canvas_.style.width=a+"px");this.canvas_.height!=d&&(this.canvas_.height=d*b,this.canvas_.style.height=d+"px")},get firstCanvas(){return this.canvas_}};return{TimelineCanvasBasedTrack:e}});
base.exportTo("tracing",function(){function e(a,b,c){if(0==a.length)return 1;for(var f=0,g=a.length-1,d,h,e=-1;f<=g;)d=Math.floor((f+g)/2),h=b(a[d])-c,0>h?f=d+1:(0<h||(e=d),g=d-1);return-1!=e?e:f}function d(a,b,c,f,g,d){if(0!=a.length&&!(f>g)){var h=e(a,b,f);if(-1!=h&&(0<h&&b(a[h-1])+c(a[h-1])>=f&&d(a[h-1]),h!=a.length))for(c=a.length;h<c&&!(b(a[h])>=g);h++)d(a[h])}}return{findLowIndexInSortedArray:e,findLowIndexInSortedIntervals:function(a,b,c,f){var g=e(a,b,f);return 0==g?f>=b(a[0])&&f<b(a[0]+c(a[0]))?
0:-1:g<=a.length&&f>=b(a[g-1])&&f<b(a[g-1])+c(a[g-1])?g-1:a.length},iterateOverIntersectingIntervals:d,getIntersectingIntervals:function(a,b,c,f,g){var l=[];d(a,b,c,f,g,function(a){l.push(a)});return l}}});"use strict";base.requireStylesheet("tracks.timeline_slice_track");base.require("tracks.timeline_canvas_based_track");base.require("sorted_array_utils");base.require("fast_rect_renderer");base.require("timeline_color_scheme");base.require("ui");
base.exportTo("tracks",function(){function e(){}function d(a,b){this.string=a;this.width=b}var a=tracing.getColorPalette(),b=base.ui.define(tracks.TimelineCanvasBasedTrack);b.prototype={__proto__:tracks.TimelineCanvasBasedTrack.prototype,SHOULD_ELIDE_TEXT:!0,decorate:function(){this.classList.add("timeline-slice-track");this.elidedTitleCache=new e;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||[];a||(this.visible=!1);this.invalidate()},get height(){return window.getComputedStyle(this).height},set height(a){this.style.height=a;this.invalidate()},labelWidth:function(a){var b=f[a];b||(b=this.ctx_.measureText(a).width,f[a]=b);return b+2},labelWidthWorld:function(a,b){return this.labelWidth(a)*b},redraw:function(){var b=this.ctx_,f=this.canvas_.width,g=this.canvas_.height;b.clearRect(0,0,f,g);var d=this.viewport_,e=d.xViewVectorToWorld(1),m=d.xViewToWorld(0),f=
d.xViewToWorld(f);d.drawUnderContent(b,m,f,g);b.save();d.applyTransformToCanvas(b);this.asyncStyle_&&(b.globalAlpha=0.25);var o=new tracing.FastRectRenderer(b,2*e,2*e,a);o.setYandH(0,g);for(var r=this.slices_,s=tracing.findLowIndexInSortedArray(r,function(a){return a.start+a.duration},m),t=s;t<r.length;++t){var q=r[t],v=q.start;if(v>f)break;var w=Math.max(q.duration,0.001),u=q.selected?q.colorId+c:q.colorId;w<e&&(w=e);0<q.duration?o.fillRect(v,w,u):0.001<e?o.fillRect(v,e,u):(b.fillStyle=a[u],b.beginPath(),
b.moveTo(v-4*e,g),b.lineTo(v,0),b.lineTo(v+4*e,g),b.closePath(),b.fill())}o.flush();b.restore();o=window.devicePixelRatio||1;if(8<g){b.textAlign="center";b.textBaseline="top";b.font=10*o+"px sans-serif";b.strokeStyle="rgb(0,0,0)";b.fillStyle="rgb(0,0,0)";v=20*e;w=this.SHOULD_ELIDE_TEXT;for(t=s;t<r.length;++t){q=r[t];if(q.start>f)break;if(q.duration>v&&(s=q.title,q.didNotFinish&&(s+=" (Did Not Finish)"),u=this.labelWidth(s),w&&this.labelWidthWorld(s,e)>q.duration&&(u=this.elidedTitleCache.get(this,
e,s,u,q.duration),s=u.string,u=u.width),u*e<q.duration))q=d.xWorldToView(q.start+0.5*q.duration),b.fillText(s,q,2.5*o,u)}}d.drawOverContent(b,m,f,g)},addIntersectingItemsToSelection:function(a,b,c){var f=this.getBoundingClientRect();if(b<f.top||b>=f.bottom)return!1;a=this.viewport_.xViewVectorToWorld(a*devicePixelRatio);a=tracing.findLowIndexInSortedIntervals(this.slices_,function(a){return a.start},function(a){return a.duration},a);return 0<=a&&a<this.slices_.length?(c=c.addSlice(this,this.slices_[a]),
this.decorateHit(c),!0):!1},addIntersectingItemsInRangeToSelection:function(a,b,c,f,g){function d(a){a=g.addSlice(r,a);r.decorateHit(a)}var e=window.devicePixelRatio||1,a=this.viewport_.xViewToWorld(a*e),b=this.viewport_.xViewToWorld(b*e),e=this.getBoundingClientRect(),c=Math.max(c,e.top),f=Math.min(f,e.bottom);if(!(c>f)){var r=this;tracing.iterateOverIntersectingIntervals(this.slices_,function(a){return a.start},function(a){return a.duration},a,b,d)}},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)if(a.matchSlice(this.slices_[c])){var f=
b.addSlice(this,this.slices_[c]);this.decorateHit(f)}}};var c=tracing.getColorPaletteHighlightIdBoost(),f={},g={};e.prototype={get:function(a,b,c,f,e){var m=g[c];m||(m={},g[c]=m);f=m[b];f||(m[b]={},f=m[b]);m=f[e];if(void 0===m){for(m=!1;a.labelWidthWorld(c,b)>e;)c=c.substring(0,0.75*c.length),m=!0;m&&3<c.length&&(c=c.substring(0,c.length-3)+"...");m=new d(c,a.labelWidth(c));f[e]=m}return m}};return{TimelineSliceTrack:b}});"use strict";
base.exportTo("tracing",function(){function e(d,a,b,c,f,g){this.category=d||"";this.title=a;this.start=c;this.colorId=b;this.args=f;this.didNotFinish=!1;void 0!==g&&(this.duration=g)}e.prototype={selected:!1,duration:void 0,get end(){return this.start+this.duration}};return{TimelineSlice:e}});"use strict";base.require("timeline_slice");base.require("timeline_color_scheme");base.require("timeline_filter");
base.exportTo("tracing",function(){function e(a){this.sliceConstructor=a||d;this.openPartialSlices_=[];this.slices=[]}var d=tracing.TimelineSlice;e.prototype={__proto__:Object.prototype,pushSlice:function(a){this.slices.push(a);return a},pushSlices:function(a){this.slices.push.apply(this.slices,a)},beginSlice:function(a,b,c,f){if(this.openPartialSlices_.length&&c<this.openPartialSlices_[this.openPartialSlices_.length-1].start)throw Error("Slices must be added in increasing timestamp order");var g=
tracing.getStringColorId(b),a=new this.sliceConstructor(a,b,g,c,f?f:{});this.openPartialSlices_.push(a);return a},isTimestampValidForBeginOrEnd:function(a){return!this.openPartialSlices_.length?!0:a>=this.openPartialSlices_[this.openPartialSlices_.length-1].start},get openSliceCount(){return this.openPartialSlices_.length},endSlice:function(a){if(!this.openSliceCount)throw Error("endSlice called without an open slice");var b=this.openPartialSlices_[this.openSliceCount-1];this.openPartialSlices_.splice(this.openSliceCount-
1,1);if(a<b.start)throw Error("Slice "+b.name+" end time is before its start.");b.duration=a-b.start;this.pushSlice(b);return b},autoCloseOpenSlices:function(a){a||(this.updateBounds(),a=this.maxTimestamp);for(;0<this.openSliceCount;)this.endSlice(a).didNotFinish=!0},shiftTimestampsForward:function(a){for(var b=0;b<this.slices.length;b++){var c=this.slices[b];c.start+=a}for(b=0;b<this.openPartialSlices_.length;b++)c=this.openPartialSlices_[i],c.start+=a},updateBounds:function(){var a=[];if(this.slices.length){for(var b=
Number.MAX_VALUE,c=-Number.MAX_VALUE,f=0;f<this.slices.length;f++)if(this.slices[f].start<b&&(b=this.slices[f].start),this.slices[f].end>c)c=this.slices[f].end;a.push(b);a.push(c)}this.openPartialSlices_.length&&(a.push(this.openPartialSlices_[0].start),a.push(this.openPartialSlices_[this.openPartialSlices_.length-1].start));a.length?(this.minTimestamp=Math.min.apply(Math,a),this.maxTimestamp=Math.max.apply(Math,a)):this.maxTimestamp=this.minTimestamp=void 0}};return{TimelineSliceGroup:e}});"use strict";
base.require("timeline_slice");
base.exportTo("tracing",function(){function e(b,c,f,g,d){a.call(this,b,c,f,g,d)}function d(a){this.name=a;this.slices=[]}var a=tracing.TimelineSlice;e.prototype={__proto__:a.prototype,toJSON:function(){for(var a={},c=Object.keys(this),f=0;f<c.length;f++){var g=c[f];"function"!=typeof this[g]&&(a[g]="startThread"==g||"endThread"==g?this[g].ptid:this[g])}return a},id:void 0,startThread:void 0,endThread:void 0,subSlices:void 0};d.prototype={__proto__:Object.prototype,push:function(a){this.slices.push(a)},get length(){return this.slices.length},
shiftTimestampsForward:function(a){for(var c=0;c<this.slices.length;c++){var f=this.slices[c];f.start+=a;for(var g=0;g<f.subSlices.length;g++)f.subSlices[g].start+=a}},updateBounds:function(){if(this.slices.length){for(var a=Number.MAX_VALUE,c=-Number.MAX_VALUE,f=0;f<this.slices.length;f++)if(this.slices[f].start<a&&(a=this.slices[f].start),this.slices[f].end>c)c=this.slices[f].end;this.minTimestamp=a;this.maxTimestamp=c}else this.maxTimestamp=this.minTimestamp=void 0},computeSubGroups:function(){for(var a=
{},c=0;c<this.slices.length;++c){var f=this.slices[c],g=f.startThread.ptid;a[g]||(a[g]=new d(this.name));a[g].slices.push(f)}var c=[],l;for(l in a)f=a[l],f.updateBounds(),c.push(f);return c}};return{TimelineAsyncSlice:e,TimelineAsyncSliceGroup:d}});"use strict";base.require("timeline_slice");base.require("timeline_slice_group");base.require("timeline_async_slice_group");
base.exportTo("tracing",function(){function e(b,c,f,d,e,p){a.call(this,b,c,f,d,e,p);this.subSlices=[]}function d(a,f){b.call(this,e);if(!a)throw Error("Parent must be provided.");this.pid=a.pid;this.tid=f;this.cpuSlices=void 0;this.asyncSlices=new c(this.ptid)}var a=tracing.TimelineSlice,b=tracing.TimelineSliceGroup,c=tracing.TimelineAsyncSliceGroup;e.prototype={__proto__:a.prototype};var f={};d.getPTIDFromPidAndTid=function(a,b){f[a]||(f[a]={});f[a][b]||(f[a][b]=a+":"+b);return f[a][b]};d.prototype=
{__proto__:b.prototype,name:void 0,get ptid(){return d.getPTIDFromPidAndTid(this.tid,this.pid)},shiftTimestampsForward:function(a){b.prototype.shiftTimestampsForward.call(this,a);if(this.cpuSlices)for(var c=0;c<this.cpuSlices.length;c++)this.cpuSlices[c].start+=a;this.asyncSlices.shiftTimestampsForward(a)},get isEmpty(){return this.slices.length||this.openSliceCount||this.cpuSlices&&this.cpuSlices.length||this.asyncSlices.length?!1:!0},updateBounds:function(){b.prototype.updateBounds.call(this);var a=
[];void 0!==this.minTimestamp&&a.push(this.minTimestamp,this.maxTimestamp);this.asyncSlices.slices.length&&(this.asyncSlices.updateBounds(),a.push(this.asyncSlices.minTimestamp),a.push(this.asyncSlices.maxTimestamp));this.cpuSlices&&this.cpuSlices.length&&(a.push(this.cpuSlices[0].start),a.push(this.cpuSlices[this.cpuSlices.length-1].end));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.pid+
": "+(this.name||this.tid)},get userFriendlyDetails(){return"pid: "+this.pid+", tid: "+this.tid+(this.name?", name: "+this.name:"")}};d.compare=function(a,b){if(a.pid!=b.pid)return a.pid-b.pid;if(a.name&&b.name){var c=a.name.localeCompare(b.name);return 0==c?a.tid-b.tid:c}return a.name?-1:b.name?1:a.tid-b.tid};return{TimelineThreadSlice:e,TimelineThread:d}});"use strict";
base.exportTo("tracing",function(){function e(a,b,c,f){null==a?this.parent_id=null:void 0!=a.pid?this.parent_id=a.pid:void 0!=a.cpuNumber&&(this.parent_id=a.cpuNumber);this.id=b;this.category=c||"";this.name=f;this.seriesNames=[];this.seriesColors=[];this.timestamps=[];this.samples=[];this.guid_=d++}var d=1;e.prototype={__proto__:Object.prototype,get guid(){return this.guid_},get numSeries(){return this.seriesNames.length},get numSamples(){return this.timestamps.length},getSampleValue:function(a,
b){return this.samples[a*this.numSeries+b]},getSampleStatistics:function(a){a.sort();for(var b=this.numSeries,c=[],f=0;f<b;++f){for(var g=0,d=Number.MAX_VALUE,e=-Number.MAX_VALUE,j=0;j<a.length;j++)var k=a[j],g=g+this.getSampleValue(k,f),d=Math.min(this.getSampleValue(k,f),d),e=Math.max(this.getSampleValue(k,f),e);g/=a.length;j=this.getSampleValue(a[0],f);k=this.getSampleValue(a[a.length-1],f);c.push({min:d,max:e,avg:g,start:j,end:k})}return c},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 Error("seriesNames.length must match seriesColors.length");if(this.numSeries*this.numSamples!=this.samples.length)throw Error("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,
c=0;c<this.timestamps.length;c++){for(var f=0,g=0;g<a;g++)f+=this.samples[c*a+g],this.totals.push(f);f>b&&(b=f)}this.maxTotal=b}}};e.compare=function(a,b){if(a.parent_id!=b.parent_id)return a.parent_id-b.parent_id;var c=a.name.localeCompare(b.name);return 0==c?a.tid-b.tid:c};return{TimelineCounter:e}});"use strict";base.require("timeline_thread");base.require("timeline_counter");
base.exportTo("tracing",function(){function e(a){this.pid=a;this.threads={};this.counters={}}var d=tracing.TimelineThread,a=tracing.TimelineCounter;e.prototype={get numThreads(){var a=0,c;for(c in this.threads)a++;return a},shiftTimestampsForward:function(a){for(var c in this.threads)this.threads[c].shiftTimestampsForward(a);for(var f in this.counters)this.counters[f].shiftTimestampsForward(a)},getOrCreateThread:function(a){this.threads[a]||(this.threads[a]=new d(this,a));return this.threads[a]},
getOrCreateCounter:function(b,c){var f=b+"."+c;this.counters[f]||(this.counters[f]=new a(this,f,b,c));return this.counters[f]}};e.compare=function(a,c){return a.pid-c.pid};return{TimelineProcess:e}});"use strict";base.require("timeline_slice");base.require("timeline_counter");
base.exportTo("tracing",function(){function e(a){this.cpuNumber=a;this.slices=[];this.counters={}}var d=tracing.TimelineCounter;e.prototype={getOrCreateCounter:function(a,b){var c;c=a.length?a+"."+b:b;this.counters[c]||(this.counters[c]=new d(this,c,a,b));return this.counters[c]},shiftTimestampsForward:function(a){for(var b=0;b<this.slices.length;b++)this.slices[b].start+=a;for(var c in this.counters)this.counters[c].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}};e.compare=function(a,b){return a.cpuNumber-b.cpuNumber};return{TimelineCpu:e}});"use strict";base.require("event_target");base.require("timeline_process");base.require("timeline_cpu");base.require("timeline_filter");
base.exportTo("tracing",function(){function e(a,b){this.cpus={};this.processes={};this.importErrors=[];this.metadata=[];this.categories=[];a&&this.importTraces([a],b)}function d(){this.importPriority=0}var a=tracing.TimelineProcess,b=tracing.TimelineCpu,c=[];e.registerImporter=function(a){c.push(a)};d.canImport=function(a){return a instanceof Array&&0==a.length?!0:"string"===typeof a||a instanceof String?0==a.length:!1};d.prototype={__proto__:Object.prototype,importEvents:function(){},finalizeImport:function(){}};
e.registerImporter(d);e.prototype={__proto__:base.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]},autoCloseOpenSlices_:function(){this.updateBounds();var a=this.maxTimestamp,b;for(b in this.processes){var c=this.processes[b],d;for(d in c.threads)c.threads[d].autoCloseOpenSlices(a)}},
updateCategories_:function(){for(var a in this.processes){var b=this.processes[a],c;for(c in b.threads)for(var d=b.threads[c].slices,e=0;e<d.length;e++){var k=d[e].category;k&&-1==this.categories.indexOf(k)&&this.categories.push(k)}}for(var p in this.cpus){d=this.cpus[p].slices;for(e=0;e<d.length;e++)(k=d[e].category)&&-1==this.categories.indexOf(k)&&this.categories.push(k)}},pruneEmptyThreads_:function(){for(var a in this.processes){var b=this.processes[a],c={},d;for(d in b.threads){var e=b.threads[d];
e.isEmpty||(c[d]=e)}b.threads=c}},updateBounds:function(){for(var a=Infinity,b=-a,c=!1,d=this.getAllThreads(),e=0;e<d.length;e++){var k=d[e];k.updateBounds();void 0!=k.minTimestamp&&void 0!=k.maxTimestamp&&(a=Math.min(a,k.minTimestamp),b=Math.max(b,k.maxTimestamp),c=!0)}d=this.getAllCounters();for(e=0;e<d.length;e++)k=d[e],k.updateBounds(),void 0!=k.minTimestamp&&void 0!=k.maxTimestamp&&(c=!0,a=Math.min(a,k.minTimestamp),b=Math.max(b,k.maxTimestamp));for(var p in this.cpus)e=this.cpus[p],e.updateBounds(),
void 0!=e.minTimestamp&&void 0!=e.maxTimestamp&&(c=!0,a=Math.min(a,e.minTimestamp),b=Math.max(b,e.maxTimestamp));c?(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 c in this.cpus)this.cpus[c].shiftTimestampsForward(-a);this.updateBounds()}},getAllThreads:function(){var a=[],b;for(b in this.processes){var c=
this.processes[b],d;for(d in c.threads)a.push(c.threads[d])}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 c=this.processes[b],d;for(d in c.counters)a.push(c.counters[d])}for(var e in this.cpus){b=this.cpus[e];for(var k in b.counters)a.push(b.counters[k])}return a},findAllThreadsNamed:function(a){for(var b=
[],c=this.getAllThreads(),d=0;d<c.length;d++){var e=c[d];e.name==a&&b.push(e)}return b},createImporter_:function(a){for(var b,d=0;d<c.length;++d)if(c[d].canImport(a)){b=c[d];break}if(!b)throw Error("Could not find an importer for the provided eventData.");return new b(this,a)},importTraces:function(a,b){void 0===b&&(b=!0);for(var c=[],d=0;d<a.length;++d)c.push(this.createImporter_(a[d]));c.sort(function(a,b){return a.importPriority-b.importPriority});for(d=0;d<c.length;d++)c[d].importEvents(0<d);
this.autoCloseOpenSlices_();for(d=0;d<c.length;d++)c[d].finalizeImport();this.pruneEmptyThreads_();this.updateBounds();this.updateCategories_();b&&this.shiftWorldToZero()}};return{TimelineModel:e}});"use strict";base.require("tracks.timeline_container_track");base.require("tracks.timeline_slice_track");base.require("timeline_filter");base.require("timeline_model");base.require("ui");
base.exportTo("tracks",function(){var e=base.ui.define(tracks.TimelineContainerTrack);e.prototype={__proto__:tracks.TimelineContainerTrack.prototype,decorate:function(){this.classList.add("timeline-cpu-track")},get cpu(){return this.cpu_},set cpu(d){this.cpu_=d;this.updateChildTracks_()},get tooltip(){return this.tooltip_},set tooltip(d){this.tooltip_=d;this.updateChildTracks_()},get heading(){return this.heading_},set heading(d){this.heading_=d;this.updateChildTracks_()},applyCategoryFilter_:function(){this.categoryFilter.matchCpu(this.cpu_)?
this.updateChildTracks_():this.visible=!1},updateChildTracks_:function(){this.detach();if(this.cpu_){var d=tracing.filterSliceArray(this.categoryFilter_,this.cpu_.slices);if(d.length){var a=new tracks.TimelineSliceTrack;a.slices=d;a.heading=this.heading_;a.tooltip=this.tooltip_;this.addTrack_(a)}for(var b in this.cpu_.counters)d=this.cpu_.counters[b],a=new tracks.TimelineCounterTrack,a.heading="CPU "+this.cpu_.cpuNumber+" "+d.name+":",a.counter=d,this.addTrack_(a)}this.addControlButtonElements_(!1)}};
return{TimelineCpuTrack:e}});"use strict";base.requireStylesheet("tracks.timeline_counter_track");base.require("tracks.timeline_canvas_based_track");base.require("timeline_color_scheme");base.require("ui");
base.exportTo("tracks",function(){var e=tracing.getColorPalette(),d=base.ui.define(tracks.TimelineCanvasBasedTrack);d.prototype={__proto__:tracks.TimelineCanvasBasedTrack.prototype,decorate:function(){this.classList.add("timeline-counter-track");this.addControlButtonElements_(!1);this.selectedSamples_={};this.categoryFilter_=new tracing.TimelineFilter},decorateHit:function(){},get counter(){return this.counter_},set counter(a){this.counter_=a;this.invalidate();this.updateVisibility_()},set categoryFilter(a){this.categoryFilter_=
a;this.updateVisibility_()},get selectedSamples(){return this.selectedSamples_},updateVisibility_:function(){this.visible=this.counter_&&this.categoryFilter_.matchCounter(this.counter_)},redraw:function(){var a=this.counter_,b=this.ctx_,c=this.canvas_.width,f=this.canvas_.height;b.clearRect(0,0,c,f);var d=this.viewport_,l=d.xViewVectorToWorld(1),h=d.xViewToWorld(0),c=d.xViewToWorld(c);d.drawUnderContent(b,h,c,f);var j=d.xViewVectorToWorld(1);b.save();d.applyTransformToCanvas(b);for(var k=a.numSeries,
p=a.numSamples,m=tracing.findLowIndexInSortedArray(a.timestamps,function(a){return a},h),m=0<m-1?m-1:0,o=f/a.maxTotal,r=a.numSeries-1;0<=r;r--){b.fillStyle=e[a.seriesColors[r]];b.beginPath();for(var s=m-1,t=0<=s?a.timestamps[s]-j:-1,q=f,v=!1;;){var w=s+1;if(w>=p){b.lineTo(t,q);b.lineTo(t+8*l,q);b.lineTo(t+8*l,f);break}var u=a.timestamps[w],s=a.totals[w*k+r],x=f-o*s;if(u>c){b.lineTo(u,q);b.lineTo(u,f);break}u-t<j?s=w:(v||(b.moveTo(h,f),v=!0),b.lineTo(u,q),b.lineTo(u,x),s=w,t=u,q=x)}b.closePath();b.fill()}b.fillStyle=
"rgba(255, 0, 0, 1)";for(w in this.selectedSamples_)if(this.selectedSamples_[w]){u=a.timestamps[w];for(r=a.numSeries-1;0<=r;r--)s=a.totals[w*k+r],x=f-o*s,b.fillRect(u-l,x-1,3*l,3)}b.restore();d.drawOverContent(b,h,c,f)},addIntersectingItemsToSelection:function(a,b,c){var f=this.getBoundingClientRect();if(b<f.top||b>=f.bottom)return!1;b=this.viewport_.xViewVectorToWorld(a*devicePixelRatio);f=this.counter_;if(a<this.counter_.timestamps[0])return!1;a=tracing.findLowIndexInSortedArray(f.timestamps,function(a){return a},
b);if(0>a||a>=f.timestamps.length)return!1;0<a&&b>this.counter_.timestamps[a-1]&&a--;this.getBoundingClientRect();c=c.addCounterSample(this,this.counter,a);this.decorateHit(c);return!0},addIntersectingItemsInRangeToSelection:function(a,b,c,f,d){var e=this.getBoundingClientRect(),c=Math.max(c,e.top),f=Math.min(f,e.bottom);if(!(c>f)){f=this.counter_;e=window.devicePixelRatio||1;a=this.viewport_.xViewToWorld(a*e);e=this.viewport_.xViewToWorld(b*e);c=tracing.findLowIndexInSortedArray(f.timestamps,function(a){return a},
a);b=tracing.findLowIndexInSortedArray(f.timestamps,function(a){return a},e);0<c&&a>f.timestamps[c-1]&&c--;0<b&&e>f.timestamps[b-1]&&b--;for(a=c;a<=b;a++)a>=f.timestamps.length||(e=d.addCounterSample(this,this.counter,a),this.decorateHit(e))}},addAllObjectsMatchingFilterToSelection:function(){}};return{TimelineCounterTrack:d}});"use strict";base.require("tracks.timeline_container_track");base.require("sorted_array_utils");base.require("ui");
base.exportTo("tracks",function(){var e=base.ui.define(tracks.TimelineContainerTrack);e.prototype={__proto__:tracks.TimelineContainerTrack.prototype,decorate:function(){this.classList.add("timeline-slice-group-track")},get group(){return this.group_},set group(d){this.group_=d;this.updateChildTracks_()},set heading(d){this.tracks_.length&&(this.tracks_[0].heading=d)},set tooltip(d){this.tracks_.length&&(this.tracks_[0].tooltip=d)},set decorateHit(d){this.decorateHit_=d;this.updateChildTracks_()},
applyCategoryFilter_:function(){this.updateChildTracks_()},addSliceTrack_:function(d){var a=new tracks.TimelineSliceTrack;a.slices=d;a.decorateHit=this.decorateHit_;this.addTrack_(a);return a},updateChildTracks_:function(){if(this.group_){var d=tracing.filterSliceArray(this.categoryFilter,this.group_.slices);if(d.length){if(this.visible=!0,!this.areArrayContentsSame_(this.filteredSlices_,d)){this.filteredSlices_=d;this.detach();this.subRows_=this.buildSubRows_(d);for(d=0;d<this.subRows_.length;d++)this.subRows_[d].length&&
this.addSliceTrack_(this.subRows_[d])}}else this.visible=!1}else this.visible=!1},buildSubRows_:function(d){if(!d.length)return[];for(var a=[],b=0;b<d.length;b++)d[b].subSlices&&d[b].subSlices.splice(0,d[b].subSlices.length),a.push(b);a.sort(function(a,b){var c=d[a],f=d[b];return c.start!=f.start?c.start-f.start:a-b});var c=[[]];this.badSlices_=[];for(b=0;b<a.length;b++){for(var f=d[a[b]],g=!1,e=c.length-1;0<=e;e--)if(0!=c[e].length){var h=c[e][c[e].length-1];f.start<h.start&&(this.badSlices_.push(f),
g=!0);if(f.start>=h.start&&f.end<=h.end){for(;c.length<=e+1;)c.push([]);c[e+1].push(f);h.subSlices&&h.subSlices.push(f);g=!0;break}}g||c[0].push(f)}return c},areArrayContentsSame_:function(d,a){if(!d||!a||(!d.length||!a.length)||d.length!=a.length)return!1;for(var b=0;b<d.length;++b)if(d[b]!=a[b])return!1;return!0}};return{TimelineSliceGroupTrack:e}});"use strict";base.require("tracks.timeline_slice_group_track");base.require("ui");
base.exportTo("tracks",function(){var e=base.ui.define(tracks.TimelineSliceGroupTrack);e.prototype={__proto__:tracks.TimelineSliceGroupTrack.prototype,decorate:function(){this.classList.add("timeline-async-slice-group-track")},addSliceTrack_:function(d){d=tracks.TimelineSliceGroupTrack.prototype.addSliceTrack_.call(this,d);d.asyncStyle=!0;return d},buildSubRows_:function(){var d=tracing.filterSliceArray(this.categoryFilter,this.group_.slices);d.sort(function(a,b){return a.start-b.start});for(var a=
[],b=0;b<d.length;b++){for(var c=d[b],f=!1,g=0;g<a.length;g++){var e=a[g];if(c.start>=e[e.length-1].end){f=!0;if(void 0===c.subSlices||1>c.subSlices.length)throw Error("TimelineAsyncEvent missing subSlices: ")+c.name;for(g=0;g<c.subSlices.length;g++)e.push(c.subSlices[g]);break}}if(!f&&(e=[],void 0!==c.subSlices)){for(g=0;g<c.subSlices.length;g++)e.push(c.subSlices[g]);a.push(e)}}return a}};return{TimelineAsyncSliceGroupTrack:e}});"use strict";base.requireStylesheet("tracks.timeline_thread_track");
base.require("tracks.timeline_container_track");base.require("tracks.timeline_slice_track");base.require("tracks.timeline_slice_group_track");base.require("tracks.timeline_async_slice_group_track");base.require("timeline_filter");base.require("ui");
base.exportTo("tracks",function(){var e=base.ui.define(tracks.TimelineContainerTrack);e.prototype={__proto__:tracks.TimelineContainerTrack.prototype,decorate:function(){this.classList.add("timeline-thread-track");this.categoryFilter_=new tracing.TimelineFilter},get thread(){return this.thread_},set thread(d){this.thread_=d;this.updateChildTracks_()},get tooltip(){return this.tooltip_},set tooltip(d){this.tooltip_=d;this.updateChildTracks_()},get heading(){return this.heading_},set heading(d){this.heading_=
d;this.updateChildTracks_()},applyCategoryFilter_:function(){this.updateVisibility_()},updateChildTracks_:function(){this.detach();if(this.thread_){var d=new tracks.TimelineSliceTrack;d.heading="";d.slices=this.thread_.cpuSlices;d.height="4px";d.decorateHit=function(a){a.thread=this.thread_};this.addTrack_(d);d=new tracks.TimelineAsyncSliceGroupTrack;d.categoryFilter=this.categoryFilter;d.decorateHit=function(){};d.group=this.thread_.asyncSlices;this.addTrack_(d);d=new tracks.TimelineSliceGroupTrack;
d.decorateHit=function(a){a.thread=this.thread_};d.group=this.thread_;this.addTrack_(d);this.updateVisibility_()}this.addControlButtonElements_(4<=this.tracks_.length)},updateVisibility_:function(){if(this.categoryFilter.matchThread(this.thread)){for(var d=!1,a=0;a<this.tracks_.length;++a){var b=this.tracks_[a];if(b.visible&&(d=!0,1<=a)){b.heading=this.heading_;b.tooltip=this.tooltip_;break}}this.visible=d}else this.visible=!1},collapsedDidChange:function(d){if(d)for(var d=parseInt(this.tracks_[0].height),
a=0;a<this.tracks_.length;++a)2<d?this.tracks_[a].height=Math.floor(d)+"px":this.tracks_[a].style.display="none",d*=0.5;else for(a=0;a<this.tracks_.length;++a)this.tracks_[a].height=this.tracks_[0].height,this.tracks_[a].style.display=""}};return{TimelineThreadTrack:e}});"use strict";base.require("tracks.timeline_container_track");base.require("tracks.timeline_counter_track");base.require("tracks.timeline_thread_track");base.require("timeline_filter");base.require("ui");
base.exportTo("tracks",function(){var e=base.ui.define(tracks.TimelineContainerTrack);e.prototype={__proto__:tracks.TimelineContainerTrack.prototype,decorate:function(){this.classList.add("timeline-process-track");this.categoryFilter_=new tracing.TimelineFilter},get process(){return this.process_},set process(d){this.process_=d;this.updateChildTracks_()},applyCategoryFilter_:function(){this.visible=this.categoryFilter.matchProcess(this.process)&&!!this.numVisibleChildTracks},updateChildTracks_:function(){this.detach();
if(this.process_){var d=[],a;for(a in this.process.counters)d.push(this.process.counters[a]);d.sort(tracing.TimelineCounter.compare);d.forEach(function(a){var c=new tracks.TimelineCounterTrack;c.heading=a.name+":";c.counter=a;this.addTrack_(c)}.bind(this));d=[];for(a in this.process.threads)d.push(this.process.threads[a]);d.sort(tracing.TimelineThread.compare);d.forEach(function(a){var c=new tracks.TimelineThreadTrack;c.heading=a.userFriendlyName+":";c.tooltip=a.userFriendlyDetails;c.thread=a;this.addTrack_(c)}.bind(this))}}};
return{TimelineProcessTrack:e}});"use strict";base.requireStylesheet("tracks.timeline_model_track");base.require("tracks.timeline_container_track");base.require("tracks.timeline_cpu_track");base.require("tracks.timeline_process_track");base.require("ui");
base.exportTo("tracks",function(){var e=base.ui.define(tracks.TimelineContainerTrack);e.prototype={__proto__:tracks.TimelineContainerTrack.prototype,decorate:function(){this.classList.add("timeline-model-track");this.measuringStick_=new tracing.MeasuringStick;this.measuringStick_.attach()},detach:function(){tracks.TimelineContainerTrack.prototype.detach.call(this);this.measuringStick_.detach()},get model(){return this.model_},set model(d){this.model_=d;this.updateHeadingWidth_();this.updateChildTracks_()},
updateHeadingWidth_:function(){var d=[];this.model.getAllThreads().forEach(function(a){d.push(a.userFriendlyName)});this.model.getAllCounters().forEach(function(a){d.push(a.name)});this.model.getAllCpus().forEach(function(a){d.push("CPU "+a.cpuNumber)});var a=0,b=document.createElement("div");b.style.position="fixed";b.className="timeline-canvas-based-track-title";for(var c=0;c<d.length;c++){b.textContent=d[c]+":__";var f=this.measuringStick_.measure(b).width;300<f&&(f=300);f>a&&(a=f)}this.headingWidth=
a+"px"},updateChildTracks_:function(){this.detachAllChildren();if(this.model_){var d=this.model_.getAllCpus();d.sort(tracing.TimelineCpu.compare);for(var a=0;a<d.length;++a){var b=d[a],c=new tracks.TimelineCpuTrack;c.heading="CPU "+b.cpuNumber+":";c.cpu=b;this.addTrack_(c)}d=this.model_.getAllProcesses();d.sort(tracing.TimelineProcess.compare);for(a=0;a<d.length;++a)b=d[a],c=new tracks.TimelineProcessTrack,c.process=b,this.addTrack_(c)}}};return{TimelineModelTrack:e}});"use strict";base.requireStylesheet("tracks.timeline_viewport_track");
base.require("tracks.timeline_track");base.require("tracks.timeline_canvas_based_track");base.require("ui");
base.exportTo("tracks",function(){var e=base.ui.define(tracks.TimelineCanvasBasedTrack),d=Math.log(10);e.prototype={__proto__:tracks.TimelineCanvasBasedTrack.prototype,decorate:function(){this.classList.add("timeline-viewport-track");this.strings_secs_=[];this.strings_msecs_=[];this.addEventListener("mousedown",this.onMouseDown)},onMouseDown:function(a){0==a.button&&this.placeAndBeginDraggingMarker(a.clientX)},placeAndBeginDraggingMarker:function(a){var a=this.viewport_.xViewToWorld(a-this.canvasContainer_.offsetLeft),
b=this.viewport_.findMarkerNear(a,6),c=!1,f=!1;b||(b=this.viewport_.addMarker(a),c=!0);b.selected=!0;var d=this,e=function(a){a=d.viewport_.xViewToWorld(a.clientX-d.canvasContainer_.offsetLeft);b.positionWorld=a;f=true},h=function(){b.selected=false;!f&&!c&&d.viewport_.removeMarker(b);document.removeEventListener("mouseup",h);document.removeEventListener("mousemove",e)};document.addEventListener("mouseup",h);document.addEventListener("mousemove",e)},drawLine_:function(a,b,c,f,d,e){a.beginPath();a.moveTo(b,
c);a.lineTo(f,d);a.closePath();a.strokeStyle=e;a.stroke()},drawArrow_:function(a,b,c,f,d,e,h){this.drawLine_(a,b,c,f,d,h);var j=f-b,k=d-c,p=Math.sqrt(j*j+k*k),m=(p-10)/p,b=b+m*j,c=c+m*k,k=k/p*e,e=-(j/p)*e;a.beginPath();a.fillStyle=h;a.moveTo(b+k,c+e);a.lineTo(f,d);a.lineTo(b-k,c-e);a.lineTo(b+k,c+e);a.closePath();a.fill()},redraw:function(){var a=this.ctx_,b=this.canvas_.width,c=this.canvas_.height;a.clearRect(0,0,b,c);var f=this.viewport_;f.xViewVectorToWorld(1);for(var g=f.xViewToWorld(0),e=f.xViewToWorld(b),
h=this.classList.contains("timeline-viewport-track-with-distance-measurements"),j=h?c/2:c,k=0;k<f.markers.length;++k)f.markers[k].drawTriangle_(a,g,e,c,j,f);var k=f.xViewVectorToWorld(150),p,m,o,r;m=Math.pow(10,Math.ceil(Math.log(k)/d));o=[10,5,2,1];for(k=0;k<o.length;++k)if(!(150>f.xWorldVectorToView(m/o[k]))){p=m/o[k-1];break}r=void 0;100>p?(m="ms",o=1,r=this.strings_msecs_):(m="s",o=1E3,r=this.strings_secs_);var s=f.xWorldVectorToView(p/5),k=Math.floor(g/p)*p,c=Math.floor(0.25*c);a.fillStyle="rgb(0, 0, 0)";
a.strokeStyle="rgb(0, 0, 0)";a.textAlign="left";a.textBaseline="top";g=window.devicePixelRatio||1;a.font=9*g+"px sans-serif";for(var t=k;t<e;t+=p){var q=Math.floor(f.xWorldToView(t)),k=Math.floor(1E5*(t/o))/1E5;r[k]||(r[k]=k+" "+m);a.fillText(r[k],q+2*g,0);a.beginPath();a.moveTo(q,0);a.lineTo(q,j);for(k=1;5>k;++k){var v=Math.floor(q+s*k);a.moveTo(v,j-c);a.lineTo(v,j)}a.stroke()}if(h){a.moveTo(0,j);a.lineTo(b,j);a.stroke();b=f.markers.slice();b.sort(function(a,b){return a.positionWorld_-b.positionWorld_});
j+=2;e=j+4;for(k=0;k<b.length-1;k++)if(r=b[k+1],s=b[k],c=r.positionWorld-s.positionWorld,p=f.xWorldVectorToView(c),h=f.xWorldToView(s.positionWorld+c/2),100>c?(m="ms",o=1):(m="s",o=1E3),o=c/o,m=Math.abs(Math.floor(1E3*o)/1E3)+" "+m,o=a.measureText(m).width,g=f.xViewVectorToWorld(o),o=o+26+10,t=s.positionWorld+c/2-g/2,q=t+g,c=j,g=f.xWorldToView(t),t=f.xWorldToView(q),s=f.xWorldToView(s.positionWorld),r=f.xWorldToView(r.positionWorld),q=!1,o<=p&&(a.fillStyle="rgb(0,0,0)",a.fillText(m,g,c),q=!0),26<=
p)q?(m=g-10,o=t+10):o=m=h,this.drawArrow_(a,m,e,s,e,3,"rgb(128,121,121)"),this.drawArrow_(a,o,e,r,e,3,"rgb(128,121,121)")}},addIntersectingItemsToSelection:function(){},addIntersectingItemsInRangeToSelection:function(){},addAllObjectsMatchingFilterToSelection:function(){}};return{TimelineViewportTrack:e}});"use strict";base.requireStylesheet("timeline");base.require("event_target");base.require("measuring_stick");base.require("timeline_filter");base.require("timeline_selection");base.require("timeline_viewport");
base.require("tracks.timeline_model_track");base.require("tracks.timeline_viewport_track");base.require("ui");
base.exportTo("tracing",function(){var e=tracing.TimelineSelection,d=tracing.TimelineViewport,a=base.ui.define("div");a.prototype={__proto__:HTMLDivElement.prototype,model_:null,decorate:function(){this.classList.add("timeline");this.categoryFilter_=new tracing.TimelineCategoryFilter;this.viewport_=new d(this);this.viewportTrack_=new tracks.TimelineViewportTrack;this.viewportTrack_.viewport=this.viewport_;this.appendChild(this.viewportTrack_);this.modelTrackContainer_=document.createElement("div");
this.modelTrackContainer_.className="timeline-model-track-container";this.appendChild(this.modelTrackContainer_);this.modelTrack_=new tracks.TimelineModelTrack;this.modelTrackContainer_.appendChild(this.modelTrack_);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,
"keyup",this.onKeyup_,this);this.bindEventListener_(document,"mousemove",this.onMouseMove_,this);this.bindEventListener_(document,"mouseup",this.onMouseUp_,this);this.addEventListener("mousewheel",this.onMouseWheel_);this.addEventListener("mousedown",this.onMouseDown_);this.addEventListener("dblclick",this.onDblClick_);this.lastMouseViewPos_={x:0,y:0};this.maxHeadingWidth_=0;this.selection_=new e},bindEventListener_:function(a,c,f,d){this.boundListeners_||(this.boundListeners_=[]);f=f.bind(d);this.boundListeners_.push({object:a,
event:c,boundFunc:f});a.addEventListener(c,f)},detach:function(){this.modelTrack_.detach();for(var a=0;a<this.boundListeners_.length;a++){var c=this.boundListeners_[a];c.object.removeEventListener(c.event,c.boundFunc)}this.boundListeners_=void 0;this.viewport_.detach()},get viewport(){return this.viewport_},get categoryFilter(){return this.categoryFilter_},set categoryFilter(a){this.categoryFilter_=a;this.modelTrack_.categoryFilter=a},get model(){return this.model_},set model(a){if(!a)throw Error("Model cannot be null");
var c=this.model_!=a;this.model_=a;this.modelTrack_.model=a;this.modelTrack_.viewport=this.viewport_;this.modelTrack_.categoryFilter=this.categoryFilter;this.viewportTrack_.headingWidth=this.modelTrack_.headingWidth;c&&this.viewport_.setWhenPossible(this.setInitialViewport_.bind(this))},get numVisibleTracks(){return this.modelTrack_.numVisibleTracks},setInitialViewport_:function(){var a=0.15*(this.model_.maxTimestamp-this.model_.minTimestamp);this.viewport_.xSetWorldRange(this.model_.minTimestamp-
a,this.model_.maxTimestamp+a,this.firstCanvas.width)},addAllObjectsMatchingFilterToSelection:function(a,c){this.modelTrack_.addAllObjectsMatchingFilterToSelection(a,c)},get focusElement(){return this.focusElement_?this.focusElement_:this.parentElement},set focusElement(a){this.focusElement_=a},get listenToKeys_(){return!this.viewport_.isAttachedToDocument_||this.activeElement instanceof tracing.TimelineFindControl?!1:!this.focusElement_?!0:0<=this.focusElement.tabIndex?document.activeElement==this.focusElement:
!0},onKeypress_:function(a){var c=this.viewport_;if(this.firstCanvas&&this.listenToKeys_&&"INPUT"!=document.activeElement.nodeName){var f=this.firstCanvas.clientWidth;switch(a.keyCode){case 119:case 44:this.zoomBy_(1.5);break;case 115:case 111:this.zoomBy_(1/1.5);break;case 103:this.onGridToggle_(!0);break;case 71:this.onGridToggle_(!1);break;case 87:case 60:this.zoomBy_(10);break;case 83:case 79:this.zoomBy_(0.1);break;case 97:c.panX+=c.xViewVectorToWorld(0.1*f);break;case 100:case 101:c.panX-=c.xViewVectorToWorld(0.1*
f);break;case 65:c.panX+=c.xViewVectorToWorld(0.5*f);break;case 68:c.panX-=c.xViewVectorToWorld(0.5*f);break;case 48:case 122:this.setInitialViewport_();break;case 102:this.zoomToSelection_()}}},onMouseWheel_:function(a){if(a.altKey){var c=Math.pow(1.5,a.wheelDeltaY/120);this.zoomBy_(c);a.preventDefault()}},onKeydown_:function(a){if(this.listenToKeys_){var c,f=this.viewport_,d=this.firstCanvas.clientWidth;switch(a.keyCode){case 37:if(c=this.selection.getShiftedSelection(-1))this.setSelectionAndMakeVisible(c),
a.preventDefault();else{if(!this.firstCanvas)return;f.panX+=f.xViewVectorToWorld(0.1*d)}break;case 39:if(c=this.selection.getShiftedSelection(1))this.setSelectionAndMakeVisible(c),a.preventDefault();else{if(!this.firstCanvas)return;f.panX-=f.xViewVectorToWorld(0.1*d)}break;case 9:-1==this.focusElement.tabIndex&&(a.shiftKey?this.selectPrevious_(a):this.selectNext_(a),a.preventDefault())}a.shiftKey&&this.dragBeginEvent_&&(a=a.shiftKey,this.dragBeginEvent_&&this.setDragBoxPosition_(this.dragBoxXStart_,
this.dragBoxYStart_,this.dragBoxXEnd_,this.dragBoxYEnd_,a))}},onKeyup_:function(a){this.listenToKeys_&&(a.shiftKey||this.dragBeginEvent_&&this.setDragBoxPosition_(this.dragBoxXStart_,this.dragBoxYStart_,this.dragBoxXEnd_,this.dragBoxYEnd_,a.shiftKey))},zoomBy_:function(a){if(this.firstCanvas){var c=this.viewport_,f=this.firstCanvas.clientWidth,d=this.lastMouseViewPos_.x,e=c.xViewToWorld(d);c.scaleX*=a;c.xPanWorldPosToViewPos(e,d,f)}},zoomToSelection_:function(){if(this.selection){var a=this.selection.range,
c=a.min+0.5*(a.max-a.min),a=0.5*(a.max-a.min),f=0.15*a;this.viewport_.xSetWorldRange(c-a-f,c+a+f,this.firstCanvas.width)}},get keyHelp(){var a="Qwerty Controls\n w/s : Zoom in/out (with shift: go faster)\n a/d : Pan left/right\n\nDvorak Controls\n ,/o : Zoom in/out (with shift: go faster)\n a/e : Pan left/right\n\nMouse Controls\n drag : Select slices (with "+(0==navigator.platform.indexOf("Mac")?"cmd":"ctrl")+": zoom to slices)\n drag + shift : Select all slices vertically\n\n",
a=this.focusElement.tabIndex?a+" <- : Select previous event on current timeline\n -> : Select next event on current timeline\n":a+"General Navigation\n g/General : Shows grid at the start/end of the selected task\n <-,^TAB : Select previous event on current timeline\n ->, TAB : Select next event on current timeline\n";return a+"\nAlt + Scroll to zoom in/out\nDbl-click to zoom in; Shift dbl-click to zoom out\nf to zoom into selection\nz to reset zoom and pan to initial view\n"},
get selection(){return this.selection_},set selection(a){if(!(a instanceof e))throw Error("Expected TimelineSelection");var c;for(c=0;c<this.selection_.length;c++)this.selection_[c].selected=!1;this.selection_=a;base.dispatchSimpleEvent(this,"selectionChange");for(c=0;c<this.selection_.length;c++)this.selection_[c].selected=!0;this.viewport_.dispatchChangeEvent()},setSelectionAndMakeVisible:function(a,c){if(!(a instanceof e))throw Error("Expected TimelineSelection");this.selection=a;var f=this.selection.range,
d=this.viewport_.xWorldVectorToView(f.max-f.min);c&&50>d?(d=f.min+0.5*(f.max-f.min),f=5*(f.max-f.min),this.viewport_.xSetWorldRange(d-0.5*f,d+0.5*f,this.firstCanvas.width)):this.viewport_.xPanWorldRangeIntoView(f.min,f.max,this.firstCanvas.width)},get firstCanvas(){if(this.viewportTrack_)return this.viewportTrack_.firstCanvas;if(this.modelTrack_)return this.modelTrack_.firstCanvas},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,c,f,d,e){var h=Math.min(a,f),a=Math.max(a,f),f=this.modelTrack_.getBoundingClientRect();e?(e=f.top,f=f.bottom):(e=Math.min(c,d),f=Math.max(c,d));var c=e,d=h+(a-h),e=c+(f-e),j=this.modelTrackContainer_.getBoundingClientRect(),f=j.left,k=j.top,p=j.right,j=j.bottom,m=parseInt(this.modelTrack_.headingWidth),f=f+m;m={};h>p||d<f||c>j||e<k?c=!1:(m.left=Math.max(f,h),m.top=Math.max(k,c),m.right=Math.min(p,d),m.bottom=Math.min(j,e),m.width=m.right-
m.left,m.height=m.bottom-m.top,c=m);this.dragBox_.style.left=c.left+"px";this.dragBox_.style.width=c.width+"px";this.dragBox_.style.top=c.top+"px";this.dragBox_.style.height=c.height+"px";c=this.firstCanvas;h=this.viewport_.xViewToWorld(h-c.offsetLeft);a=this.viewport_.xViewToWorld(a-c.offsetLeft);c=Math.round(100*(a-h))/100;this.dragBox_.textContent=c+"ms";c=new base.Event("selectionChanging");c.loWX=h;c.hiWX=a;this.dispatchEvent(c)},onGridToggle_:function(a){var a=a?this.selection_.range.min:this.selection_.range.max,
c=Math.ceil((a-this.model_.minTimestamp)/this.viewport_.gridStep_);this.viewport_.gridTimebase=a-(c+1)*this.viewport_.gridStep_;this.viewport_.gridEnabled=!0},isChildOfThis_:function(a){if(a!=this){for(;a.parentNode;){if(a==this)return!0;a=a.parentNode}return!1}},onMouseDown_:function(a){if(0===a.button)if(a.shiftKey)this.viewportTrack_.placeAndBeginDraggingMarker(a.clientX);else{var c=this.firstCanvas,f=this.modelTrack_.getBoundingClientRect(),d=this.firstCanvas.getBoundingClientRect();f&&(a.clientX>=
f.left&&a.clientX<f.right&&a.clientY>=f.top&&a.clientY<f.bottom&&a.clientX>=d.left&&a.clientX<d.right)&&(this.viewport_.xViewToWorld(a.clientX-c.offsetLeft),this.dragBeginEvent_=a,a.preventDefault(),document.activeElement&&document.activeElement.blur(),0<=this.focusElement.tabIndex&&this.focusElement.focus())}},onMouseMove_:function(a){if(this.firstCanvas){var c=this.firstCanvas;this.lastMouseViewPos_={x:a.clientX-c.offsetLeft,y:a.clientY-c.offsetTop};this.dragBeginEvent_&&(this.dragBoxXStart_=this.dragBeginEvent_.clientX,
this.dragBoxXEnd_=a.clientX,this.dragBoxYStart_=this.dragBeginEvent_.clientY,this.dragBoxYEnd_=a.clientY,this.setDragBoxPosition_(this.dragBoxXStart_,this.dragBoxYStart_,this.dragBoxXEnd_,this.dragBoxYEnd_,a.shiftKey))}},onMouseUp_:function(a){if(this.dragBeginEvent_){this.hideDragBox_();var c=this.dragBeginEvent_;this.dragBeginEvent_=null;var f,d=Math.min(c.clientX,a.clientX),l=Math.max(c.clientX,a.clientX);this.modelTrackContainer_.getBoundingClientRect();a.shiftKey?(c=this.modelTrack_.getBoundingClientRect(),
f=c.top,c=c.bottom):(f=Math.min(c.clientY,a.clientY),c=Math.max(c.clientY,a.clientY));var h=this.firstCanvas,d=d-h.offsetLeft,l=l-h.offsetLeft,h=new e;this.modelTrack_.addIntersectingItemsInRangeToSelection(d,l,f,c,h);this.selection=h;((f=0==navigator.platform.indexOf("Mac"))&&a.metaKey||!f&&a.ctrlKey)&&this.zoomToSelection_()}},onDblClick_:function(a){var c=4;a.shiftKey&&(c=1/c);this.zoomBy_(c);a.preventDefault()}};base.defineProperty(a,"model",base.PropertyKind.JS);return{Timeline:a}});"use strict";
base.require("ui");base.requireStylesheet("timeline_analysis");
base.exportTo("tracing",function(){function e(a,c){var f=c.getSliceHits(),d=c.getCounterSampleHits();if(1==f.length){var e=f[0].slice,h=a.appendTable("timeline-analysis-slice-table",2);a.appendTableHeader(h,"Selected slice:");a.appendSummaryRow(h,"Title",e.title);e.category&&a.appendSummaryRow(h,"Category",e.category);a.appendSummaryRowTime(h,"Start",e.start);a.appendSummaryRowTime(h,"Duration",e.duration);e.durationInUserTime&&a.appendSummaryRowTime(h,"Duration (U)",e.durationInUserTime);var f=0,
j;for(j in e.args)f+=1;if(0<f)for(j in a.appendSummaryRow(h,"Args"),e.args)a.appendSummaryRow(h," "+j,e.args[j])}else if(1<f.length){var k=f.range.min,p=f.range.max;f.map(function(a){return a.slice.title});var h=0,m={};for(j=0;j<f.length;j++)e=f[j].slice,m[e.title]||(m[e.title]={slices:[]},h++),m[e.title].slices.push(e);h=a.appendTable("timeline-analysis-slices-table",3);a.appendTableHeader(h,"Slices:");var e=0,o;for(o in m){var r=m[o],s=0;j=0;var t=Number.MAX_VALUE,q=-Number.MAX_VALUE,v=Number.MAX_VALUE,
w=-Number.MAX_VALUE;for(j=0;j<r.slices.length;j++)s+=r.slices[j].duration,t=Math.min(r.slices[j].start,t),q=Math.max(r.slices[j].start,q),v=Math.min(r.slices[j].duration,v),w=Math.max(r.slices[j].duration,w);e+=s;0==r.slices.length&&(j=0);j=s/r.slices.length;v={min:v,max:w,avg:j,frequency:void 0,frequency_stddev:void 0};j=q-t;if(2<r.slices.length&&0<j){t=r.slices.length-1;v.frequency=1E3*t/j;q=0;for(j=1;j<r.slices.length;j++)w=v.frequency-1E3/(r.slices[j].start-r.slices[j-1].start),q+=w*w;v.frequency_stddev=
Math.sqrt(q/(t-1))}a.appendDataRow(h,o,s,r.slices.length,v)}a.appendDataRow(h,"*Totals",e,f.length);a.appendSpacingRow(h);a.appendSummaryRowTime(h,"Selection start",k);a.appendSummaryRowTime(h,"Selection extent",p-k)}if(1==d.length){var h=d[0],f=h.counter,u=h.sampleIndex,d=[];for(j=0;j<f.numSeries;++j)d.push(f.samples[f.numSeries*u+j]);h=a.appendTable("timeline-analysis-counter-table",2);a.appendTableHeader(h,"Selected counter:");a.appendSummaryRow(h,"Title",f.name);a.appendSummaryRowTime(h,"Timestamp",
f.timestamps[u]);for(j=0;j<f.numSeries;j++)a.appendSummaryRow(h,f.seriesNames[j],d[j])}else if(1<d.length){o={};for(j=0;j<d.length;j++)f=d[j].counter,o[f.guid]||(o[f.guid]=[]),o[f.guid].push(d[j]);h=a.appendTable("timeline-analysis-counter-table",7);a.appendTableHeader(h,"Counters:");for(u in o){d=o[u];f=d[0].counter;k=[];for(j=0;j<d.length;j++)k.push(d[j].sampleIndex);d=f.getSampleStatistics(k);for(j=0;j<d.length;j++)a.appendDataRow(h,f.name+": "+f.seriesNames[j],void 0,void 0,d[j])}}}var d=base.ui.define("div");
d.prototype={__proto__:HTMLDivElement.prototype,decorate:function(){},tsRound_:function(a){return Math.round(1E3*a)/1E3},appendElement_:function(a,c,f){c=a.ownerDocument.createElement(c);a.appendChild(c);void 0!=f&&(c.textContent=f);return c},appendText_:function(a,c){a.ownerDocument.createTextNode(c);a.appendChild(textNode);return textNode},appendTableCell_:function(a,c,f,d){c=this.appendElement_(c,"td",d);c.className=a.className+"-col-"+f;return c},appendTableCellWithTooltip_:function(a,c,f,d,e){if(e)return c=
this.appendElement_(c,"td"),c.className=a.className+"-col-"+f,a=this.appendElement_(c,"span",d),a.className="tooltip",a.title=e,c;this.appendTableCell_(a,c,f,d)},appendTable:function(a,c){var f=this.appendElement_(this,"table");f.className=a+" timeline-analysis-table";f.numColumns=c;return f},appendTableHeader:function(a,c){var f=this.appendElement_(a,"tr");this.appendElement_(f,"th",c).className="timeline-analysis-table-header"},appendSummaryRow:function(a,c,f){var d=this.appendElement_(a,"tr");
d.className="timeline-analysis-table-row";this.appendTableCell_(a,d,0,c);if(void 0!==f){this.appendTableCell_(a,d,1,f);for(c=2;c<a.numColumns;c++)this.appendTableCell_(a,d,c,"")}else for(c=1;c<a.numColumns;c++)this.appendTableCell_(a,d,1,"")},appendSpacingRow:function(a){var c=this.appendElement_(a,"tr");c.className="timeline-analysis-table-row";for(var f=0;f<a.numColumns;f++)this.appendTableCell_(a,c,f," ")},appendSummaryRowTime:function(a,c,f){this.appendSummaryRow(a,c,this.tsRound_(f)+" ms")},
appendDataRow:function(a,c,f,d,e){var h=void 0;e&&(h="Min Duration:\t"+this.tsRound_(e.min)+" ms \rMax Duration:\t"+this.tsRound_(e.max)+" ms \rAvg Duration:\t"+this.tsRound_(e.avg)+" ms",e.start&&(h+="\rStart Time:\t"+this.tsRound_(e.start)+" ms"),e.end&&(h+="\rEnd Time:\t"+this.tsRound_(e.end)+" ms"),e.frequency&&e.frequency_stddev&&(h+="\rFrequency:\t"+this.tsRound_(e.frequency)+" occurrences/s (\u03c3 = "+this.tsRound_(e.frequency_stddev)+")"));e=this.appendElement_(a,"tr");e.className="timeline-analysis-table-row";
this.appendTableCellWithTooltip_(a,e,0,c,h);void 0!==f?this.appendTableCellWithTooltip_(a,e,1,this.tsRound_(f)+" ms",h):this.appendTableCell_(a,e,1,"");void 0!==d?this.appendTableCellWithTooltip_(a,e,2,String(d)+" occurrences",h):this.appendTableCell_(a,e,2,"")}};var a=base.ui.define("div");a.prototype={__proto__:HTMLDivElement.prototype,decorate:function(){this.className="timeline-analysis"},set selection(a){this.textContent="";var c=new d;e(c,a);this.appendChild(c)}};return{TimelineAnalysisView:a,
analyzeSelection_:e}});base.requireStylesheet("overlay");base.require("ui");base.require("event_target");
base.exportTo("tracing",function(){var e=base.ui.define("div");e.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(a){a.oldParent_=a.parentNode;this.contentHost.appendChild(a);this.contentHost.appendChild(this.tabCatcher);this.ownerDocument.body.classList.add("disabled-by-overlay");this.visible=!0;a.tabIndex=0;var b=a.querySelector("button, input, list, select, a");b||(b=a);b.focus();this.ownerDocument.addEventListener("focusin",this.onFocusInBoundToThis_,!0);a.addEventListener("keydown",this.onKeydownBoundToThis_)},onMousedown_:function(a){a.target==
this&&a.preventDefault()},onFocusIn_:function(a){a.target==this.tabCatcher&&window.setTimeout(this.focusOverlay_.bind(this),0)},focusOverlay_:function(){this.contentHost.firstChild.focus()},onKeydown_:function(a){9==a.keyCode&&(a.shiftKey&&a.target==this.contentHost.firstChild)&&a.preventDefault()},hideOverlay:function(a){this.visible=!1;this.ownerDocument.body.classList.remove("disabled-by-overlay");this.lastFocusOut_=void 0;a.parentNode.removeChild(this.tabCatcher);a.oldParent_?(a.oldParent_.appendChild(a),
delete a.oldParent_):this.contentHost.removeChild(a);a.removeEventListener("keydown",this.onKeydownBoundToThis_);this.ownerDocument.removeEventListener("focusin",this.onFocusInBoundToThis_)}};base.defineProperty(e,"visible",base.PropertyKind.BOOL_ATTR);var d=base.ui.define("div");d.prototype={__proto__:HTMLDivElement.prototype,decorate:function(){if(!this.ownerDocument.querySelector(".overlay-root")){var a=this.ownerDocument.createElement("div");base.ui.decorate(a,e);this.ownerDocument.body.appendChild(a)}this.classList.add("overlay");
this.visible=!1;this.defaultClickShouldClose=!0;this.autoClose=!1;this.additionalCloseKeyCodes=[];this.onKeyDown=this.onKeyDown.bind(this);this.onKeyPress=this.onKeyPress.bind(this);this.onDocumentClick=this.onDocumentClick.bind(this)},onVisibleChanged_:function(){var a=this.ownerDocument.querySelector(".overlay-root");base.dispatchSimpleEvent(this,"visibleChange");this.visible?(a.showOverlay(this),document.addEventListener("keydown",this.onKeyDown,!0),document.addEventListener("keypress",this.onKeyPress,
!0),document.addEventListener("click",this.onDocumentClick,!0)):(document.removeEventListener("keydown",this.onKeyDown,!0),document.removeEventListener("keypress",this.onKeyPress,!0),document.removeEventListener("click",this.onDocumentClick,!0),a.hideOverlay(this))},onKeyDown:function(a){this.autoClose&&27==a.keyCode&&(this.visible=!1,a.preventDefault())},onKeyPress:function(a){if(this.autoClose)for(var b=0;b<this.additionalCloseKeyCodes.length;b++)if(a.keyCode==this.additionalCloseKeyCodes[b]){this.visible=
!1;a.preventDefault();break}},onDocumentClick:function(a){if(this.defaultClickShouldClose){for(var b=a.target;null!==b;){if(b===this)return;b=b.parentNode}this.visible=!1;a.preventDefault()}}};base.defineProperty(d,"visible",base.PropertyKind.BOOL_ATTR,d.prototype.onVisibleChanged_);base.defineProperty(d,"defaultClickShouldClose",base.PropertyKind.BOOL_ATTR);return{Overlay:d}});"use strict";base.require("timeline_filter");base.require("overlay");
base.exportTo("tracing",function(){var e=base.ui.define("div");e.prototype={__proto__:tracing.Overlay.prototype,decorate:function(){tracing.Overlay.prototype.decorate.call(this);this.className="timeline-view-category-filter-overlay";this.autoClose=!0;var d=document.createElement("div");d.className="category-filter-dialog";d.textContent="Select active categories:";this.formEl_=document.createElement("form");this.formEl_.className="category-filter-dialog-form";d.appendChild(this.formEl_);this.appendChild(d);
this.addEventListener("visibleChange",this.onVisibleChange_.bind(this))},get model(){return this.model_},set model(d){this.model_=d},get settings(){return this.settings_},set settings(d){this.settings_=d},set settingUpdatedCallback(d){this.settingUpdatedCallback_=d},onVisibleChange_:function(){this.visible&&this.updateForm_()},updateForm_:function(){this.formEl_.innerHTML="";var d=this.model_.categories;d.concat(this.settings_.keys("categories"));for(var a=0;a<d.length;a++){var b=d[a],c=document.createElement("input");
c.type="checkbox";c.id=c.value=b;c.checked="true"==this.settings_.get(b,"true","categories");c.onchange=this.updateSetting_.bind(this);var f=document.createElement("label");f.textContent=b;f.setAttribute("for",b);this.formEl_.appendChild(c);this.formEl_.appendChild(f);this.formEl_.appendChild(document.createElement("br"))}},updateSetting_:function(d){d=d.target;this.settings_.set(d.value,d.checked,"categories");this.settingUpdatedCallback_()}};return{TimelineCategoryFilterDialog:e}});"use strict";
base.require("timeline");base.require("timeline_filter");base.require("overlay");
base.exportTo("tracing",function(){function e(){this.model_=this.timeline_=void 0;this.filterText_="";this.filterHits_=new tracing.TimelineSelection;this.filterHitsDirty_=!0;this.currentHitIndex_=0}var d=base.ui.define("div");d.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 a=document.createElement("div");a.className="timeline-button find-previous";a.textContent="\u2190";a.addEventListener("click",function(){this.controller.findPrevious();this.updateHitCountEl_()}.bind(this));var b=document.createElement("div");b.className="timeline-button find-next";b.textContent="\u2192";b.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?b.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(a);this.appendChild(b);
this.appendChild(this.hitCountEl_);this.updateHitCountEl_()},get controller(){return this.controller_},set controller(a){this.controller_=a;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 a=this.controller.currentHitIndex,b=this.controller.filterHits.length;this.hitCountEl_.textContent=
0==b?"0 of 0":a+1+" of "+b}}};e.prototype={__proto__:Object.prototype,get timeline(){return this.timeline_},set timeline(a){this.timeline_=a;this.filterHitsDirty_=!0},get filterText(){return this.filterText_},set filterText(a){a!=this.filterText_&&(this.filterText_=a,this.filterHitsDirty_=!0,this.findNext())},get filterHits(){if(this.filterHitsDirty_)if(this.filterHitsDirty_=!1,this.timeline_){var a=new tracing.TimelineTitleFilter(this.filterText);this.filterHits_.clear();this.timeline.addAllObjectsMatchingFilterToSelection(a,
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(a){if(this.timeline){var b=this.filterHits.length;this.currentHitIndex_+=a;0>this.currentHitIndex_&&(this.currentHitIndex_=b-1);this.currentHitIndex_>=b&&(this.currentHitIndex_=0);0>this.currentHitIndex_||this.currentHitIndex_>=b?this.timeline.selection=new tracing.TimelineSelection:(a=0==
this.currentHitIndex_,b=this.filterHits.subSelection(this.currentHitIndex_),this.timeline.setSelectionAndMakeVisible(b,a))}},findNext:function(){this.find_(1)},findPrevious:function(){this.find_(-1)}};return{TimelineFindControl:d,TimelineFindController:e}});base.require("timeline_model");base.require("timeline_color_scheme");
base.exportTo("tracing",function(){function e(d,a){this.importPriority=1;this.model_=d;"string"===typeof a||a instanceof String?("["==a[0]&&(n=a.length,"\n"==a[n-1]&&(a=a.substring(0,n-1),n--,"\r"==a[n-1]&&(a=a.substring(0,n-1),n--)),","==a[n-1]&&(a=a.substring(0,n-1)),"]"!=a[n-1]&&(a+="]")),this.events_=JSON.parse(a)):this.events_=a;if(this.events_.traceEvents)for(fieldName in this.events_=this.events_.traceEvents,this.events_)"traceEvents"!=fieldName&&this.model_.metadata.push({name:fieldName,value:this.events_[fieldName]});
this.allAsyncEvents_=[]}e.canImport=function(d){return"string"===typeof d||d instanceof String?"{"==d[0]||"["==d[0]:d instanceof Array&&d.length&&d[0].ph?!0:d.traceEvents?d.traceEvents instanceof Array&&d.traceEvents[0].ph:!1};e.prototype={__proto__:Object.prototype,processAsyncEvent:function(d,a){var b=this.model_.getOrCreateProcess(a.pid).getOrCreateThread(a.tid);this.allAsyncEvents_.push({event:a,thread:b})},processCounterEvent:function(d){var a;a=void 0!==d.id?d.name+"["+d.id+"]":d.name;a=this.model_.getOrCreateProcess(d.pid).getOrCreateCounter(d.cat,
a);if(0==a.numSeries){for(var b in d.args)a.seriesNames.push(b),a.seriesColors.push(tracing.getStringColorId(a.name+"."+b));if(0==a.numSeries){this.model_.importErrors.push("Expected counter "+d.name+" to have at least one argument to use as a value.");delete a.parent.counters[a.name];return}}a.timestamps.push(d.ts/1E3);for(var c=0;c<a.numSeries;c++)b=a.seriesNames[c],void 0===d.args[b]?a.samples.push(0):a.samples.push(d.args[b])},importEvents:function(){for(var d=this.events_,a=0;a<d.length;a++){var b=
d[a];if("B"==b.ph){var c=this.model_.getOrCreateProcess(b.pid).getOrCreateThread(b.tid);c.isTimestampValidForBeginOrEnd(b.ts/1E3)?c.beginSlice(b.cat,b.name,b.ts/1E3,b.args):this.model_.importErrors.push("Timestamps are moving backward.")}else if("E"==b.ph)if(c=this.model_.getOrCreateProcess(b.pid).getOrCreateThread(b.tid),c.isTimestampValidForBeginOrEnd(b.ts/1E3))if(c.openSliceCount){var c=c.endSlice(b.ts/1E3),f;for(f in b.args)void 0!==c.args[f]&&this.model_.importErrors.push("Both the B and E phases of "+
c.name+"provided values for argument "+f+". The value of the E phase event will be used."),c.args[f]=b.args[f]}else this.model_.importErrors.push("E phase event without a matching B phase event.");else this.model_.importErrors.push("Timestamps are moving backward.");else"S"==b.ph?this.processAsyncEvent(a,b):"F"==b.ph?this.processAsyncEvent(a,b):"T"==b.ph?this.processAsyncEvent(a,b):"I"==b.ph?(c=this.model_.getOrCreateProcess(b.pid).getOrCreateThread(b.tid),c.beginSlice(b.cat,b.name,b.ts/1E3,b.args),
c.endSlice(b.ts/1E3)):"C"==b.ph?this.processCounterEvent(b):"M"==b.ph?"thread_name"==b.name?(c=this.model_.getOrCreateProcess(b.pid).getOrCreateThread(b.tid),c.name=b.args.name):this.model_.importErrors.push("Unrecognized metadata name: "+b.name):this.model_.importErrors.push("Unrecognized event phase: "+b.ph+"("+b.name+")")}},finalizeImport:function(){this.createAsyncSlices_()},createAsyncSlices_:function(){if(0!=this.allAsyncEvents_.length){this.allAsyncEvents_.sort(function(a,b){return a.event.ts-
b.event.ts});for(var d={},a=this.allAsyncEvents_,b=0;b<a.length;b++){var c=a[b],f=c.event,e=f.name;if(void 0===e)this.model_.importErrors.push("Async events (ph: S, T or F) require an name parameter.");else{var l=f.id;if(void 0===l)this.model_.importErrors.push("Async events (ph: S, T or F) require an id parameter.");else if("S"==f.ph)void 0===d[e]&&(d[e]={}),d[e][l]?this.model_.importErrors.push("At "+f.ts+", a slice of the same id "+l+" was alrady open."):(d[e][l]=[],d[e][l].push(c));else if(void 0===
d[e])this.model_.importErrors.push("At "+f.ts+", no slice named "+e+" was open.");else if(void 0===d[e][l])this.model_.importErrors.push("At "+f.ts+", no slice named "+e+" with id="+l+" was open.");else{var h=d[e][l];h.push(c);if("F"==f.ph){var j=new tracing.TimelineAsyncSlice(h[0].event.cat,e,tracing.getStringColorId(e),h[0].event.ts/1E3);j.duration=f.ts/1E3-h[0].event.ts/1E3;j.startThread=h[0].thread;j.endThread=c.thread;j.id=l;j.args=h[0].event.args;j.subSlices=[];for(c=1;c<h.length;++c){var k=
e;"T"==h[c-1].event.ph&&(k=e+":"+h[c-1].event.args.step);k=new tracing.TimelineAsyncSlice(h[0].event.cat,k,tracing.getStringColorId(e+c),h[c-1].event.ts/1E3);k.duration=h[c].event.ts/1E3-h[c-1].event.ts/1E3;k.startThread=h[c-1].thread;k.endThread=h[c].thread;k.id=l;k.args=h[c-1].event.args;j.subSlices.push(k)}var h=j.subSlices[j.subSlices.length-1],p;for(p in f.args)h.args[p]=f.args[p];j.startThread.asyncSlices.push(j);delete d[e][l]}}}}}}};tracing.TimelineModel.registerImporter(e);return{TraceEventImporter:e}});
base.exportTo("tracing",function(){function e(a){this.importer=a}var d=[];e.registerSubtype=function(a){d.push(a)};e.getSubtypeConstructors=function(){return d};e.prototype={__proto__:Object.prototype};return{LinuxPerfParser:e}});base.require("linux_perf_parser");
base.exportTo("tracing",function(){function e(a){d.call(this,a);a.registerEventHandler("cpufreq_interactive_up",e.prototype.cpufreqUpDownEvent.bind(this));a.registerEventHandler("cpufreq_interactive_down",e.prototype.cpufreqUpDownEvent.bind(this));a.registerEventHandler("cpufreq_interactive_already",e.prototype.cpufreqTargetEvent.bind(this));a.registerEventHandler("cpufreq_interactive_notyet",e.prototype.cpufreqTargetEvent.bind(this));a.registerEventHandler("cpufreq_interactive_target",e.prototype.cpufreqTargetEvent.bind(this));
a.registerEventHandler("cpufreq_interactive_boost",e.prototype.cpufreqBoostUnboostEvent.bind(this));a.registerEventHandler("cpufreq_interactive_unboost",e.prototype.cpufreqBoostUnboostEvent.bind(this))}var d=tracing.LinuxPerfParser;e.prototype={__proto__:d.prototype,cpufreqSlice:function(a,b,c,f){c=this.importer.getOrCreatePseudoThread("cpufreq");c.openSlice=b;a=new tracing.TimelineSlice("",c.openSlice,tracing.getStringColorId(c.openSlice),a,f,0);c.thread.pushSlice(a)},cpufreqBoostSlice:function(a,
b,c){var f=this.importer.getOrCreatePseudoThread("cpufreq_boost");f.openSlice=b;a=new tracing.TimelineSlice("",f.openSlice,tracing.getStringColorId(f.openSlice),a,c,0);f.thread.pushSlice(a)},cpufreqUpDownEvent:function(a,b,c,f,d){d=/cpu=(\d+) targ=(\d+) actual=(\d+)/.exec(d[5]);if(!d)return!1;b=parseInt(d[1]);c=parseInt(d[2]);d=parseInt(d[3]);this.cpufreqSlice(f,a,b,{cpu:b,targ:c,actual:d});return!0},cpufreqTargetEvent:function(a,b,c,f,d){var e=/cpu=(\d+) load=(\d+) cur=(\d+) targ=(\d+)/.exec(d[5]);
if(!e)return!1;b=parseInt(e[1]);c=parseInt(e[2]);d=parseInt(e[3]);e=parseInt(e[4]);this.cpufreqSlice(f,a,b,{cpu:b,load:c,cur:d,targ:e});return!0},cpufreqBoostUnboostEvent:function(a,b,c,f,d){this.cpufreqBoostSlice(f,a,{type:d[5]});return!0}};d.registerSubtype(e);return{LinuxPerfCpufreqParser:e}});base.require("linux_perf_parser");
base.exportTo("tracing",function(){function e(a){d.call(this,a);a.registerEventHandler("drm_vblank_event",e.prototype.vblankEvent.bind(this))}var d=tracing.LinuxPerfParser;e.prototype={__proto__:d.prototype,drmVblankSlice:function(a,b,c){var f=this.importer.getOrCreatePseudoThread("drm_vblank");f.openSlice=b;a=new tracing.TimelineSlice("",f.openSlice,tracing.getStringColorId(f.openSlice),a,c,0);f.thread.pushSlice(a)},vblankEvent:function(a,b,c,f,d){b=/crtc=(\d+), seq=(\d+)/.exec(d[5]);if(!b)return!1;
a=parseInt(b[1]);b=parseInt(b[2]);this.drmVblankSlice(f,"vblank:"+a,{crtc:a,seq:b});return!0}};d.registerSubtype(e);return{LinuxPerfDrmParser:e}});base.require("linux_perf_parser");
base.exportTo("tracing",function(){function e(a){d.call(this,a);a.registerEventHandler("exynos_flip_request",e.prototype.flipEvent.bind(this));a.registerEventHandler("exynos_flip_complete",e.prototype.flipEvent.bind(this));a.registerEventHandler("exynos_busfreq_target_int",e.prototype.busfreqTargetIntEvent.bind(this));a.registerEventHandler("exynos_busfreq_target_mif",e.prototype.busfreqTargetMifEvent.bind(this))}var d=tracing.LinuxPerfParser;e.prototype={__proto__:d.prototype,exynosFlipOpenSlice:function(a,
b){var c=this.importer.getOrCreatePseudoThread("exynos_flip");c.openSliceTS=a;c.openSlice="flip:"+b},exynosFlipCloseSlice:function(a,b){var c=this.importer.getOrCreatePseudoThread("exynos_flip");if(c.openSlice){var f=new tracing.TimelineSlice("",c.openSlice,tracing.getStringColorId(c.openSlice),c.openSliceTS,b,a-c.openSliceTS);c.thread.pushSlice(f)}c.openSlice=void 0},flipEvent:function(a,b,c,f,d){b=/pipe=(\d+)/.exec(d[5]);if(!b)return!1;b=parseInt(b[1]);"exynos_flip_request"==a?this.exynosFlipOpenSlice(f,
b):this.exynosFlipCloseSlice(f,{pipe:b});return!0},exynosBusfreqSample:function(a,b,c){a=this.importer.getOrCreateCpuState(0).cpu.getOrCreateCounter("",a);0==a.numSeries&&(a.seriesNames.push("frequency"),a.seriesColors.push(tracing.getStringColorId(a.name+".frequency")));a.timestamps.push(b);a.samples.push(c)},busfreqTargetIntEvent:function(a,b,c,d,e){a=/frequency=(\d+)/.exec(e[5]);if(!a)return!1;this.exynosBusfreqSample("INT Frequency",d,parseInt(a[1]));return!0},busfreqTargetMifEvent:function(a,
b,c,d,e){a=/frequency=(\d+)/.exec(e[5]);if(!a)return!1;this.exynosBusfreqSample("MIF Frequency",d,parseInt(a[1]));return!0}};d.registerSubtype(e);return{LinuxPerfExynosParser:e}});base.require("linux_perf_parser");
base.exportTo("tracing",function(){function e(a){d.call(this,a);a.registerEventHandler("tracing_mark_write:log",e.prototype.logEvent.bind(this));a.registerEventHandler("tracing_mark_write:SyncInterpret",e.prototype.syncEvent.bind(this));a.registerEventHandler("tracing_mark_write:HandleTimer",e.prototype.timerEvent.bind(this))}var d=tracing.LinuxPerfParser;e.prototype={__proto__:d.prototype,gestureOpenSlice:function(a,b,c){this.importer.getOrCreatePseudoThread("gesture").thread.beginSlice("touchpad_gesture",
a,b,c)},gestureCloseSlice:function(a,b){var c=this.importer.getOrCreatePseudoThread("gesture").thread;if(c.openSliceCount){var d=c.openPartialSlices_[c.openSliceCount-1];d.title!=a?this.importer.importError("Titles do not match. Title is "+d.title+" in openSlice, and is "+a+" in endSlice"):c.endSlice(b)}},logEvent:function(a,b,c,d,e){a=/^\s*(\w+):\s*(\w+)$/.exec(e[2]);switch(a[1]){case "start":this.gestureOpenSlice("GestureLog",d,{name:a[2]});break;case "end":this.gestureCloseSlice("GestureLog",d)}return!0},
syncEvent:function(a,b,c,d,e){a=/^\s*(\w+):\s*(\w+)$/.exec(e[2]);switch(a[1]){case "start":this.gestureOpenSlice("SyncInterpret",d,{interpreter:a[2]});break;case "end":this.gestureCloseSlice("SyncInterpret",d)}return!0},timerEvent:function(a,b,c,d,e){a=/^\s*(\w+):\s*(\w+)$/.exec(e[2]);switch(a[1]){case "start":this.gestureOpenSlice("HandleTimer",d,{interpreter:a[2]});break;case "end":this.gestureCloseSlice("HandleTimer",d)}return!0}};d.registerSubtype(e);return{LinuxPerfGestureParser:e}});base.require("linux_perf_parser");
base.exportTo("tracing",function(){function e(a){d.call(this,a);a.registerEventHandler("i915_gem_object_create",e.prototype.gemObjectCreateEvent.bind(this));a.registerEventHandler("i915_gem_object_bind",e.prototype.gemObjectBindEvent.bind(this));a.registerEventHandler("i915_gem_object_unbind",e.prototype.gemObjectBindEvent.bind(this));a.registerEventHandler("i915_gem_object_change_domain",e.prototype.gemObjectChangeDomainEvent.bind(this));a.registerEventHandler("i915_gem_object_pread",e.prototype.gemObjectPreadWriteEvent.bind(this));
a.registerEventHandler("i915_gem_object_pwrite",e.prototype.gemObjectPreadWriteEvent.bind(this));a.registerEventHandler("i915_gem_object_fault",e.prototype.gemObjectFaultEvent.bind(this));a.registerEventHandler("i915_gem_object_clflush",e.prototype.gemObjectDestroyEvent.bind(this));a.registerEventHandler("i915_gem_object_destroy",e.prototype.gemObjectDestroyEvent.bind(this));a.registerEventHandler("i915_gem_ring_dispatch",e.prototype.gemRingDispatchEvent.bind(this));a.registerEventHandler("i915_gem_ring_flush",
e.prototype.gemRingFlushEvent.bind(this));a.registerEventHandler("i915_gem_request",e.prototype.gemRequestEvent.bind(this));a.registerEventHandler("i915_gem_request_add",e.prototype.gemRequestEvent.bind(this));a.registerEventHandler("i915_gem_request_complete",e.prototype.gemRequestEvent.bind(this));a.registerEventHandler("i915_gem_request_retire",e.prototype.gemRequestEvent.bind(this));a.registerEventHandler("i915_gem_request_wait_begin",e.prototype.gemRequestEvent.bind(this));a.registerEventHandler("i915_gem_request_wait_end",
e.prototype.gemRequestEvent.bind(this));a.registerEventHandler("i915_gem_ring_wait_begin",e.prototype.gemRingWaitEvent.bind(this));a.registerEventHandler("i915_gem_ring_wait_end",e.prototype.gemRingWaitEvent.bind(this));a.registerEventHandler("i915_reg_rw",e.prototype.regRWEvent.bind(this));a.registerEventHandler("i915_flip_request",e.prototype.flipEvent.bind(this));a.registerEventHandler("i915_flip_complete",e.prototype.flipEvent.bind(this))}var d=tracing.LinuxPerfParser;e.prototype={__proto__:d.prototype,
i915FlipOpenSlice:function(a,b,c){var d=this.importer.getOrCreatePseudoThread("i915_flip");d.openSliceTS=a;d.openSlice="flip:"+b+"/"+c},i915FlipCloseSlice:function(a,b){var c=this.importer.getOrCreatePseudoThread("i915_flip");if(c.openSlice){var d=new tracing.TimelineSlice("",c.openSlice,tracing.getStringColorId(c.openSlice),c.openSliceTS,b,a-c.openSliceTS);c.thread.pushSlice(d)}c.openSlice=void 0},i915GemObjectSlice:function(a,b,c,d){var e=this.importer.getOrCreatePseudoThread("i915_gem");e.openSlice=
b+":"+c;a=new tracing.TimelineSlice("",e.openSlice,tracing.getStringColorId(e.openSlice),a,d,0);e.thread.pushSlice(a)},i915GemRingSlice:function(a,b,c,d,e){var l=this.importer.getOrCreatePseudoThread("i915_gem_ring");l.openSlice=b+":"+c+"."+d;a=new tracing.TimelineSlice("",l.openSlice,tracing.getStringColorId(l.openSlice),a,e,0);l.thread.pushSlice(a)},i915RegSlice:function(a,b,c,d){var e=this.importer.getOrCreatePseudoThread("i915_reg");e.openSlice=b+":"+c;a=new tracing.TimelineSlice("",e.openSlice,
tracing.getStringColorId(e.openSlice),a,d,0);e.thread.pushSlice(a)},gemObjectCreateEvent:function(a,b,c,d,e){c=/obj=(\w+), size=(\d+)/.exec(e[5]);if(!c)return!1;b=c[1];c=parseInt(c[2]);this.i915GemObjectSlice(d,a,b,{obj:b,size:c});return!0},gemObjectBindEvent:function(a,b,c,d,e){e=/obj=(\w+), offset=(\w+), size=(\d+)/.exec(e[5]);if(!e)return!1;b=e[1];c=e[2];e=parseInt(e[3]);this.i915ObjectGemSlice(d,a+":"+b,{obj:b,offset:c,size:e});return!0},gemObjectChangeDomainEvent:function(a,b,c,d,e){b=/obj=(\w+), read=(\w+=>\w+), write=(\w+=>\w+)/.exec(e[5]);
if(!b)return!1;c=b[1];this.i915GemObjectSlice(d,a,c,{obj:c,read:b[2],write:b[3]});return!0},gemObjectPreadWriteEvent:function(a,b,c,d,e){e=/obj=(\w+), offset=(\d+), len=(\d+)/.exec(e[5]);if(!e)return!1;b=e[1];c=parseInt(e[2]);e=parseInt(e[3]);this.i915GemObjectSlice(d,a,b,{obj:b,offset:c,len:e});return!0},gemObjectFaultEvent:function(a,b,c,d,e){e=/obj=(\w+), (\w+) index=(\d+)/.exec(e[5]);if(!e)return!1;b=e[1];c=e[2];e=parseInt(e[3]);this.i915GemObjectSlice(d,a,b,{obj:b,type:c,index:e});return!0},
gemObjectDestroyEvent:function(a,b,c,d,e){b=/obj=(\w+)/.exec(e[5]);if(!b)return!1;b=b[1];this.i915GemObjectSlice(d,a,b,{obj:b});return!0},gemRingDispatchEvent:function(a,b,c,d,e){e=/dev=(\d+), ring=(\d+), seqno=(\d+)/.exec(e[5]);if(!e)return!1;b=parseInt(e[1]);c=parseInt(e[2]);e=parseInt(e[3]);this.i915GemRingSlice(d,a,b,c,{dev:b,ring:c,seqno:e});return!0},gemRingFlushEvent:function(a,b,c,d,e){b=/dev=(\d+), ring=(\w+), invalidate=(\w+), flush=(\w+)/.exec(e[5]);if(!b)return!1;c=parseInt(b[1]);e=parseInt(b[2]);
this.i915GemRingSlice(d,a,c,e,{dev:c,ring:e,invalidate:b[3],flush:b[4]});return!0},gemRequestEvent:function(a,b,c,d,e){e=/dev=(\d+), ring=(\d+), seqno=(\d+)/.exec(e[5]);if(!e)return!1;b=parseInt(e[1]);c=parseInt(e[2]);e=parseInt(e[3]);this.i915GemRingSlice(d,a,b,c,{dev:b,ring:c,seqno:e});return!0},gemRingWaitEvent:function(a,b,c,d,e){c=/dev=(\d+), ring=(\d+)/.exec(e[5]);if(!c)return!1;b=parseInt(c[1]);c=parseInt(c[2]);this.i915GemRingSlice(d,a,b,c,{dev:b,ring:c});return!0},regRWEvent:function(a,b,
c,d,e){a=/(\w+) reg=(\w+), len=(\d+), val=(\(\w+, \w+\))/.exec(e[5]);if(!a)return!1;b=a[1];c=a[2];this.i915RegSlice(d,b,c,{rw:b,reg:c,len:a[3],data:a[3]});return!0},flipEvent:function(a,b,c,d,e){c=/plane=(\d+), obj=(\w+)/.exec(e[5]);if(!c)return!1;b=parseInt(c[1]);c=c[2];"i915_flip_request"==a?this.i915FlipOpenSlice(d,c,b):this.i915FlipCloseSlice(d,{obj:c,plane:b});return!0}};d.registerSubtype(e);return{LinuxPerfI915Parser:e}});base.require("linux_perf_parser");
base.exportTo("tracing",function(){function e(a){d.call(this,a);a.registerEventHandler("mali_dvfs_event",e.prototype.dvfsEventEvent.bind(this));a.registerEventHandler("mali_dvfs_set_clock",e.prototype.dvfsSetClockEvent.bind(this));a.registerEventHandler("mali_dvfs_set_voltage",e.prototype.dvfsSetVoltageEvent.bind(this));a.registerEventHandler("tracing_mark_write:mali_driver",e.prototype.maliDDKEvent.bind(this))}var d=tracing.LinuxPerfParser;e.prototype={__proto__:d.prototype,maliDDKOpenSlice:function(a,
b,c,d){this.importer.getOrCreateKernelThread("mali_ddk",a,"mali_ddk").thread.beginSlice("gpu-driver",c,b,{blockinfo:d})},maliDDKCloseSlice:function(a,b){var c=this.importer.getOrCreateKernelThread("mali_ddk",a,"mali_ddk").thread;c.openSliceCount?c.endSlice(b):this.importer.importError("maliDDKCloseSlice w/o matching OpenSlice")},maliDDKEvent:function(a,b,c,d,e){a=/^s*(\w+):\s*([\w\\\/.\-]*):?\s*(.*)$/.exec(e[2]);switch(a[1]){case "cros_trace_print_enter":this.maliDDKOpenSlice(c,d,a[3],a[2]);break;
case "cros_trace_print_exit":this.maliDDKCloseSlice(c,d,[],a[2])}return!0},dvfsSample:function(a,b,c,d){a=this.importer.getOrCreateCpuState(0).cpu.getOrCreateCounter("",a);0==a.numSeries&&(a.seriesNames.push(b),a.seriesColors.push(tracing.getStringColorId(a.name)));a.timestamps.push(c);a.samples.push(d)},dvfsEventEvent:function(a,b,c,d,e){a=/utilization=(\d+)/.exec(e[5]);if(!a)return!1;this.dvfsSample("DVFS Utilization","utilization",d,a[1]);return!0},dvfsSetClockEvent:function(a,b,c,d,e){a=/frequency=(\d+)/.exec(e[5]);
if(!a)return!1;this.dvfsSample("DVFS Frequency","frequency",d,a[1]);return!0},dvfsSetVoltageEvent:function(a,b,c,d,e){a=/voltage=(\d+)/.exec(e[5]);if(!a)return!1;this.dvfsSample("DVFS Voltage","voltage",d,a[1]);return!0}};d.registerSubtype(e);return{LinuxPerfMaliParser:e}});base.require("linux_perf_parser");
base.exportTo("tracing",function(){function e(a){d.call(this,a);a.registerEventHandler("power_start",e.prototype.powerStartEvent.bind(this));a.registerEventHandler("power_frequency",e.prototype.powerFrequencyEvent.bind(this));a.registerEventHandler("cpu_frequency",e.prototype.cpuFrequencyEvent.bind(this));a.registerEventHandler("cpu_idle",e.prototype.cpuIdleEvent.bind(this))}var d=tracing.LinuxPerfParser;e.prototype={__proto__:d.prototype,cpuStateSlice:function(a,b,c,d){b=this.importer.getOrCreateCpuState(b);
"1"!=c?this.importer.importError("Don't understand power_start events of type "+c):(c=b.cpu.getOrCreateCounter("","C-State"),0==c.numSeries&&(c.seriesNames.push("state"),c.seriesColors.push(tracing.getStringColorId(c.name+".state"))),c.timestamps.push(a),c.samples.push(d))},cpuIdleSlice:function(a,b,c){b=this.importer.getOrCreateCpuState(b).cpu.getOrCreateCounter("","C-State");0==b.numSeries&&(b.seriesNames.push("state"),b.seriesColors.push(tracing.getStringColorId(b.name)));4294967295!=c?b.samples.push(c):
b.samples.push(0);b.timestamps.push(a)},cpuFrequencySlice:function(a,b,c){b=this.importer.getOrCreateCpuState(b).cpu.getOrCreateCounter("","Clock Frequency");0==b.numSeries&&(b.seriesNames.push("state"),b.seriesColors.push(tracing.getStringColorId(b.name+".state")));b.timestamps.push(a);b.samples.push(c)},powerStartEvent:function(a,b,c,d,e){a=/type=(\d+) state=(\d) cpu_id=(\d)+/.exec(e[5]);if(!a)return!1;b=parseInt(a[3]);c=parseInt(a[2]);this.cpuStateSlice(d,b,a[1],c);return!0},powerFrequencyEvent:function(a,
b,c,d,e){b=/type=(\d+) state=(\d+) cpu_id=(\d)+/.exec(e[5]);if(!b)return!1;a=parseInt(b[3]);b=parseInt(b[2]);this.cpuFrequencySlice(d,a,b);return!0},cpuFrequencyEvent:function(a,b,c,d,e){b=/state=(\d+) cpu_id=(\d)+/.exec(e[5]);if(!b)return!1;a=parseInt(b[2]);b=parseInt(b[1]);this.cpuFrequencySlice(d,a,b);return!0},cpuIdleEvent:function(a,b,c,d,e){b=/state=(\d+) cpu_id=(\d)+/.exec(e[5]);if(!b)return!1;a=parseInt(b[2]);b=parseInt(b[1]);this.cpuIdleSlice(d,a,b);return!0}};d.registerSubtype(e);return{LinuxPerfPowerParser:e}});
base.require("linux_perf_parser");
base.exportTo("tracing",function(){function e(a){d.call(this,a);a.registerEventHandler("sched_switch",e.prototype.schedSwitchEvent.bind(this));a.registerEventHandler("sched_wakeup",e.prototype.schedWakeupEvent.bind(this))}var d=tracing.LinuxPerfParser;TestExports={};var a=RegExp("prev_comm=(.+) prev_pid=(\\d+) prev_prio=(\\d+) prev_state=(\\S\\+?|\\S\\|\\S) ==> next_comm=(.+) next_pid=(\\d+) next_prio=(\\d+)");TestExports.schedSwitchRE=a;var b=/comm=(.+) pid=(\d+) prio=(\d+) success=(\d+) target_cpu=(\d+)/;TestExports.schedWakeupRE=
b;e.prototype={__proto__:d.prototype,schedSwitchEvent:function(b,d,e,l,h){var j=a.exec(h[5]);if(!j)return!1;b=j[4];e=j[5];h=parseInt(j[6]);j=parseInt(j[7]);this.importer.getOrCreateCpuState(d).switchRunningLinuxPid(this.importer,b,l,h,e,j);return!0},schedWakeupEvent:function(a,d,e,l,h){d=b.exec(h[5]);if(!d)return!1;a=d[1];e=parseInt(d[2]);d=parseInt(d[3]);this.importer.markPidRunnable(l,e,a,d);return!0}};d.registerSubtype(e);return{LinuxPerfSchedParser:e,_LinuxPerfSchedParserTestExports:TestExports}});
base.require("linux_perf_parser");
base.exportTo("tracing",function(){function e(a){d.call(this,a);a.registerEventHandler("workqueue_execute_start",e.prototype.executeStartEvent.bind(this));a.registerEventHandler("workqueue_execute_end",e.prototype.executeEndEvent.bind(this))}var d=tracing.LinuxPerfParser,a=/work struct (.+): function (\S+)/,b=/work struct (.+)/;e.prototype={__proto__:d.prototype,executeStartEvent:function(b,d,e,l,h){b=a.exec(h[5]);if(!b)return!1;h=this.importer.getOrCreateKernelThread(h[1]);h.openSliceTS=l;h.openSlice=
b[2];return!0},executeEndEvent:function(a,d,e,l,h){if(!b.exec(h[5]))return!1;a=this.importer.getOrCreateKernelThread(h[1]);a.openSlice&&(l=new tracing.TimelineSlice("",a.openSlice,tracing.getStringColorId(a.openSlice),a.openSliceTS,{},l-a.openSliceTS),a.thread.pushSlice(l));a.openSlice=void 0;return!0}};d.registerSubtype(e);return{LinuxPerfWorkqueueParser:e}});base.require("linux_perf_parser");
base.exportTo("tracing",function(){function e(a){d.call(this,a);a.registerEventHandler("tracing_mark_write:android",e.prototype.traceMarkWriteAndroidEvent.bind(this));a.registerEventHandler("0:android",e.prototype.traceMarkWriteAndroidEvent.bind(this));this.model_=a.model_;this.ppids_={}}var d=tracing.LinuxPerfParser;e.prototype={__proto__:d.prototype,traceMarkWriteAndroidEvent:function(a,b,c,d,e,l){b=e[2].split("|");switch(b[0]){case "B":var a=parseInt(b[1]),h=b[2],b=this.model_.getOrCreateProcess(a).getOrCreateThread(c);
b.name=l;if(!b.isTimestampValidForBeginOrEnd(d))return this.model_.importErrors.push("Timestamps are moving backward."),!1;this.ppids_[c]=a;b.beginSlice(null,h,d,{});break;case "E":a=this.ppids_[c];if(void 0===a)break;b=this.model_.getOrCreateProcess(a).getOrCreateThread(c);if(!b.openSliceCount)break;d=b.endSlice(d);args={};for(h in args)void 0!==d.args[h]&&this.model_.importErrors.push("Both the B and E events of "+d.name+"provided values for argument "+h+". The value of the E event will be used."),
d.args[h]=event.args[h];break;case "C":a=parseInt(b[1]);h=b[2];c=parseInt(b[3]);l=this.model_.getOrCreateProcess(a).getOrCreateCounter(null,h);0==l.numSeries&&(l.seriesNames.push("value"),l.seriesColors.push(tracing.getStringColorId(l.name+".value")));l.timestamps.push(d);l.samples.push(c);break;default:return!1}return!0}};d.registerSubtype(e);return{LinuxPerfAndroidParser:e}});base.require("timeline_model");base.require("timeline_color_scheme");base.require("linux_perf_cpufreq_parser");base.require("linux_perf_drm_parser");
base.require("linux_perf_exynos_parser");base.require("linux_perf_gesture_parser");base.require("linux_perf_i915_parser");base.require("linux_perf_mali_parser");base.require("linux_perf_power_parser");base.require("linux_perf_sched_parser");base.require("linux_perf_workqueue_parser");base.require("linux_perf_android_parser");
base.exportTo("tracing",function(){function e(a){this.cpu=a}function d(a,b){this.importPriority=2;this.model_=a;this.events_=b;this.clockSyncRecords_=[];this.cpuStates_={};this.kernelThreadStates_={};this.buildMapFromLinuxPidsToTimelineThreads();this.lineNumber=-1;this.pseudoThreadCounter=1;this.parsers_=[];this.eventHandlers_={}}function a(a){return b.test(a)?b:c.test(a)?c:null}e.prototype={__proto__:Object.prototype,switchRunningLinuxPid:function(a,b,c,d,e,k){if(void 0!==this.lastActivePid&&0!=
this.lastActivePid){var p=c-this.lastActiveTs;name=(a=a.threadsByLinuxPid[this.lastActivePid])?a.userFriendlyName:this.lastActiveComm;b=new tracing.TimelineSlice("",name,tracing.getStringColorId(name),this.lastActiveTs,{comm:this.lastActiveComm,tid:this.lastActivePid,prio:this.lastActivePrio,stateWhenDescheduled:b},p);this.cpu.slices.push(b)}this.lastActiveTs=c;this.lastActivePid=d;this.lastActiveComm=e;this.lastActivePrio=k}};TestExports={};var b=/^\s*(.+?)\s+\[(\d+)\]\s+[dX.][N.][Hhs.][0-9a-f.]\s+(\d+\.\d+):\s+(\S+):\s(.*)$/;
TestExports.lineREWithIRQInfo=b;var c=/^\s*(.+?)\s+\[(\d+)\]\s*(\d+\.\d+):\s+(\S+):\s(.*)$/;TestExports.lineRE=c;TestExports.traceEventClockSyncRE=/trace_event_clock_sync: parent_ts=(\d+\.?\d*)/;TestExports.autoDetectLineRE=a;d.canImport=function(b){if(!("string"===typeof b||b instanceof String))return!1;if(/^# tracer:/.test(b))return!0;var c=/^(.+)\n/.exec(b);c&&(b=c[1]);return a(b)?!0:!1};d.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 e(b)}return this.cpuStates_[a]},getOrCreateKernelThread:function(a,b,c){this.kernelThreadStates_[a]||(void 0==b&&(b=/.+-(\d+)/.exec(a)[1],b=parseInt(b,10)),void 0==c&&(c=b),c=this.model_.getOrCreateProcess(b).getOrCreateThread(c),c.name=a,this.kernelThreadStates_[a]={pid:b,thread:c,openSlice:void 0,
openSliceTS:void 0},this.threadsByLinuxPid[b]=c);return this.kernelThreadStates_[a]},getOrCreatePseudoThread:function(a){var b=this.kernelThreadStates_[a];b||(b=this.getOrCreateKernelThread(a,0,this.pseudoThreadCounter),this.pseudoThreadCounter++);return b},importEvents:function(a){this.createParsers();this.importCpuData();this.alignClocks(a)&&(this.buildMapFromLinuxPidsToTimelineThreads(),this.buildPerThreadCpuSlicesFromCpuState())},finalizeImport:function(){},buildPerThreadCpuSlicesFromCpuState:function(){for(var a in this.cpuStates_)for(var b=
this.cpuStates_[a].cpu,c=0;c<b.slices.length;c++){var d=b.slices[c],e=this.threadsByLinuxPid[d.args.tid];e&&(e.tempCpuSlices||(e.tempCpuSlices=[]),e.tempCpuSlices.push(d))}var k=tracing.getColorIdByName("running"),p=tracing.getColorIdByName("runnable"),m=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){return a.start-b.start});var c=[];if(b.length){var d=
b[0];c.push(new tracing.TimelineSlice("","Running",k,d.start,{},d.duration))}for(d=1;d<b.length;d++){var e=b[d-1],f=b[d],g=f.start-e.end;if("S"==e.args.stateWhenDescheduled)c.push(new tracing.TimelineSlice("","Sleeping",m,e.end,{},g));else if("R"==e.args.stateWhenDescheduled||"R+"==e.args.stateWhenDescheduled)c.push(new tracing.TimelineSlice("","Runnable",p,e.end,{},g));else if("D"==e.args.stateWhenDescheduled)c.push(new tracing.TimelineSlice("","Uninterruptible Sleep",o,e.end,{},g));else if("T"==
e.args.stateWhenDescheduled)c.push(new tracing.TimelineSlice("","__TASK_STOPPED",o,e.end,{},g));else if("t"==e.args.stateWhenDescheduled)c.push(new tracing.TimelineSlice("","debug",o,e.end,{},g));else if("Z"==e.args.stateWhenDescheduled)c.push(new tracing.TimelineSlice("","Zombie",o,e.end,{},g));else if("X"==e.args.stateWhenDescheduled)c.push(new tracing.TimelineSlice("","Exit Dead",o,e.end,{},g));else if("x"==e.args.stateWhenDescheduled)c.push(new tracing.TimelineSlice("","Task Dead",o,e.end,{},
g));else if("W"==e.args.stateWhenDescheduled)c.push(new tracing.TimelineSlice("","WakeKill",o,e.end,{},g));else if("D|W"==e.args.stateWhenDescheduled)c.push(new tracing.TimelineSlice("","Uninterruptable Sleep | WakeKill",o,e.end,{},g));else throw Error("Unrecognized state: ")+e.args.stateWhenDescheduled;c.push(new tracing.TimelineSlice("","Running",k,f.start,{},f.duration))}a.cpuSlices=c}})},alignClocks:function(a){if(0==this.clockSyncRecords_.length){if(!a)return!0;this.abortImport();return!1}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 c=this.cpuStates_[b].cpu,d=0;d<c.slices.length;d++){var e=c.slices[d];e.start+=a;e.duration=e.duration}for(var k in c.counters){d=c.counters[k];for(e=0;e<d.timestamps.length;e++)d.timestamps[e]+=a}}for(var p in this.kernelThreadStates_)this.kernelThreadStates_[p].thread.shiftTimestampsForward(a);return!0},abortImport:function(){if(this.pushedEventsToThreads)throw Error("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 c=a.parent;delete c.threads[a.tid];delete this.model_.processes[c.pid]}this.model_.importErrors.push("Cannot import kernel trace without a clock sync.")},createParsers:function(){for(var a=tracing.LinuxPerfParser.getSubtypeConstructors(),b=0;b<a.length;++b)this.parsers_.push(new a[b](this));this.registerEventHandler("tracing_mark_write:trace_event_clock_sync",d.prototype.traceClockSyncEvent.bind(this));
this.registerEventHandler("tracing_mark_write",d.prototype.traceMarkingWriteEvent.bind(this));this.registerEventHandler("0:trace_event_clock_sync",d.prototype.traceClockSyncEvent.bind(this));this.registerEventHandler("0",d.prototype.traceMarkingWriteEvent.bind(this))},registerEventHandler:function(a,b){this.eventHandlers_[a]=b},markPidRunnable:function(){},importError:function(a){this.model_.importErrors.push("Line "+(this.lineNumber+1)+": "+a)},traceClockSyncEvent:function(a,b,c,d,e){a=/parent_ts=(\d+\.?\d*)/.exec(e[2]);
if(!a)return!1;this.clockSyncRecords_.push({perfTS:d,parentTS:1E3*a[1]});return!0},traceMarkingWriteEvent:function(a,b,c,d,e,k){var p=/^\s*(\w+):\s*(.*)$/.exec(e[5]);if(!p)if(0===e[5].lastIndexOf("B|",0)||"E"===e[5]||0===e[5].lastIndexOf("C|",0))p=[e[5],"android",e[5]];else return!1;a=a+":"+p[1];k=/(\S+)-\d+/.exec(e[1])[1];e=this.eventHandlers_[a];return!e?(this.importError("Unknown trace_marking_write event "+a),!0):e(a,b,c,d,p,k)},importCpuData:function(){this.lines_=this.events_.split("\n");var b=
null;for(this.lineNumber=0;this.lineNumber<this.lines_.length;++this.lineNumber){var c=this.lines_[this.lineNumber];if(!(0==c.length||/^#/.test(c))){if(null==b&&(b=a(c),null==b)){this.importError("Cannot parse line: "+c);continue}var d=b.exec(c);if(d){var e=parseInt(/\S+-(\d+)/.exec(d[1])[1]),j=parseInt(d[2]),k=1E3*parseFloat(d[3]),p=d[4],m=this.eventHandlers_[p];m?m(p,j,e,k,d)||this.importError("Malformed "+p+" event ("+c+")"):this.importError("Unknown event "+p+" ("+c+")")}else this.importError("Unrecognized line: "+
c)}}}};tracing.TimelineModel.registerImporter(d);return{LinuxPerfImporter:d,_LinuxPerfImporterTestExports:TestExports}});"use strict";
base.exportTo("base",function(){function e(){this.storage_="G_testRunner"in global?FakeLocalStorage():localStorage}e.prototype={get:function(d,a,b){d=this.namespace_(d,b);return!(d in this.storage_)?a:String(this.storage_[d])},set:function(d,a,b){this.storage_[this.namespace_(d,b)]=String(a)},keys:function(d){for(var a=[],d=d||"",b=0;b<this.storage_.length;b++){var c=this.storage_.key(b);this.isnamespaced_(c,d)&&a.push(this.unnamespace_(c,d))}return a},isnamespaced_:function(d,a){return 0==d.indexOf(this.normalize_(a))},
namespace_:function(d,a){return this.normalize_(a)+d},unnamespace_:function(d,a){return d.replace(this.normalize_(a),"")},normalize_:function(d){return e.NAMESPACE+(d?d+".":"")}};e.NAMESPACE="trace-viewer";return{Settings:e}});function FakeLocalStorage(){return Object.create({},{key:{value:function(e){return Object.keys(this).sort()[e]}},length:{get:function(){return Object.keys(this).length}}})}"use strict";base.requireStylesheet("timeline_view");base.require("timeline");base.require("timeline_analysis");
base.require("timeline_category_filter_dialog");base.require("timeline_filter");base.require("timeline_find_control");base.require("overlay");base.require("trace_event_importer");base.require("linux_perf_importer");base.require("settings");
base.exportTo("tracing",function(){var e=base.ui.define("div");e.prototype={__proto__:HTMLDivElement.prototype,decorate:function(){this.classList.add("timeline-view");this.titleEl_=document.createElement("div");this.titleEl_.textContent="Tracing: ";this.titleEl_.className="title";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 a=document.createElement("div");a.className="spacer";this.timelineContainer_=document.createElement("div");this.timelineContainer_.className="timeline-container";var b=document.createElement("div");b.className="analysis-container";this.analysisEl_=new tracing.TimelineAnalysisView;this.dragEl_=new d;this.dragEl_.target=b;this.findCtl_=new tracing.TimelineFindControl;this.findCtl_.controller=new tracing.TimelineFindController;this.importErrorsButton_=this.createImportErrorsButton_();
this.categoryFilterButton_=this.createCategoryFilterButton_();this.categoryFilterButton_.callback=this.updateCategoryFilterFromSettings_.bind(this);this.metadataButton_=this.createMetadataButton_();this.rightControls.appendChild(this.importErrorsButton_);this.rightControls.appendChild(this.categoryFilterButton_);this.rightControls.appendChild(this.metadataButton_);this.rightControls.appendChild(this.findCtl_);this.controlDiv_.appendChild(this.titleEl_);this.controlDiv_.appendChild(this.leftControlsEl_);
this.controlDiv_.appendChild(a);this.controlDiv_.appendChild(this.rightControlsEl_);this.appendChild(this.controlDiv_);this.appendChild(this.timelineContainer_);this.appendChild(this.dragEl_);b.appendChild(this.analysisEl_);this.appendChild(b);this.rightControls.appendChild(this.createHelpButton_());this.onSelectionChangedBoundToThis_=this.onSelectionChanged_.bind(this);document.addEventListener("keypress",this.onKeypress_.bind(this),!0)},createImportErrorsButton_:function(){function a(){c.style.display=
l.model&&l.model.importErrors.length?"":"none"}var b=new tracing.Overlay;b.classList.add("timeline-view-import-errors-overlay");b.autoClose=!0;var c=document.createElement("div");c.className="timeline-button timeline-view-import-errors-button timeline-view-info-button";c.textContent="Import errors!";var d=document.createElement("div");d.className="info-button-text import-errors-dialog-text";var e=document.createElement("div");e.className="info-button-containerimport-errors-dialog";e.textContent="Errors occurred during import:";
e.appendChild(d);b.appendChild(e);var l=this;c.addEventListener("click",function(){b.visible=!0;d.textContent=l.model.importErrors.join("\n")}.bind(this));a();l.addEventListener("modelChange",a);return c},createCategoryFilterButton_:function(){function a(){c.style.display=d.model?"":"none"}var b,c=document.createElement("div");c.className="timeline-button timeline-view-info-button";c.textContent="Categories";c.__defineSetter__("callback",function(a){b=a});var d=this;a();d.addEventListener("modelChange",
a);c.addEventListener("click",function(){var a=new tracing.TimelineCategoryFilterDialog;a.model=d.model;a.settings=d.settings;a.settingUpdatedCallback=b;a.visible=!0}.bind(this));return c},createHelpButton_:function(){var a=new tracing.Overlay;a.classList.add("timeline-view-help-overlay");a.autoClose=!0;a.additionalCloseKeyCodes.push(63);var b=document.createElement("div");b.className="timeline-button timeline-view-help-button";b.textContent="?";var c=document.createElement("div");c.style.whiteSpace=
"pre";c.style.fontFamily="monospace";a.appendChild(c);b.addEventListener("click",function(b){a.visible=!0;c.textContent=this.timeline_?this.timeline_.keyHelp:"No content loaded. For interesting help, load something.";b.stopPropagation();return!1}.bind(this));return b},createMetadataButton_:function(){function a(){c.style.display=l.model&&l.model.metadata.length?"":"none"}var b=new tracing.Overlay;b.classList.add("timeline-view-metadata-overlay");b.autoClose=!0;var c=document.createElement("div");
c.className="timeline-button timeline-view-metadata-button timeline-view-info-button";c.textContent="Metadata";var d=document.createElement("div");d.className="info-button-text metadata-dialog-text";var e=document.createElement("div");e.className="info-button-container metadata-dialog";e.textContent="Metadata Info:";e.appendChild(d);b.appendChild(e);var l=this;c.addEventListener("click",function(){b.visible=!0;var a=[],c=l.model,e;for(e in c.metadata)a.push(JSON.stringify(c.metadata[e].name)+": "+
JSON.stringify(c.metadata[e].value));d.textContent=a.join("\n")}.bind(this));a();l.addEventListener("modelChange",a);return c},get leftControls(){return this.leftControlsEl_},get rightControls(){return this.rightControlsEl_},get title(){return this.titleEl_.textContent.substring(this.titleEl_.textContent.length-2)},set title(a){this.titleEl_.textContent=a+":"},set traceData(a){this.model=new tracing.TimelineModel(a)},get model(){if(this.timeline_)return this.timeline_.model},set model(a){var b=a!=
this.model,c=a&&void 0!==a.minTimestamp;b&&(this.timelineContainer_.textContent="",this.timeline_&&(this.timeline_.removeEventListener("selectionChange",this.onSelectionChangedBoundToThis_),this.timeline_.detach(),this.timeline_=void 0,this.findCtl_.controller.timeline=void 0));c&&!this.timeline_&&(this.timeline_=new tracing.Timeline,this.timeline_.focusElement=this.focusElement_?this.focusElement_:this.parentElement,this.timelineContainer_.appendChild(this.timeline_),this.findCtl_.controller.timeline=
this.timeline_,this.timeline_.addEventListener("selectionChange",this.onSelectionChangedBoundToThis_),this.updateCategoryFilterFromSettings_());c&&(this.timeline_.model=a);base.dispatchSimpleEvent(this,"modelChange");if(b)this.onSelectionChanged_()},get timeline(){return this.timeline_},get settings(){this.settings_||(this.settings_=new base.Settings);return this.settings_},set focusElement(a){this.focusElement_=a;this.timeline_&&(this.timeline_.focusElement=a)},get focusElement(){return this.focusElement_?
this.focusElement_:this.parentElement},get isAttachedToDocument_(){for(var a=this;a.parentNode;)a=a.parentNode;return a==this.ownerDocument},get listenToKeys_(){if(this.isAttachedToDocument_)return!this.focusElement_?!0:0<=this.focusElement.tabIndex?document.activeElement==this.focusElement:!0},onKeypress_:function(a){this.listenToKeys_&&(47==event.keyCode?(this.findCtl_.focus(),event.preventDefault()):63==a.keyCode&&(this.querySelector(".timeline-view-help-button").click(),a.preventDefault()))},
beginFind:function(){if(!this.findInProgress_){this.findInProgress_=!0;var a=tracing.TimelineFindControl();a.controller=new tracing.TimelineFindController;a.controller.timeline=this.timeline;a.visible=!0;a.addEventListener("close",function(){this.findInProgress_=!1}.bind(this));a.addEventListener("findNext",function(){});a.addEventListener("findPrevious",function(){})}},onSelectionChanged_:function(){var a=this.timelineContainer_.scrollTop,b=this.timeline_?this.timeline_.selection:new tracing.TimelineSelection;
this.analysisEl_.selection=b;this.timelineContainer_.scrollTop=a},updateCategoryFilterFromSettings_:function(){if(this.timeline_){for(var a=this.settings.keys("categories"),b=[],c=0;c<a.length;c++)"false"==this.settings.get(a[c],"true","categories")&&b.push(a[c]);this.timeline_.categoryFilter=new tracing.TimelineCategoryFilter(b)}}};var d=base.ui.define("div");d.prototype={__proto__:HTMLDivElement.prototype,decorate:function(){this.className="timeline-drag-handle";this.lastMousePosY=0;this.dragAnalysis=
this.dragAnalysis.bind(this);this.onMouseUp=this.onMouseUp.bind(this);this.addEventListener("mousedown",this.onMouseDown)},dragAnalysis:function(a){var b=this.lastMousePosY-a.clientY;this.target.style.height||(this.target.style.height=window.getComputedStyle(this.target).height);this.target.style.height=parseInt(this.target.style.height)+b+"px";this.lastMousePosY=a.clientY},onMouseDown:function(a){this.lastMousePosY=a.clientY;document.addEventListener("mousemove",this.dragAnalysis);document.addEventListener("mouseup",
this.onMouseUp);a.stopPropagation();return!1},onMouseUp:function(){document.removeEventListener("mousemove",this.dragAnalysis);document.removeEventListener("mouseup",this.onMouseUp)}};return{TimelineView:e}});