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

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

Issue 321113003: Fix exception when selecting record in timeline based on trace events (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 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
« no previous file with comments | « no previous file | Source/devtools/front_end/timeline/TracingTimelineModel.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 946 matching lines...) Expand 10 before | Expand all | Expand 10 after
957 957
958 _updateSelectionDetails: function() 958 _updateSelectionDetails: function()
959 { 959 {
960 if (!this._selection) { 960 if (!this._selection) {
961 this._updateSelectedRangeStats(); 961 this._updateSelectedRangeStats();
962 return; 962 return;
963 } 963 }
964 switch (this._selection.type()) { 964 switch (this._selection.type()) {
965 case WebInspector.TimelineSelection.Type.Record: 965 case WebInspector.TimelineSelection.Type.Record:
966 var record = /** @type {!WebInspector.TimelineModel.Record} */ (this ._selection.object()); 966 var record = /** @type {!WebInspector.TimelineModel.Record} */ (this ._selection.object());
967 WebInspector.TimelineUIUtils.generatePopupContent(record, this._mode l, this._detailsLinkifier, this.showInDetails.bind(this, record.title()), this._ model.loadedFromFile()); 967 if (this._tracingTimelineModel) {
968 var event = this._tracingTimelineModel.traceEventFrom(record);
969 this._buildSelectionDetailsForTraceEvent(event);
970 } else {
971 WebInspector.TimelineUIUtils.generatePopupContent(record, this._ model, this._detailsLinkifier, this.showInDetails.bind(this, record.title()), th is._model.loadedFromFile());
972 }
968 break; 973 break;
969 case WebInspector.TimelineSelection.Type.TraceEvent: 974 case WebInspector.TimelineSelection.Type.TraceEvent:
970 var event = /** @type {!WebInspector.TracingModel.Event} */ (this._s election.object()); 975 var event = /** @type {!WebInspector.TracingModel.Event} */ (this._s election.object());
971 var title = WebInspector.TimelineUIUtils.styleForTimelineEvent(event .name).title; 976 this._buildSelectionDetailsForTraceEvent(event);
972 var tracingModel = this._tracingTimelineModel;
973 WebInspector.TracingTimelineUIUtils.buildTraceEventDetails(event, tr acingModel, this._detailsLinkifier, this.showInDetails.bind(this, title), false, this._model.target());
974 break; 977 break;
975 case WebInspector.TimelineSelection.Type.Frame: 978 case WebInspector.TimelineSelection.Type.Frame:
976 var frame = /** @type {!WebInspector.TimelineFrame} */ (this._select ion.object()); 979 var frame = /** @type {!WebInspector.TimelineFrame} */ (this._select ion.object());
977 if (frame.layerTree) { 980 if (frame.layerTree) {
978 var layersView = this._layersView(); 981 var layersView = this._layersView();
979 layersView.showLayerTree(frame.layerTree); 982 layersView.showLayerTree(frame.layerTree);
980 this._detailsView.setChildView(WebInspector.UIString("Frame Laye rs"), layersView); 983 this._detailsView.setChildView(WebInspector.UIString("Frame Laye rs"), layersView);
981 } else { 984 } else {
982 this.showInDetails(WebInspector.UIString("Frame Statistics"), We bInspector.TimelineUIUtils.generatePopupContentForFrame(this._lazyFrameModel, fr ame)); 985 this.showInDetails(WebInspector.UIString("Frame Statistics"), We bInspector.TimelineUIUtils.generatePopupContentForFrame(this._lazyFrameModel, fr ame));
983 } 986 }
984 break; 987 break;
985 } 988 }
986 }, 989 },
987 990
991 /**
992 * @param {!WebInspector.TracingModel.Event} event
993 */
994 _buildSelectionDetailsForTraceEvent: function(event)
995 {
996 var title = WebInspector.TimelineUIUtils.styleForTimelineEvent(event.nam e).title;
997 WebInspector.TracingTimelineUIUtils.buildTraceEventDetails(event, this._ tracingTimelineModel, this._detailsLinkifier, this.showInDetails.bind(this, titl e), false, this._model.target());
998 },
999
988 _updateSelectedRangeStats: function() 1000 _updateSelectedRangeStats: function()
989 { 1001 {
990 if (this._selection) 1002 if (this._selection)
991 return; 1003 return;
992 1004
993 var startTime = this._windowStartTime; 1005 var startTime = this._windowStartTime;
994 var endTime = this._windowEndTime; 1006 var endTime = this._windowEndTime;
995 1007
996 // Return early in case 0 selection window. 1008 // Return early in case 0 selection window.
997 if (startTime < 0) 1009 if (startTime < 0)
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
1423 * @param {!WebInspector.TimelineModel.Record} record 1435 * @param {!WebInspector.TimelineModel.Record} record
1424 * @return {boolean} 1436 * @return {boolean}
1425 */ 1437 */
1426 accept: function(record) 1438 accept: function(record)
1427 { 1439 {
1428 return !this._hiddenRecords[record.type()]; 1440 return !this._hiddenRecords[record.type()];
1429 }, 1441 },
1430 1442
1431 __proto__: WebInspector.TimelineModel.Filter.prototype 1443 __proto__: WebInspector.TimelineModel.Filter.prototype
1432 } 1444 }
OLDNEW
« no previous file with comments | « no previous file | Source/devtools/front_end/timeline/TracingTimelineModel.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698