Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(216)

Side by Side Diff: Source/devtools/front_end/TimelinePanel.js

Issue 184823002: DevTools: do not cache details node, remove linkifier from presentation record. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Review comments addressed. Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * Copyright (C) 2012 Intel Inc. All rights reserved. 3 * Copyright (C) 2012 Intel Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 * @implements {WebInspector.TimelineModeViewDelegate} 49 * @implements {WebInspector.TimelineModeViewDelegate}
50 * @implements {WebInspector.Searchable} 50 * @implements {WebInspector.Searchable}
51 */ 51 */
52 WebInspector.TimelinePanel = function() 52 WebInspector.TimelinePanel = function()
53 { 53 {
54 WebInspector.Panel.call(this, "timeline"); 54 WebInspector.Panel.call(this, "timeline");
55 this.registerRequiredCSS("timelinePanel.css"); 55 this.registerRequiredCSS("timelinePanel.css");
56 this.registerRequiredCSS("filter.css"); 56 this.registerRequiredCSS("filter.css");
57 this.element.addEventListener("contextmenu", this._contextMenu.bind(this), f alse); 57 this.element.addEventListener("contextmenu", this._contextMenu.bind(this), f alse);
58 58
59 this._detailsLinkifier = new WebInspector.Linkifier();
59 this._windowStartTime = 0; 60 this._windowStartTime = 0;
60 this._windowEndTime = Infinity; 61 this._windowEndTime = Infinity;
61 62
62 // Create model. 63 // Create model.
63 this._model = new WebInspector.TimelineModel(); 64 this._model = new WebInspector.TimelineModel();
64 this._model.addEventListener(WebInspector.TimelineModel.Events.RecordingStar ted, this._onRecordingStarted, this); 65 this._model.addEventListener(WebInspector.TimelineModel.Events.RecordingStar ted, this._onRecordingStarted, this);
65 this._model.addEventListener(WebInspector.TimelineModel.Events.RecordingStop ped, this._onRecordingStopped, this); 66 this._model.addEventListener(WebInspector.TimelineModel.Events.RecordingStop ped, this._onRecordingStopped, this);
66 this._model.addEventListener(WebInspector.TimelineModel.Events.RecordsCleare d, this._onRecordsCleared, this); 67 this._model.addEventListener(WebInspector.TimelineModel.Events.RecordsCleare d, this._onRecordsCleared, this);
67 this._model.addEventListener(WebInspector.TimelineModel.Events.RecordAdded, this._onRecordAdded, this); 68 this._model.addEventListener(WebInspector.TimelineModel.Events.RecordAdded, this._onRecordAdded, this);
68 69
(...skipping 742 matching lines...) Expand 10 before | Expand all | Expand 10 after
811 var endOffset = endTime - this._model.minimumRecordTime(); 812 var endOffset = endTime - this._model.minimumRecordTime();
812 var title = WebInspector.UIString("%s \u2013 %s", Number.millisToString( startOffset), Number.millisToString(endOffset)); 813 var title = WebInspector.UIString("%s \u2013 %s", Number.millisToString( startOffset), Number.millisToString(endOffset));
813 this._detailsView.setContent(title, fragment); 814 this._detailsView.setContent(title, fragment);
814 }, 815 },
815 816
816 /** 817 /**
817 * @param {?WebInspector.TimelinePresentationModel.Record} record 818 * @param {?WebInspector.TimelinePresentationModel.Record} record
818 */ 819 */
819 selectRecord: function(record) 820 selectRecord: function(record)
820 { 821 {
822 this._detailsLinkifier.reset();
823
821 if (!record) { 824 if (!record) {
822 this._updateSelectionDetails(); 825 this._updateSelectionDetails();
823 return; 826 return;
824 } 827 }
825 828
826 for (var i = 0; i < this._currentViews.length; ++i) { 829 for (var i = 0; i < this._currentViews.length; ++i) {
827 var view = this._currentViews[i]; 830 var view = this._currentViews[i];
828 view.setSelectedRecord(record); 831 view.setSelectedRecord(record);
829 } 832 }
830 if (!record) { 833 if (!record) {
831 this._updateSelectionDetails(); 834 this._updateSelectionDetails();
832 return; 835 return;
833 } 836 }
834 record.generatePopupContent(showCallback.bind(this)); 837 record.generatePopupContent(this._detailsLinkifier, showCallback.bind(th is));
835 838
836 /** 839 /**
837 * @param {!DocumentFragment} element 840 * @param {!DocumentFragment} element
838 * @this {WebInspector.TimelinePanel} 841 * @this {WebInspector.TimelinePanel}
839 */ 842 */
840 function showCallback(element) 843 function showCallback(element)
841 { 844 {
842 this._detailsView.setContent(record.title, element); 845 this._detailsView.setContent(record.title(), element);
843 } 846 }
844 }, 847 },
845 848
846 __proto__: WebInspector.Panel.prototype 849 __proto__: WebInspector.Panel.prototype
847 } 850 }
848 851
849 /** 852 /**
850 * @constructor 853 * @constructor
851 * @extends {WebInspector.View} 854 * @extends {WebInspector.View}
852 */ 855 */
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
1043 1046
1044 /** 1047 /**
1045 * @param {!WebInspector.TimelinePresentationModel.Record} record 1048 * @param {!WebInspector.TimelinePresentationModel.Record} record
1046 * @return {boolean} 1049 * @return {boolean}
1047 */ 1050 */
1048 accept: function(record) 1051 accept: function(record)
1049 { 1052 {
1050 return record.lastChildEndTime >= this._windowStartTime && record.startT ime <= this._windowEndTime; 1053 return record.lastChildEndTime >= this._windowStartTime && record.startT ime <= this._windowEndTime;
1051 } 1054 }
1052 } 1055 }
OLDNEW
« no previous file with comments | « LayoutTests/inspector/timeline/timeline-node-reference.html ('k') | Source/devtools/front_end/TimelinePresentationModel.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698