| OLD | NEW |
| 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 | 58 |
| 59 this._detailsLinkifier = new WebInspector.Linkifier(); | 59 this._detailsLinkifier = new WebInspector.Linkifier(); |
| 60 this._windowStartTime = 0; | 60 this._windowStartTime = 0; |
| 61 this._windowEndTime = Infinity; | 61 this._windowEndTime = Infinity; |
| 62 | 62 |
| 63 // Create model. | 63 // Create model. |
| 64 this._model = new WebInspector.TimelineModel(); | 64 this._model = new WebInspector.TimelineModel(); |
| 65 this._model.addEventListener(WebInspector.TimelineModel.Events.RecordingStar
ted, this._onRecordingStarted, this); | 65 this._model.addEventListener(WebInspector.TimelineModel.Events.RecordingStar
ted, this._onRecordingStarted, this); |
| 66 this._model.addEventListener(WebInspector.TimelineModel.Events.RecordingStop
ped, this._onRecordingStopped, this); | 66 this._model.addEventListener(WebInspector.TimelineModel.Events.RecordingStop
ped, this._onRecordingStopped, this); |
| 67 this._model.addEventListener(WebInspector.TimelineModel.Events.RecordsCleare
d, this._onRecordsCleared, this); | 67 this._model.addEventListener(WebInspector.TimelineModel.Events.RecordsCleare
d, this._onRecordsCleared, this); |
| 68 this._model.addEventListener(WebInspector.TimelineModel.Events.RecordFilterC
hanged, this._refreshViews, this); |
| 68 this._model.addEventListener(WebInspector.TimelineModel.Events.RecordAdded,
this._onRecordAdded, this); | 69 this._model.addEventListener(WebInspector.TimelineModel.Events.RecordAdded,
this._onRecordAdded, this); |
| 69 | 70 |
| 70 // Create presentation model. | 71 this._windowFilter = new WebInspector.TimelineWindowFilter(); |
| 71 this._presentationModel = new WebInspector.TimelinePresentationModel(this._m
odel); | 72 this._categoryFilter = new WebInspector.TimelineCategoryFilter(); |
| 72 this._durationFilter = new WebInspector.TimelineIsLongFilter(); | 73 this._durationFilter = new WebInspector.TimelineIsLongFilter(); |
| 73 this._windowFilter = new WebInspector.TimelineWindowFilter(); | 74 this._textFilter = new WebInspector.TimelineTextFilter(); |
| 74 this._presentationModel.addFilter(this._windowFilter); | 75 |
| 75 this._presentationModel.addFilter(new WebInspector.TimelineCategoryFilter())
; | 76 this._model.addFilter(new WebInspector.TimelineHiddenFilter()); |
| 76 this._presentationModel.addFilter(this._durationFilter); | 77 this._model.addFilter(this._windowFilter); |
| 78 this._model.addFilter(this._categoryFilter); |
| 79 this._model.addFilter(this._durationFilter); |
| 80 this._model.addFilter(this._textFilter); |
| 77 | 81 |
| 78 this._presentationModeSetting = WebInspector.settings.createSetting("timelin
eOverviewMode", WebInspector.TimelinePanel.Mode.Events); | 82 this._presentationModeSetting = WebInspector.settings.createSetting("timelin
eOverviewMode", WebInspector.TimelinePanel.Mode.Events); |
| 79 | 83 |
| 80 this._createStatusBarItems(); | 84 this._createStatusBarItems(); |
| 81 | 85 |
| 82 this._topPane = new WebInspector.SplitView(true, false); | 86 this._topPane = new WebInspector.SplitView(true, false); |
| 83 this._topPane.element.id = "timeline-overview-panel"; | 87 this._topPane.element.id = "timeline-overview-panel"; |
| 84 this._topPane.show(this.element); | 88 this._topPane.show(this.element); |
| 85 this._topPane.addEventListener(WebInspector.SplitView.Events.SidebarSizeChan
ged, this._sidebarResized, this); | 89 this._topPane.addEventListener(WebInspector.SplitView.Events.SidebarSizeChan
ged, this._sidebarResized, this); |
| 86 this._topPane.setResizable(false); | 90 this._topPane.setResizable(false); |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 * @param {number} windowEndTime | 206 * @param {number} windowEndTime |
| 203 */ | 207 */ |
| 204 requestWindowTimes: function(windowStartTime, windowEndTime) | 208 requestWindowTimes: function(windowStartTime, windowEndTime) |
| 205 { | 209 { |
| 206 this._overviewPane.requestWindowTimes(windowStartTime, windowEndTime); | 210 this._overviewPane.requestWindowTimes(windowStartTime, windowEndTime); |
| 207 }, | 211 }, |
| 208 | 212 |
| 209 /** | 213 /** |
| 210 * @return {!WebInspector.TimelineFrameModel} | 214 * @return {!WebInspector.TimelineFrameModel} |
| 211 */ | 215 */ |
| 212 frameModel: function() | 216 _frameModel: function() |
| 213 { | 217 { |
| 214 this._frameModel = this._frameModel || new WebInspector.TimelineFrameMod
el(this._model); | 218 if (!this._lazyFrameModel) |
| 215 return this._frameModel; | 219 this._lazyFrameModel = new WebInspector.TimelineFrameModel(this._mod
el); |
| 220 return this._lazyFrameModel; |
| 216 }, | 221 }, |
| 217 | 222 |
| 218 /** | 223 /** |
| 224 * @return {!WebInspector.TimelineView} |
| 225 */ |
| 226 _timelineView: function() |
| 227 { |
| 228 if (!this._lazyTimelineView) |
| 229 this._lazyTimelineView = new WebInspector.TimelineView(this, this._m
odel); |
| 230 return this._lazyTimelineView; |
| 231 }, |
| 232 |
| 233 /** |
| 219 * @param {string} mode | 234 * @param {string} mode |
| 220 */ | 235 */ |
| 221 _viewsForMode: function(mode) | 236 _viewsForMode: function(mode) |
| 222 { | 237 { |
| 223 var views = this._viewsMap[mode]; | 238 var views = this._viewsMap[mode]; |
| 224 if (!views) { | 239 if (!views) { |
| 225 views = {}; | 240 views = {}; |
| 226 switch (mode) { | 241 switch (mode) { |
| 227 case WebInspector.TimelinePanel.Mode.Events: | 242 case WebInspector.TimelinePanel.Mode.Events: |
| 228 views.overviewView = new WebInspector.TimelineEventOverview(this
._model); | 243 views.overviewView = new WebInspector.TimelineEventOverview(this
._model); |
| 229 views.mainViews = [new WebInspector.TimelineView(this, this._mod
el, this._presentationModel, null)]; | 244 this._timelineView().setFrameModel(null); |
| 245 views.mainViews = [this._timelineView()]; |
| 230 break; | 246 break; |
| 231 case WebInspector.TimelinePanel.Mode.Frames: | 247 case WebInspector.TimelinePanel.Mode.Frames: |
| 232 views.overviewView = new WebInspector.TimelineFrameOverview(this
._model, this.frameModel()); | 248 views.overviewView = new WebInspector.TimelineFrameOverview(this
._model, this._frameModel()); |
| 233 views.mainViews = [new WebInspector.TimelineView(this, this._mod
el, this._presentationModel, this.frameModel())]; | 249 this._timelineView().setFrameModel(this._frameModel()); |
| 250 views.mainViews = [this._timelineView()]; |
| 234 break; | 251 break; |
| 235 case WebInspector.TimelinePanel.Mode.Memory: | 252 case WebInspector.TimelinePanel.Mode.Memory: |
| 236 views.overviewView = new WebInspector.TimelineMemoryOverview(thi
s._model); | 253 views.overviewView = new WebInspector.TimelineMemoryOverview(thi
s._model); |
| 237 var timelineView = new WebInspector.TimelineView(this, this._mod
el, this._presentationModel, null); | 254 this._timelineView().setFrameModel(null); |
| 238 views.mainViews = [timelineView]; | 255 views.mainViews = [this._timelineView(), new WebInspector.Counte
rsGraph(this, this._model)]; |
| 239 var memoryStatistics = new WebInspector.CountersGraph(this, this
._model); | |
| 240 views.mainViews.push(memoryStatistics); | |
| 241 break; | 256 break; |
| 242 case WebInspector.TimelinePanel.Mode.FlameChart: | 257 case WebInspector.TimelinePanel.Mode.FlameChart: |
| 243 views.overviewView = new WebInspector.TimelineFrameOverview(this
._model, this.frameModel()); | 258 views.overviewView = new WebInspector.TimelineFrameOverview(this
._model, this._frameModel()); |
| 244 views.mainViews = [ | 259 views.mainViews = [ |
| 245 new WebInspector.TimelineFlameChart(this, this._model, this.
frameModel(), true), | 260 new WebInspector.TimelineFlameChart(this, this._model, this.
_frameModel(), true), |
| 246 new WebInspector.TimelineFlameChart(this, this._model, this.
frameModel(), false) | 261 new WebInspector.TimelineFlameChart(this, this._model, this.
_frameModel(), false) |
| 247 ]; | 262 ]; |
| 248 break; | 263 break; |
| 249 default: | 264 default: |
| 250 console.assert(false, "Unknown mode: " + mode); | 265 console.assert(false, "Unknown mode: " + mode); |
| 251 } | 266 } |
| 252 for (var i = 0; i < views.mainViews.length; ++i) | 267 for (var i = 0; i < views.mainViews.length; ++i) |
| 253 views.mainViews[i].addEventListener(WebInspector.SplitView.Event
s.SidebarSizeChanged, this._sidebarResized, this); | 268 views.mainViews[i].addEventListener(WebInspector.SplitView.Event
s.SidebarSizeChanged, this._sidebarResized, this); |
| 254 this._viewsMap[mode] = views; | 269 this._viewsMap[mode] = views; |
| 255 } | 270 } |
| 256 return views; | 271 return views; |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 this._filters._categoryFiltersUI[category.name] = filter; | 365 this._filters._categoryFiltersUI[category.name] = filter; |
| 351 filter.addEventListener(WebInspector.FilterUI.Events.FilterChanged,
this._categoriesFilterChanged.bind(this, categoryName), this); | 366 filter.addEventListener(WebInspector.FilterUI.Events.FilterChanged,
this._categoriesFilterChanged.bind(this, categoryName), this); |
| 352 this._filterBar.addFilter(filter); | 367 this._filterBar.addFilter(filter); |
| 353 } | 368 } |
| 354 return this._filterBar; | 369 return this._filterBar; |
| 355 }, | 370 }, |
| 356 | 371 |
| 357 _textFilterChanged: function(event) | 372 _textFilterChanged: function(event) |
| 358 { | 373 { |
| 359 var searchQuery = this._filters._textFilterUI.value(); | 374 var searchQuery = this._filters._textFilterUI.value(); |
| 360 this._presentationModel.setSearchFilter(null); | |
| 361 delete this._searchFilter; | |
| 362 | |
| 363 this.searchCanceled(); | 375 this.searchCanceled(); |
| 364 if (searchQuery) { | 376 this._textFilter.setRegex(searchQuery ? createPlainTextSearchRegex(searc
hQuery, "i") : null); |
| 365 this._searchFilter = new WebInspector.TimelineSearchFilter(createPla
inTextSearchRegex(searchQuery, "i")); | |
| 366 this._presentationModel.setSearchFilter(this._searchFilter); | |
| 367 } | |
| 368 this._refreshViews(); | |
| 369 }, | 377 }, |
| 370 | 378 |
| 371 _durationFilterChanged: function() | 379 _durationFilterChanged: function() |
| 372 { | 380 { |
| 373 var duration = this._filters._durationFilterUI.value(); | 381 var duration = this._filters._durationFilterUI.value(); |
| 374 var minimumRecordDuration = parseInt(duration, 10); | 382 var minimumRecordDuration = parseInt(duration, 10); |
| 375 this._durationFilter.setMinimumRecordDuration(minimumRecordDuration); | 383 this._durationFilter.setMinimumRecordDuration(minimumRecordDuration); |
| 376 this._refreshViews(); | |
| 377 }, | 384 }, |
| 378 | 385 |
| 379 _categoriesFilterChanged: function(name, event) | 386 _categoriesFilterChanged: function(name, event) |
| 380 { | 387 { |
| 381 var categories = WebInspector.TimelineUIUtils.categories(); | 388 var categories = WebInspector.TimelineUIUtils.categories(); |
| 382 categories[name].hidden = !this._filters._categoryFiltersUI[name].checke
d(); | 389 categories[name].hidden = !this._filters._categoryFiltersUI[name].checke
d(); |
| 383 this._refreshViews(); | 390 this._categoryFilter.notifyFilterChanged(); |
| 384 }, | 391 }, |
| 385 | 392 |
| 386 /** | 393 /** |
| 387 * @return {!Element} | 394 * @return {!Element} |
| 388 */ | 395 */ |
| 389 defaultFocusedElement: function() | 396 defaultFocusedElement: function() |
| 390 { | 397 { |
| 391 return this.element; | 398 return this.element; |
| 392 }, | 399 }, |
| 393 | 400 |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 498 { | 505 { |
| 499 if (!this._overviewItems[mode]) | 506 if (!this._overviewItems[mode]) |
| 500 mode = WebInspector.TimelinePanel.Mode.Events; | 507 mode = WebInspector.TimelinePanel.Mode.Events; |
| 501 this._overviewItems[mode].revealAndSelect(false); | 508 this._overviewItems[mode].revealAndSelect(false); |
| 502 }, | 509 }, |
| 503 | 510 |
| 504 _refreshViews: function() | 511 _refreshViews: function() |
| 505 { | 512 { |
| 506 for (var i = 0; i < this._currentViews.length; ++i) { | 513 for (var i = 0; i < this._currentViews.length; ++i) { |
| 507 var view = this._currentViews[i]; | 514 var view = this._currentViews[i]; |
| 508 view.refreshRecords(); | 515 view.refreshRecords(this._textFilter._regex); |
| 509 } | 516 } |
| 510 this._updateSelectionDetails(); | 517 this._updateSelectionDetails(); |
| 511 }, | 518 }, |
| 512 | 519 |
| 513 _onModeChanged: function(mode) | 520 _onModeChanged: function(mode) |
| 514 { | 521 { |
| 515 this.element.classList.remove("timeline-" + this._presentationModeSettin
g.get().toLowerCase() + "-view"); | 522 this.element.classList.remove("timeline-" + this._presentationModeSettin
g.get().toLowerCase() + "-view"); |
| 516 this._presentationModeSetting.set(mode); | 523 this._presentationModeSetting.set(mode); |
| 517 this.element.classList.add("timeline-" + mode.toLowerCase() + "-view"); | 524 this.element.classList.add("timeline-" + mode.toLowerCase() + "-view"); |
| 518 this._stackView.detachChildViews(); | 525 this._stackView.detachChildViews(); |
| 519 var views = this._viewsForMode(mode); | 526 var views = this._viewsForMode(mode); |
| 520 this._currentViews = views.mainViews; | 527 this._currentViews = views.mainViews; |
| 521 for (var i = 0; i < this._currentViews.length; ++i) { | 528 for (var i = 0; i < this._currentViews.length; ++i) { |
| 522 var view = this._currentViews[i]; | 529 var view = this._currentViews[i]; |
| 523 view.setWindowTimes(this.windowStartTime(), this.windowEndTime()); | 530 view.setWindowTimes(this.windowStartTime(), this.windowEndTime()); |
| 524 this._stackView.appendView(view, "timelinePanelTimelineStackSplitVie
wState"); | 531 this._stackView.appendView(view, "timelinePanelTimelineStackSplitVie
wState"); |
| 525 view.refreshRecords(); | 532 view.refreshRecords(this._textFilter._regex); |
| 526 } | 533 } |
| 527 this._overviewControl = views.overviewView; | 534 this._overviewControl = views.overviewView; |
| 528 this._overviewPane.setOverviewControl(this._overviewControl); | 535 this._overviewPane.setOverviewControl(this._overviewControl); |
| 529 this._updateSelectionDetails(); | 536 this._updateSelectionDetails(); |
| 530 }, | 537 }, |
| 531 | 538 |
| 532 /** | 539 /** |
| 533 * @param {boolean} userInitiated | 540 * @param {boolean} userInitiated |
| 534 */ | 541 */ |
| 535 _startRecording: function(userInitiated) | 542 _startRecording: function(userInitiated) |
| (...skipping 29 matching lines...) Expand all Loading... |
| 565 HeapProfilerAgent.collectGarbage(); | 572 HeapProfilerAgent.collectGarbage(); |
| 566 }, | 573 }, |
| 567 | 574 |
| 568 _onClearButtonClick: function() | 575 _onClearButtonClick: function() |
| 569 { | 576 { |
| 570 this._model.reset(); | 577 this._model.reset(); |
| 571 }, | 578 }, |
| 572 | 579 |
| 573 _onRecordsCleared: function() | 580 _onRecordsCleared: function() |
| 574 { | 581 { |
| 575 this._presentationModel.reset(); | |
| 576 this.requestWindowTimes(0, Infinity); | 582 this.requestWindowTimes(0, Infinity); |
| 577 this._windowFilter.reset(); | 583 this._windowFilter._reset(); |
| 578 if (this._frameModel) | 584 if (this._lazyFrameModel) |
| 579 this._frameModel.reset(); | 585 this._lazyFrameModel.reset(); |
| 580 for (var i = 0; i < this._currentViews.length; ++i) | 586 for (var i = 0; i < this._currentViews.length; ++i) |
| 581 this._currentViews[i].reset(); | 587 this._currentViews[i].reset(); |
| 582 this._overviewControl.reset(); | 588 this._overviewControl.reset(); |
| 583 this._updateSelectionDetails(); | 589 this._updateSelectionDetails(); |
| 584 }, | 590 }, |
| 585 | 591 |
| 586 _onRecordingStarted: function() | 592 _onRecordingStarted: function() |
| 587 { | 593 { |
| 588 this.toggleTimelineButton.title = WebInspector.UIString("Stop"); | 594 this.toggleTimelineButton.title = WebInspector.UIString("Stop"); |
| 589 this.toggleTimelineButton.toggled = true; | 595 this.toggleTimelineButton.toggled = true; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 603 _onRecordAdded: function(event) | 609 _onRecordAdded: function(event) |
| 604 { | 610 { |
| 605 this._addRecord(/** @type {!WebInspector.TimelineModel.Record} */(event.
data)); | 611 this._addRecord(/** @type {!WebInspector.TimelineModel.Record} */(event.
data)); |
| 606 }, | 612 }, |
| 607 | 613 |
| 608 /** | 614 /** |
| 609 * @param {!WebInspector.TimelineModel.Record} record | 615 * @param {!WebInspector.TimelineModel.Record} record |
| 610 */ | 616 */ |
| 611 _addRecord: function(record) | 617 _addRecord: function(record) |
| 612 { | 618 { |
| 613 this._presentationModel.addRecord(record); | 619 if (this._lazyFrameModel) |
| 614 if (this._frameModel) | 620 this._lazyFrameModel.addRecord(record); |
| 615 this._frameModel.addRecord(record); | |
| 616 for (var i = 0; i < this._currentViews.length; ++i) | 621 for (var i = 0; i < this._currentViews.length; ++i) |
| 617 this._currentViews[i].addRecord(record); | 622 this._currentViews[i].addRecord(record); |
| 618 this._overviewPane.addRecord(record); | 623 this._overviewPane.addRecord(record); |
| 619 | |
| 620 this._updateSearchHighlight(false, true); | 624 this._updateSearchHighlight(false, true); |
| 621 }, | 625 }, |
| 622 | 626 |
| 623 /** | 627 /** |
| 624 * @param {!WebInspector.Event} event | 628 * @param {!WebInspector.Event} event |
| 625 */ | 629 */ |
| 626 _willReloadPage: function(event) | 630 _willReloadPage: function(event) |
| 627 { | 631 { |
| 628 if (this._operationInProgress || this._userInitiatedRecording || !this.i
sShowing()) | 632 if (this._operationInProgress || this._userInitiatedRecording || !this.i
sShowing()) |
| 629 return; | 633 return; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 654 { | 658 { |
| 655 if (!this._searchResults || !this._searchResults.length) | 659 if (!this._searchResults || !this._searchResults.length) |
| 656 return; | 660 return; |
| 657 var index = this._selectedSearchResult ? this._searchResults.indexOf(thi
s._selectedSearchResult) : 0; | 661 var index = this._selectedSearchResult ? this._searchResults.indexOf(thi
s._selectedSearchResult) : 0; |
| 658 this._jumpToSearchResult(index - 1); | 662 this._jumpToSearchResult(index - 1); |
| 659 }, | 663 }, |
| 660 | 664 |
| 661 _jumpToSearchResult: function(index) | 665 _jumpToSearchResult: function(index) |
| 662 { | 666 { |
| 663 this._selectSearchResult((index + this._searchResults.length) % this._se
archResults.length); | 667 this._selectSearchResult((index + this._searchResults.length) % this._se
archResults.length); |
| 664 this._currentViews[0].highlightSearchResult(this._selectedSearchResult,
this._searchRegExp, true); | 668 this._currentViews[0].highlightSearchResult(this._selectedSearchResult,
this._searchRegex, true); |
| 665 }, | 669 }, |
| 666 | 670 |
| 667 _selectSearchResult: function(index) | 671 _selectSearchResult: function(index) |
| 668 { | 672 { |
| 669 this._selectedSearchResult = this._searchResults[index]; | 673 this._selectedSearchResult = this._searchResults[index]; |
| 670 this._searchableView.updateCurrentMatchIndex(index); | 674 this._searchableView.updateCurrentMatchIndex(index); |
| 671 }, | 675 }, |
| 672 | 676 |
| 673 _clearHighlight: function() | 677 _clearHighlight: function() |
| 674 { | 678 { |
| 675 this._currentViews[0].highlightSearchResult(null); | 679 this._currentViews[0].highlightSearchResult(null); |
| 676 }, | 680 }, |
| 677 | 681 |
| 678 /** | 682 /** |
| 679 * @param {boolean} revealRecord | 683 * @param {boolean} revealRecord |
| 680 * @param {boolean} shouldJump | 684 * @param {boolean} shouldJump |
| 681 */ | 685 */ |
| 682 _updateSearchHighlight: function(revealRecord, shouldJump) | 686 _updateSearchHighlight: function(revealRecord, shouldJump) |
| 683 { | 687 { |
| 684 if (this._searchFilter || !this._searchRegExp) { | 688 if (this._textFilter || !this._searchRegex) { |
| 685 this._clearHighlight(); | 689 this._clearHighlight(); |
| 686 return; | 690 return; |
| 687 } | 691 } |
| 688 | 692 |
| 689 if (!this._searchResults) | 693 if (!this._searchResults) |
| 690 this._updateSearchResults(shouldJump); | 694 this._updateSearchResults(shouldJump); |
| 691 this._currentViews[0].highlightSearchResult(this._selectedSearchResult,
this._searchRegExp, revealRecord); | 695 this._currentViews[0].highlightSearchResult(this._selectedSearchResult,
this._searchRegex, revealRecord); |
| 692 }, | 696 }, |
| 693 | 697 |
| 694 _updateSearchResults: function(shouldJump) | 698 _updateSearchResults: function(shouldJump) |
| 695 { | 699 { |
| 696 var searchRegExp = this._searchRegExp; | 700 var searchRegExp = this._searchRegex; |
| 697 if (!searchRegExp) | 701 if (!searchRegExp) |
| 698 return; | 702 return; |
| 699 | 703 |
| 700 var matches = []; | 704 var matches = []; |
| 701 var presentationModel = this._presentationModel; | |
| 702 | 705 |
| 703 /** | 706 /** |
| 704 * @param {!WebInspector.TimelineModel.Record} record | 707 * @param {!WebInspector.TimelineModel.Record} record |
| 705 */ | 708 */ |
| 706 function processRecord(record) | 709 function processRecord(record) |
| 707 { | 710 { |
| 708 if (presentationModel.isVisible(record) && record.testContentMatchin
g(searchRegExp)) | 711 if (record.testContentMatching(searchRegExp)) |
| 709 matches.push(record); | 712 matches.push(record); |
| 710 return false; | |
| 711 } | 713 } |
| 712 this._model.forAllRecords(processRecord); | 714 this._model.forAllFilteredRecords(processRecord); |
| 713 | 715 |
| 714 var matchesCount = matches.length; | 716 var matchesCount = matches.length; |
| 715 if (matchesCount) { | 717 if (matchesCount) { |
| 716 this._searchResults = matches; | 718 this._searchResults = matches; |
| 717 this._searchableView.updateSearchMatchesCount(matchesCount); | 719 this._searchableView.updateSearchMatchesCount(matchesCount); |
| 718 | 720 |
| 719 var selectedIndex = matches.indexOf(this._selectedSearchResult); | 721 var selectedIndex = matches.indexOf(this._selectedSearchResult); |
| 720 if (shouldJump && selectedIndex === -1) | 722 if (shouldJump && selectedIndex === -1) |
| 721 selectedIndex = 0; | 723 selectedIndex = 0; |
| 722 this._selectSearchResult(selectedIndex); | 724 this._selectSearchResult(selectedIndex); |
| 723 } else { | 725 } else { |
| 724 this._searchableView.updateSearchMatchesCount(0); | 726 this._searchableView.updateSearchMatchesCount(0); |
| 725 delete this._selectedSearchResult; | 727 delete this._selectedSearchResult; |
| 726 } | 728 } |
| 727 }, | 729 }, |
| 728 | 730 |
| 729 searchCanceled: function() | 731 searchCanceled: function() |
| 730 { | 732 { |
| 731 this._clearHighlight(); | 733 this._clearHighlight(); |
| 732 delete this._searchResults; | 734 delete this._searchResults; |
| 733 delete this._selectedSearchResult; | 735 delete this._selectedSearchResult; |
| 734 delete this._searchRegExp; | 736 delete this._searchRegex; |
| 735 }, | 737 }, |
| 736 | 738 |
| 737 /** | 739 /** |
| 738 * @param {string} query | 740 * @param {string} query |
| 739 * @param {boolean} shouldJump | 741 * @param {boolean} shouldJump |
| 740 */ | 742 */ |
| 741 performSearch: function(query, shouldJump) | 743 performSearch: function(query, shouldJump) |
| 742 { | 744 { |
| 743 this._searchRegExp = createPlainTextSearchRegex(query, "i"); | 745 this._searchRegex = createPlainTextSearchRegex(query, "i"); |
| 744 delete this._searchResults; | 746 delete this._searchResults; |
| 745 this._updateSearchHighlight(true, shouldJump); | 747 this._updateSearchHighlight(true, shouldJump); |
| 746 }, | 748 }, |
| 747 | 749 |
| 748 _updateSelectionDetails: function() | 750 _updateSelectionDetails: function() |
| 749 { | 751 { |
| 750 var startTime = this._windowStartTime; | 752 var startTime = this._windowStartTime; |
| 751 var endTime = this._windowEndTime; | 753 var endTime = this._windowEndTime; |
| 752 | 754 |
| 753 // Return early in case 0 selection window. | 755 // Return early in case 0 selection window. |
| (...skipping 27 matching lines...) Expand all Loading... |
| 781 if (!child.endTime || child.endTime < startTime || child.startTi
me > endTime) | 783 if (!child.endTime || child.endTime < startTime || child.startTi
me > endTime) |
| 782 continue; | 784 continue; |
| 783 childrenTime += Math.min(endTime, child.endTime) - Math.max(star
tTime, child.startTime); | 785 childrenTime += Math.min(endTime, child.endTime) - Math.max(star
tTime, child.startTime); |
| 784 aggregateTimeForRecordWithinWindow(child); | 786 aggregateTimeForRecordWithinWindow(child); |
| 785 } | 787 } |
| 786 var categoryName = WebInspector.TimelineUIUtils.categoryForRecord(re
cord).name; | 788 var categoryName = WebInspector.TimelineUIUtils.categoryForRecord(re
cord).name; |
| 787 var ownTime = Math.min(endTime, record.endTime) - Math.max(startTime
, record.startTime) - childrenTime; | 789 var ownTime = Math.min(endTime, record.endTime) - Math.max(startTime
, record.startTime) - childrenTime; |
| 788 aggregatedStats[categoryName] = (aggregatedStats[categoryName] || 0)
+ ownTime; | 790 aggregatedStats[categoryName] = (aggregatedStats[categoryName] || 0)
+ ownTime; |
| 789 } | 791 } |
| 790 | 792 |
| 791 var mainThreadTasks = this._presentationModel.mainThreadTasks(); | 793 var mainThreadTasks = this._model.mainThreadTasks(); |
| 792 var taskIndex = insertionIndexForObjectInListSortedByFunction(startTime,
mainThreadTasks, compareEndTime); | 794 var taskIndex = insertionIndexForObjectInListSortedByFunction(startTime,
mainThreadTasks, compareEndTime); |
| 793 for (; taskIndex < mainThreadTasks.length; ++taskIndex) { | 795 for (; taskIndex < mainThreadTasks.length; ++taskIndex) { |
| 794 var task = mainThreadTasks[taskIndex]; | 796 var task = mainThreadTasks[taskIndex]; |
| 795 if (task.startTime > endTime) | 797 if (task.startTime > endTime) |
| 796 break; | 798 break; |
| 797 aggregateTimeForRecordWithinWindow(task); | 799 aggregateTimeForRecordWithinWindow(task); |
| 798 } | 800 } |
| 799 | 801 |
| 800 var aggregatedTotal = 0; | 802 var aggregatedTotal = 0; |
| 801 for (var categoryName in aggregatedStats) | 803 for (var categoryName in aggregatedStats) |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 902 /** | 904 /** |
| 903 * @interface | 905 * @interface |
| 904 */ | 906 */ |
| 905 WebInspector.TimelineModeView = function() | 907 WebInspector.TimelineModeView = function() |
| 906 { | 908 { |
| 907 } | 909 } |
| 908 | 910 |
| 909 WebInspector.TimelineModeView.prototype = { | 911 WebInspector.TimelineModeView.prototype = { |
| 910 reset: function() {}, | 912 reset: function() {}, |
| 911 | 913 |
| 912 refreshRecords: function() {}, | 914 /** |
| 915 * @param {?RegExp} textFilter |
| 916 */ |
| 917 refreshRecords: function(textFilter) {}, |
| 913 | 918 |
| 914 /** | 919 /** |
| 915 * @param {!WebInspector.TimelineModel.Record} record | 920 * @param {!WebInspector.TimelineModel.Record} record |
| 916 */ | 921 */ |
| 917 addRecord: function(record) {}, | 922 addRecord: function(record) {}, |
| 918 | 923 |
| 919 /** | 924 /** |
| 920 * @param {?WebInspector.TimelineModel.Record} record | 925 * @param {?WebInspector.TimelineModel.Record} record |
| 921 * @param {string=} regex | 926 * @param {string=} regex |
| 922 * @param {boolean=} selectRecord | 927 * @param {boolean=} selectRecord |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 954 | 959 |
| 955 /** | 960 /** |
| 956 * @param {?WebInspector.TimelineModel.Record} record | 961 * @param {?WebInspector.TimelineModel.Record} record |
| 957 */ | 962 */ |
| 958 selectRecord: function(record) {}, | 963 selectRecord: function(record) {}, |
| 959 | 964 |
| 960 /** | 965 /** |
| 961 * @param {string} title | 966 * @param {string} title |
| 962 * @param {!Object} aggregatedStats | 967 * @param {!Object} aggregatedStats |
| 963 */ | 968 */ |
| 964 showAggregatedStatsInDetails: function(title, aggregatedStats) {} | 969 showAggregatedStatsInDetails: function(title, aggregatedStats) {}, |
| 965 } | 970 } |
| 966 | 971 |
| 967 /** | 972 /** |
| 968 * @constructor | 973 * @constructor |
| 969 * @implements {WebInspector.TimelinePresentationModel.Filter} | 974 * @extends {WebInspector.TimelineModel.Filter} |
| 970 */ | 975 */ |
| 971 WebInspector.TimelineCategoryFilter = function() | 976 WebInspector.TimelineCategoryFilter = function() |
| 972 { | 977 { |
| 978 WebInspector.TimelineModel.Filter.call(this); |
| 973 } | 979 } |
| 974 | 980 |
| 975 WebInspector.TimelineCategoryFilter.prototype = { | 981 WebInspector.TimelineCategoryFilter.prototype = { |
| 976 /** | 982 /** |
| 977 * @param {!WebInspector.TimelineModel.Record} record | 983 * @param {!WebInspector.TimelineModel.Record} record |
| 978 * @return {boolean} | 984 * @return {boolean} |
| 979 */ | 985 */ |
| 980 accept: function(record) | 986 accept: function(record) |
| 981 { | 987 { |
| 982 return !record.category.hidden; | 988 return !record.category.hidden; |
| 983 } | 989 }, |
| 990 |
| 991 __proto__: WebInspector.TimelineModel.Filter.prototype |
| 984 } | 992 } |
| 985 | 993 |
| 986 /** | 994 /** |
| 987 * @constructor | 995 * @constructor |
| 988 * @implements {WebInspector.TimelinePresentationModel.Filter} | 996 * @extends {WebInspector.TimelineModel.Filter} |
| 989 */ | 997 */ |
| 990 WebInspector.TimelineIsLongFilter = function() | 998 WebInspector.TimelineIsLongFilter = function() |
| 991 { | 999 { |
| 1000 WebInspector.TimelineModel.Filter.call(this); |
| 992 this._minimumRecordDuration = 0; | 1001 this._minimumRecordDuration = 0; |
| 993 } | 1002 } |
| 994 | 1003 |
| 995 WebInspector.TimelineIsLongFilter.prototype = { | 1004 WebInspector.TimelineIsLongFilter.prototype = { |
| 996 /** | 1005 /** |
| 997 * @param {number} value | 1006 * @param {number} value |
| 998 */ | 1007 */ |
| 999 setMinimumRecordDuration: function(value) | 1008 setMinimumRecordDuration: function(value) |
| 1000 { | 1009 { |
| 1001 this._minimumRecordDuration = value; | 1010 this._minimumRecordDuration = value; |
| 1011 this.notifyFilterChanged(); |
| 1002 }, | 1012 }, |
| 1003 | 1013 |
| 1004 /** | 1014 /** |
| 1005 * @param {!WebInspector.TimelineModel.Record} record | 1015 * @param {!WebInspector.TimelineModel.Record} record |
| 1006 * @return {boolean} | 1016 * @return {boolean} |
| 1007 */ | 1017 */ |
| 1008 accept: function(record) | 1018 accept: function(record) |
| 1009 { | 1019 { |
| 1010 return this._minimumRecordDuration ? ((record.lastChildEndTime - record.
startTime) >= this._minimumRecordDuration) : true; | 1020 return this._minimumRecordDuration ? ((record.lastChildEndTime - record.
startTime) >= this._minimumRecordDuration) : true; |
| 1011 } | 1021 }, |
| 1022 |
| 1023 __proto__: WebInspector.TimelineModel.Filter.prototype |
| 1024 |
| 1012 } | 1025 } |
| 1013 | 1026 |
| 1014 /** | 1027 /** |
| 1015 * @param {!RegExp} regExp | |
| 1016 * @constructor | 1028 * @constructor |
| 1017 * @implements {WebInspector.TimelinePresentationModel.Filter} | 1029 * @extends {WebInspector.TimelineModel.Filter} |
| 1018 */ | 1030 */ |
| 1019 WebInspector.TimelineSearchFilter = function(regExp) | 1031 WebInspector.TimelineTextFilter = function() |
| 1020 { | 1032 { |
| 1021 this._regExp = regExp; | 1033 WebInspector.TimelineModel.Filter.call(this); |
| 1022 } | 1034 } |
| 1023 | 1035 |
| 1024 WebInspector.TimelineSearchFilter.prototype = { | 1036 WebInspector.TimelineTextFilter.prototype = { |
| 1037 /** |
| 1038 * @param {?RegExp} regex |
| 1039 */ |
| 1040 setRegex: function(regex) |
| 1041 { |
| 1042 this._regex = regex; |
| 1043 this.notifyFilterChanged(); |
| 1044 }, |
| 1045 |
| 1025 /** | 1046 /** |
| 1026 * @param {!WebInspector.TimelineModel.Record} record | 1047 * @param {!WebInspector.TimelineModel.Record} record |
| 1027 * @return {boolean} | 1048 * @return {boolean} |
| 1028 */ | 1049 */ |
| 1029 accept: function(record) | 1050 accept: function(record) |
| 1030 { | 1051 { |
| 1031 return record.testContentMatching(this._regExp); | 1052 if (!this._regex) |
| 1032 } | 1053 return true; |
| 1054 |
| 1055 var accept = false; |
| 1056 /** |
| 1057 * @param {!WebInspector.TimelineModel.Record} record |
| 1058 * @return {boolean} |
| 1059 * @this {!WebInspector.TimelineTextFilter} |
| 1060 */ |
| 1061 function processRecord(record) |
| 1062 { |
| 1063 return record.testContentMatching(this._regex); |
| 1064 } |
| 1065 return WebInspector.TimelineModel.forAllRecords([record], processRecord.
bind(this)); |
| 1066 }, |
| 1067 |
| 1068 __proto__: WebInspector.TimelineModel.Filter.prototype |
| 1033 } | 1069 } |
| 1034 | 1070 |
| 1035 /** | 1071 /** |
| 1036 * @constructor | 1072 * @constructor |
| 1037 * @implements {WebInspector.TimelinePresentationModel.Filter} | 1073 * @extends {WebInspector.TimelineModel.Filter} |
| 1038 */ | 1074 */ |
| 1039 WebInspector.TimelineWindowFilter = function() | 1075 WebInspector.TimelineWindowFilter = function() |
| 1040 { | 1076 { |
| 1041 this.reset(); | 1077 WebInspector.TimelineModel.Filter.call(this); |
| 1078 this._reset(); |
| 1042 } | 1079 } |
| 1043 | 1080 |
| 1044 WebInspector.TimelineWindowFilter.prototype = { | 1081 WebInspector.TimelineWindowFilter.prototype = { |
| 1045 reset: function() | 1082 _reset: function() |
| 1046 { | 1083 { |
| 1047 this._windowStartTime = 0; | 1084 this._windowStartTime = 0; |
| 1048 this._windowEndTime = Infinity; | 1085 this._windowEndTime = Infinity; |
| 1049 }, | 1086 }, |
| 1050 | 1087 |
| 1051 setWindowTimes: function(windowStartTime, windowEndTime) | 1088 setWindowTimes: function(windowStartTime, windowEndTime) |
| 1052 { | 1089 { |
| 1053 this._windowStartTime = windowStartTime; | 1090 this._windowStartTime = windowStartTime; |
| 1054 this._windowEndTime = windowEndTime; | 1091 this._windowEndTime = windowEndTime; |
| 1092 this.notifyFilterChanged(); |
| 1055 }, | 1093 }, |
| 1056 | 1094 |
| 1057 /** | 1095 /** |
| 1058 * @param {!WebInspector.TimelineModel.Record} record | 1096 * @param {!WebInspector.TimelineModel.Record} record |
| 1059 * @return {boolean} | 1097 * @return {boolean} |
| 1060 */ | 1098 */ |
| 1061 accept: function(record) | 1099 accept: function(record) |
| 1062 { | 1100 { |
| 1063 return record.lastChildEndTime >= this._windowStartTime && record.startT
ime <= this._windowEndTime; | 1101 return record.lastChildEndTime >= this._windowStartTime && record.startT
ime <= this._windowEndTime; |
| 1064 } | 1102 }, |
| 1103 |
| 1104 __proto__: WebInspector.TimelineModel.Filter.prototype |
| 1065 } | 1105 } |
| 1106 |
| 1107 /** |
| 1108 * @constructor |
| 1109 * @extends {WebInspector.TimelineModel.Filter} |
| 1110 */ |
| 1111 WebInspector.TimelineHiddenFilter = function() |
| 1112 { |
| 1113 WebInspector.TimelineModel.Filter.call(this); |
| 1114 this._hiddenRecords = {}; |
| 1115 this._hiddenRecords[WebInspector.TimelineModel.RecordType.MarkDOMContent] =
1; |
| 1116 this._hiddenRecords[WebInspector.TimelineModel.RecordType.MarkLoad] = 1; |
| 1117 this._hiddenRecords[WebInspector.TimelineModel.RecordType.MarkFirstPaint] =
1; |
| 1118 this._hiddenRecords[WebInspector.TimelineModel.RecordType.GPUTask] = 1; |
| 1119 this._hiddenRecords[WebInspector.TimelineModel.RecordType.ScheduleStyleRecal
culation] = 1; |
| 1120 this._hiddenRecords[WebInspector.TimelineModel.RecordType.InvalidateLayout]
= 1; |
| 1121 this._hiddenRecords[WebInspector.TimelineModel.RecordType.RequestMainThreadF
rame] = 1; |
| 1122 this._hiddenRecords[WebInspector.TimelineModel.RecordType.ActivateLayerTree]
= 1; |
| 1123 this._hiddenRecords[WebInspector.TimelineModel.RecordType.DrawFrame] = 1; |
| 1124 this._hiddenRecords[WebInspector.TimelineModel.RecordType.BeginFrame] = 1; |
| 1125 } |
| 1126 |
| 1127 WebInspector.TimelineHiddenFilter.prototype = { |
| 1128 /** |
| 1129 * @param {!WebInspector.TimelineModel.Record} record |
| 1130 * @return {boolean} |
| 1131 */ |
| 1132 accept: function(record) |
| 1133 { |
| 1134 return !this._hiddenRecords[record.type]; |
| 1135 }, |
| 1136 |
| 1137 __proto__: WebInspector.TimelineModel.Filter.prototype |
| 1138 } |
| OLD | NEW |