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

Lines Matching refs:addEventListener

1 function onLoad(){reload()}function reload(){if(linuxPerfData){var g=new tracing.TimelineModel;g.importEvents("[]",!0,[linuxPerfData]);var e=document.querySelector(".view");cr.ui.decorate(e,tracing.TimelineView);e.model=g;e.tabIndex=1;e.timeline.focusElement=e}}document.addEventListener("DOMContentLoaded",onLoad);var global=this;
6 cr.isGTK=/GTK/.test(chrome.toolkit),cr.isViews=/views/.test(chrome.toolkit),cr.isTouchOptimized=!!chrome.touchOptimized,cr.isTouchOptimized&&doc.documentElement.setAttribute("touch-optimized","");else{var a=cr;Object.defineProperty(global,"cr",{get:function(){Object.defineProperty(global,"cr",{value:a});a.initialize();return a},configurable:!0})}},PropertyKind:a,get doc(){return document}}}();cr.initialize();cr.define("cr",function(){function g(){}g.prototype={addEventListener:function(e,c){this.listeners_||(this.listeners_=Object.create(null));if(e in this.listeners_){var f=this.listeners_[e];0>f.indexOf(c)&&f.push(c)}else this.listeners_[e]=[c]},removeEventListener:function(e,c){if(this.listeners_&&e in this.listeners_){var f=this.listeners_[e],h=f.indexOf(c);0<=h&&(1==f.length?delete this.listeners_[e]:f.splice(h,1))}},dispatchEvent:function(e){if(!this.listeners_)return!0;var c=this;e.__defineGetter__("target",
9 m-b-a;e.addEventListener("input",h);h()}}});cr.define("cr.ui",function(){function g(c){this.classList_=c.documentElement.classList;var f=this;c.addEventListener("keydown",function(c){9==c.keyCode&&(f.visible=!0)},!0);c.addEventListener("mousedown",function(){f.visible=!1},!0)}g.prototype={set visible(c){c?this.classList_.add("focus-outline-visible"):this.classList_.remove("focus-outline-visible")},get visible(){this.classList_.contains("focus-outline-visible")}};var e=[];g.forDocument=function(c){for(var f=0;f<e.length;f++)if(c==e[f][0])return e[f][1];
10 f=new g(c);e.push([c,f]);return f};return{FocusOutlineManager:g}});cr.define("cr.ui",function(){function g(){for(var b={TABBOX:e,TABS:c,TAB:f,TABPANELS:h,TABPANEL:a},d,m=0;d=this.children[m];m++){var i=b[d.tagName];i&&cr.ui.decorate(d,i)}}var e=cr.ui.define("tabbox");e.prototype={__proto__:HTMLElement.prototype,decorate:function(){g.call(this);this.addEventListener("selectedChange",this.handleSelectedChange_,!0);this.selectedIndex=0},handleSelectedChange_:function(a){var d=a.target;a.newValue&&(d.parentElement&&d.parentElement.parentElement)==this&&(this.selectedIndex=
11 Array.prototype.indexOf.call(d.parentElement.children,d))},selectedIndex_:-1};cr.defineProperty(e,"selectedIndex",cr.PropertyKind.JS_PROP,function(a){for(var d,c,f=0;d=this.children[f];f++)for(var e=0;c=d.children[e];e++)c.selected=e==a});var c=cr.ui.define("tabs");c.prototype={__proto__:HTMLElement.prototype,decorate:function(){g.call(this);this.tabIndex=0;this.addEventListener("keydown",this.handleKeyDown_.bind(this));this.focusOutlineManager_=cr.ui.FocusOutlineManager.forDocument(this.ownerDocument)},
12 handleKeyDown_:function(a){var d=0;switch(a.keyIdentifier){case "Left":case "Up":d=-1;break;case "Right":case "Down":d=1}d&&("rtl"==this.ownerDocument.defaultView.getComputedStyle(this).direction&&(d*=-1),a=this.children.length,this.parentElement.selectedIndex=(this.parentElement.selectedIndex+d+a)%a,this.focusOutlineManager_.visible=!0)}};var f=cr.ui.define("tab");f.prototype={__proto__:HTMLElement.prototype,decorate:function(){var a=this;this.addEventListener(cr.isMac?"click":"mousedown",function(){a.selected=
16 document.addEventListener("click",function(g){if(g.returnValue){var e=g.target;if(e.nodeType==Node.ELEMENT_NODE&&e.webkitMatchesSelector("A, A *")){for(;"A"!=e.tagName;)e=e.parentElement;if(("file:"==e.protocol||"about:"==e.protocol)&&(0==g.button||1==g.button))chrome.send("navigateToUrl",[e.href,e.target,g.button,g.altKey,g.ctrlKey,g.metaKey,g.shiftKey]),g.preventDefault()}}});function appendParam(g,e,c){e=encodeURIComponent(e)+"="+encodeURIComponent(c);return-1==g.indexOf("?")?g+"?"+e:g+"&"+e};cr.define("tracing",function(){var g=cr.ui.define("div");g.prototype={__proto__:HTMLDivElement.prototype,decorate:function(){this.classList.add("overlay-root");this.visible=!1;this.contentHost=this.ownerDocument.createElement("div");this.contentHost.classList.add("content-host");this.tabCatcher=this.ownerDocument.createElement("span");this.tabCatcher.tabIndex=0;this.appendChild(this.contentHost);this.onKeydownBoundToThis_=this.onKeydown_.bind(this);this.onFocusInBoundToThis_=this.onFocusIn_.bind(this);
17 this.addEventListener("mousedown",this.onMousedown_.bind(this))},showOverlay:function(c){c.oldParent_=c.parentNode;this.contentHost.appendChild(c);this.contentHost.appendChild(this.tabCatcher);this.ownerDocument.body.classList.add("disabled-by-overlay");this.visible=!0;c.tabIndex=0;var f=c.querySelector("button, input, list, select, a");f||(f=c);f.focus();this.ownerDocument.addEventListener("focusin",this.onFocusInBoundToThis_,!0);c.addEventListener("keydown",this.onKeydownBoundToThis_)},onMousedown_:function(c){c.target==
23 [];chrome.send("beginTracing",[e||!1]);this.beginRequestBufferPercentFull_();e=new cr.Event("traceBegun");e.events=this.traceEvents_;this.dispatchEvent(e);e=new cr.Event("traceEventsChanged");e.numEvents=this.traceEvents_.length;this.dispatchEvent(e);window.addEventListener("keypress",this.onKeypressBoundToThis_);window.addEventListener("keydown",this.onKeydownBoundToThis_)},onKeydown_:function(e){27==e.keyCode&&this.endTracing()},onKeypress_:function(e){"Enter"==e.keyIdentifier&&this.endTracing()},
88 this.iframe_.contentWindow.addEventListener("resize",this.onResizeBoundToThis_));var a=this.clientWidth+"x"+this.clientHeight;this.pendingSetFunction_&&(this.lastSize_=a,this.pendingSetFunction_(),this.pendingSetFunction_=void 0);window.clearInterval(this.checkForAttachInterval_);this.checkForAttachInterval_=void 0}},dispatchChangeEvent:function(){cr.dispatchSimpleEvent(this,"change")},detach:function(){this.checkForAttachInterval_&&(window.clearInterval(this.checkForAttachInterval_),this.checkForAttachInterval_=
97 []);d=d.bind(c);this.boundListeners_.push({object:a,event:b,boundFunc:d});a.addEventListener(b,d)},detach:function(){for(var a=0;a<this.tracks_.children.length;a++)this.tracks_.children[a].detach();for(a=0;a<this.boundListeners_.length;a++){var b=this.boundListeners_[a];b.object.removeEventListener(b.event,b.boundFunc)}this.boundListeners_=void 0;this.viewport_.detach()},get viewport(){return this.viewport_},get model(){return this.model_},set model(a){if(!a)throw Error("Model cannot be null");if(this.model)throw Error("Cannot set model twice.");
115 " ms\n";d=1<e.numSeries?d+(c("Values",a)+": "+k.join("\n")+"\n"):d+(c("Value",a)+": "+k.join("\n")+"\n")}else 1<h.length&&0==e.length&&(d+="Analysis of multiple counters not yet implemented. Pick a single counter.");return d}var a=cr.ui.define("div");a.prototype={__proto__:HTMLDivElement.prototype,decorate:function(){this.className="timeline-analysis"},set selection(a){this.textContent=h(a)}};return{TimelineAnalysisView:a}});cr.define("tracing",function(){function g(a,b){var d=document.createElement("div");d.classList.add("timeline-track-button");d.classList.add("timeline-track-close-button");d.textContent=String.fromCharCode(215);d.addEventListener("click",function(){a.style.display="None"});a.appendChild(d);if(b){var c=document.createElement("div");c.classList.add("timeline-track-button");c.classList.add("timeline-track-collapse-button");c.textContent="\u2212";var f=!1;c.addEventListener("click",function(){f=!f;a.collapsedDidChange(f);
125 this.viewportChangeBoundToThis_)},set headingWidth(a){this.headingDiv_.style.width=a},get heading(){return this.headingDiv_.textContent},set heading(a){this.headingDiv_.textContent=a},set tooltip(a){this.headingDiv_.title=a},get viewport(){return this.viewport_},set viewport(a){(this.viewport_=a)&&this.viewport_.removeEventListener("change",this.viewportChangeBoundToThis_);if(this.viewport_=a)this.viewportChangeBoundToThis_=this.viewportChange_.bind(this),this.viewport_.addEventListener("change",
142 f)):(this.merging_=!0,this.mergeStartX_=e,this.mergeCurRight_=g,this.mergedColorId=f)):(this.merging_&&this.flush(),this.ctx_.fillStyle=this.pallette_[f],this.ctx_.fillRect(e,this.y_,c,this.h_)))},flush:function(){this.merging_&&(this.ctx_.fillStyle=this.pallette_[this.mergedColorId],this.ctx_.fillRect(this.mergeStartX_,this.y_,this.mergeCurRight_-this.mergeStartX_,this.h_),this.merging_=!1)}};return{FastRectRenderer:g}});cr.define("tracing",function(){var g=cr.ui.define(cr.ui.TabPanel);g.prototype={__proto__:cr.ui.TabPanel.prototype,traceEvents_:[],systemTraceEvents_:[],decorate:function(){cr.ui.TabPanel.prototype.decorate.apply(this);this.classList.add("profiling-view");this.recordBn_=document.createElement("button");this.recordBn_.className="record";this.recordBn_.textContent="Record";this.recordBn_.addEventListener("click",this.onRecord_.bind(this));this.saveBn_=document.createElement("button");this.saveBn_.textContent=
143 "Save";this.saveBn_.addEventListener("click",this.onSave_.bind(this));this.loadBn_=document.createElement("button");this.loadBn_.textContent="Load";this.loadBn_.addEventListener("click",this.onLoad_.bind(this));if(cr.isChromeOS){this.systemTracingBn_=document.createElement("input");this.systemTracingBn_.type="checkbox";this.systemTracingBn_.checked=!0;var e=document.createElement("div");e.className="label";e.textContent="System events";e.appendChild(this.systemTracingBn_)}this.timelineView_=new tracing.TimelineView;
144 this.timelineView_.leftControls.appendChild(this.recordBn_);this.timelineView_.leftControls.appendChild(this.saveBn_);this.timelineView_.leftControls.appendChild(this.loadBn_);cr.isChromeOS&&this.timelineView_.leftControls.appendChild(this.systemTracingBn_);this.appendChild(this.timelineView_);document.addEventListener("keypress",this.onKeypress_.bind(this));this.refresh_()},didSetTracingController_:function(e,c){if(c)throw"Can only set tracing controller once.";this.tracingController_.addEventListener("traceEnded",
145 this.onRecordDone_.bind(this));this.tracingController_.addEventListener("loadTraceFileComplete",this.onLoadTraceFileComplete_.bind(this));this.tracingController_.addEventListener("saveTraceFileComplete",this.onSaveTraceFileComplete_.bind(this));this.tracingController_.addEventListener("loadTraceFileCanceled",this.onLoadTraceFileCanceled_.bind(this));this.tracingController_.addEventListener("saveTraceFileCanceled",this.onSaveTraceFileCanceled_.bind(this));this.refresh_()},refresh_:function(){if(this.tracingController_){var e=
150 var c=document.createElement("div");c.className="timeline-button find-previous";c.textContent="\u2190";c.addEventListener("click",function(){this.controller.findPrevious();this.updateHitCountEl_()}.bind(this));var e=document.createElement("div");e.className="timeline-button find-next";e.textContent="\u2192";e.addEventListener("click",function(){this.controller.findNext();this.updateHitCountEl_()}.bind(this));this.filterEl_=document.createElement("input");this.filterEl_.type="input";this.filterEl_.addEventListener("input",
151 function(){this.controller.filterText=this.filterEl_.value;this.updateHitCountEl_()}.bind(this));this.filterEl_.addEventListener("keydown",function(a){13==a.keyCode?e.click():27==a.keyCode&&(this.filterEl_.blur(),this.updateHitCountEl_())}.bind(this));this.filterEl_.addEventListeneraddEventListener("focus",function(){this.updateHitCountEl_()}.bind(this));this.appendChild(this.filterEl_);this.appendChild(c);this.appendChild(e);
157 this.rightControls.appendChild(this.findCtl_);this.controlDiv_.appendChild(this.titleEl_);this.controlDiv_.appendChild(this.leftControlsEl_);this.controlDiv_.appendChild(c);this.controlDiv_.appendChild(this.rightControlsEl_);this.appendChild(this.controlDiv_);this.appendChild(this.timelineContainer_);h.appendChild(this.analysisEl_);this.appendChild(h);this.rightControls.appendChild(this.createHelpButton_());this.onSelectionChangedBoundToThis_=this.onSelectionChanged_.bind(this);document.addEventListener("keypress",
158 this.onKeypress_.bind(this),!0)},createHelpButton_:function(){function c(a){if(e.visible&&(27==a.keyCode||63==a.keyCode))a.preventDefault(),document.removeEventListener("keydown",c),e.visible=!1}var e=new tracing.Overlay;e.classList.add("timeline-view-help-overlay");var a=document.createElement("div");a.className="timeline-button timeline-view-help-button";a.textContent="?";var b=document.createElement("div");b.style.whiteSpace="pre";b.style.fontFamily="monospace";a.addEventListener("click",function(){e.visible=
159 !0;b.textContent=this.timeline_.keyHelp;document.addEventListener("keydown",c,!0)}.bind(this));e.appendChild(b);return a},get leftControls(){return this.leftControlsEl_},get rightControls(){return this.rightControlsEl_},get title(){return this.titleEl_.textContent.substring(this.titleEl_.textContent.length-2)},set title(c){this.titleEl_.textContent=c+":"},set traceData(c){this.model=new tracing.TimelineModel(c)},get model(){return this.timelineModel_},set model(c){this.timelineModel_=c;this.timelineContainer_.textContent=
160 "";void 0!==this.timelineModel_.minTimestamp?(this.timeline_&&(this.timeline_.viewportTrack.detach(),this.timeline_.detach()),this.timeline_=new tracing.Timeline,this.timeline_.model=this.timelineModel_,this.timeline_.focusElement=this.focusElement_?this.focusElement_:this.parentElement,this.insertBefore(this.timeline_.viewportTrack,this.timelineContainer_),this.timelineContainer_.appendChild(this.timeline_),this.timeline_.addEventListener("selectionChange",this.onSelectionChangedBoundToThis_),this.findCtl_.controller.timeline=
162 0<=this.focusElement.tabIndex?document.activeElement==this.focusElement:!0},onKeypress_:function(c){this.listenToKeys_&&(47==event.keyCode?(this.findCtl_.focus(),event.preventDefault()):63==c.keyCode&&(this.querySelector(".timeline-view-help-button").click(),c.preventDefault()))},beginFind:function(){if(!this.findInProgress_){this.findInProgress_=!0;var c=e();c.controller=new g;c.controller.timeline=this.timeline;c.visible=!0;c.addEventListener("close",function(){this.findInProgress_=!1}.bind(this));
163 c.addEventListener("findNext",function(){});c.addEventListener("findPrevious",function(){})}},onSelectionChanged_:function(){var c=this.timelineContainer_.scrollTop;this.analysisEl_.selection=this.timeline_.selection;this.timelineContainer_.scrollTop=c}};return{TimelineFindControl:e,TimelineFindController:g,TimelineView:c}});