Chromium Code Reviews| 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 26 matching lines...) Expand all Loading... | |
| 37 importScript("TimelineFrameController.js"); | 37 importScript("TimelineFrameController.js"); |
| 38 | 38 |
| 39 /** | 39 /** |
| 40 * @constructor | 40 * @constructor |
| 41 * @extends {WebInspector.Panel} | 41 * @extends {WebInspector.Panel} |
| 42 */ | 42 */ |
| 43 WebInspector.TimelinePanel = function() | 43 WebInspector.TimelinePanel = function() |
| 44 { | 44 { |
| 45 WebInspector.Panel.call(this, "timeline"); | 45 WebInspector.Panel.call(this, "timeline"); |
| 46 this.registerRequiredCSS("timelinePanel.css"); | 46 this.registerRequiredCSS("timelinePanel.css"); |
| 47 this.registerRequiredCSS("filter.css"); | |
|
pfeldman
2013/10/22 15:15:01
This makes me think it belongs to FilterBarUI
| |
| 47 this.element.addStyleClass("vbox"); | 48 this.element.addStyleClass("vbox"); |
| 48 | 49 |
| 49 this._model = new WebInspector.TimelineModel(); | 50 this._model = new WebInspector.TimelineModel(); |
| 50 this._presentationModel = new WebInspector.TimelinePresentationModel(); | 51 this._presentationModel = new WebInspector.TimelinePresentationModel(); |
| 51 | 52 |
| 52 this._overviewModeSetting = WebInspector.settings.createSetting("timelineOve rviewMode", WebInspector.TimelineOverviewPane.Mode.Events); | 53 this._overviewModeSetting = WebInspector.settings.createSetting("timelineOve rviewMode", WebInspector.TimelineOverviewPane.Mode.Events); |
| 53 this._glueRecordsSetting = WebInspector.settings.createSetting("timelineGlue Records", false); | 54 this._glueRecordsSetting = WebInspector.settings.createSetting("timelineGlue Records", false); |
| 54 | 55 |
| 56 this._createFilters(); | |
| 57 | |
| 55 this._overviewPane = new WebInspector.TimelineOverviewPane(this._model); | 58 this._overviewPane = new WebInspector.TimelineOverviewPane(this._model); |
| 56 this._overviewPane.addEventListener(WebInspector.TimelineOverviewPane.Events .WindowChanged, this._invalidateAndScheduleRefresh.bind(this, false, true)); | 59 this._overviewPane.addEventListener(WebInspector.TimelineOverviewPane.Events .WindowChanged, this._invalidateAndScheduleRefresh.bind(this, false, true)); |
| 57 this._overviewPane.addEventListener(WebInspector.TimelineOverviewPane.Events .ModeChanged, this._overviewModeChanged, this); | 60 this._overviewPane.addEventListener(WebInspector.TimelineOverviewPane.Events .ModeChanged, this._overviewModeChanged, this); |
| 58 this._overviewPane.show(this.element); | 61 this._overviewPane.show(this.element); |
| 59 | 62 |
| 60 this.element.addEventListener("contextmenu", this._contextMenu.bind(this), f alse); | 63 this.element.addEventListener("contextmenu", this._contextMenu.bind(this), f alse); |
| 61 | 64 |
| 62 this.createSidebarViewWithTree(); | 65 this.createSidebarViewWithTree(); |
| 63 | 66 |
| 64 this._containerElement = this.splitView.element; | 67 this._containerElement = this.splitView.element; |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 204 this._memoryStatistics.setHeight(height); | 207 this._memoryStatistics.setHeight(height); |
| 205 }, | 208 }, |
| 206 | 209 |
| 207 get calculator() | 210 get calculator() |
| 208 { | 211 { |
| 209 return this._calculator; | 212 return this._calculator; |
| 210 }, | 213 }, |
| 211 | 214 |
| 212 get statusBarItems() | 215 get statusBarItems() |
| 213 { | 216 { |
| 214 return this._statusBarItems.select("element").concat([ | 217 return this._statusBarItems; |
| 215 this._miscStatusBarItems | |
| 216 ]); | |
| 217 }, | 218 }, |
| 218 | 219 |
| 219 defaultFocusedElement: function() | 220 defaultFocusedElement: function() |
| 220 { | 221 { |
| 221 return this.element; | 222 return this.element; |
| 222 }, | 223 }, |
| 223 | 224 |
| 225 _createFilters: function() | |
| 226 { | |
| 227 this._filterController = new WebInspector.FilterController(); | |
| 228 this._filtersContainer = this.element.createChild("div", "timeline-filte rs-header hidden"); | |
| 229 this._filtersContainer.appendChild(this._filterController.filtersElement ()); | |
| 230 this._filterController.addEventListener(WebInspector.FilterController.Ev ents.FiltersToggled, this._onFiltersToggled, this); | |
| 231 | |
| 232 this._textFilter = new WebInspector.TextFilter(); | |
| 233 this._textFilter.addEventListener(WebInspector.Filter.Events.FilterChang ed, this._textFilterChanged, this); | |
| 234 this._filterController.addFilter(this._textFilter); | |
| 235 | |
| 236 var durationOptions = []; | |
| 237 for (var presetIndex = 0; presetIndex < WebInspector.TimelinePanel.durat ionFilterPresetsMs.length; ++presetIndex) { | |
| 238 var durationMs = WebInspector.TimelinePanel.durationFilterPresetsMs[ presetIndex]; | |
| 239 var durationOption = {}; | |
| 240 if (!durationMs) { | |
| 241 durationOption.label = WebInspector.UIString("All"); | |
| 242 durationOption.title = WebInspector.UIString("Show all records") ; | |
| 243 } else { | |
| 244 durationOption.label = WebInspector.UIString("\u2265 %dms", dura tionMs); | |
| 245 durationOption.title = WebInspector.UIString("Hide records short er than %dms", durationMs); | |
| 246 } | |
| 247 durationOption.value = durationMs; | |
| 248 durationOptions.push(durationOption); | |
| 249 } | |
| 250 this._durationComboBoxFilter = new WebInspector.ComboBoxFilter(durationO ptions); | |
| 251 this._durationComboBoxFilter.addEventListener(WebInspector.Filter.Events .FilterChanged, this._durationFilterChanged, this); | |
| 252 this._filterController.addFilter(this._durationComboBoxFilter); | |
| 253 | |
| 254 this._categoryFilters = {}; | |
| 255 var categoryTypes = []; | |
| 256 var categories = WebInspector.TimelinePresentationModel.categories(); | |
| 257 for (var categoryName in categories) { | |
| 258 var category = categories[categoryName]; | |
| 259 if (category.overviewStripGroupIndex < 0) | |
| 260 continue; | |
| 261 var filter = new WebInspector.CheckboxFilter(category.name, category .title, false); | |
| 262 filter.addEventListener(WebInspector.Filter.Events.FilterChanged, th is._categoriesFilterChanged.bind(this, category.name), this); | |
| 263 this._filterController.addFilter(filter); | |
| 264 this._categoryFilters[category.name] = filter; | |
| 265 } | |
| 266 }, | |
| 267 | |
| 224 _createStatusBarItems: function() | 268 _createStatusBarItems: function() |
| 225 { | 269 { |
| 226 this._statusBarItems = /** @type {!Array.<!WebInspector.StatusBarItem>} */ ([]); | 270 this._statusBarButtons = /** @type {!Array.<!WebInspector.StatusBarItem> } */ ([]); |
| 271 this._statusBarItems = /** @type {!Array.<!Element>} */ ([]); | |
| 227 | 272 |
| 228 this.toggleTimelineButton = new WebInspector.StatusBarButton(WebInspecto r.UIString("Record"), "record-profile-status-bar-item"); | 273 this.toggleTimelineButton = new WebInspector.StatusBarButton(WebInspecto r.UIString("Record"), "record-profile-status-bar-item"); |
| 229 this.toggleTimelineButton.addEventListener("click", this._toggleTimeline ButtonClicked, this); | 274 this.toggleTimelineButton.addEventListener("click", this._toggleTimeline ButtonClicked, this); |
| 230 this._statusBarItems.push(this.toggleTimelineButton); | 275 this._statusBarButtons.push(this.toggleTimelineButton); |
| 276 this._statusBarItems.push(this.toggleTimelineButton.element); | |
| 277 | |
| 278 this._statusBarItems.push(this._filterController.filterButton()); | |
| 231 | 279 |
| 232 this.clearButton = new WebInspector.StatusBarButton(WebInspector.UIStrin g("Clear"), "clear-status-bar-item"); | 280 this.clearButton = new WebInspector.StatusBarButton(WebInspector.UIStrin g("Clear"), "clear-status-bar-item"); |
| 233 this.clearButton.addEventListener("click", this._clearPanel, this); | 281 this.clearButton.addEventListener("click", this._clearPanel, this); |
| 234 this._statusBarItems.push(this.clearButton); | 282 this._statusBarButtons.push(this.clearButton); |
| 283 this._statusBarItems.push(this.clearButton.element); | |
| 235 | 284 |
| 236 this.garbageCollectButton = new WebInspector.StatusBarButton(WebInspecto r.UIString("Collect Garbage"), "garbage-collect-status-bar-item"); | 285 this.garbageCollectButton = new WebInspector.StatusBarButton(WebInspecto r.UIString("Collect Garbage"), "garbage-collect-status-bar-item"); |
| 237 this.garbageCollectButton.addEventListener("click", this._garbageCollect ButtonClicked, this); | 286 this.garbageCollectButton.addEventListener("click", this._garbageCollect ButtonClicked, this); |
| 238 this._statusBarItems.push(this.garbageCollectButton); | 287 this._statusBarButtons.push(this.garbageCollectButton); |
| 288 this._statusBarItems.push(this.garbageCollectButton.element); | |
| 239 | 289 |
| 240 this._glueParentButton = new WebInspector.StatusBarButton(WebInspector.U IString("Glue asynchronous events to causes"), "glue-async-status-bar-item"); | 290 this._glueParentButton = new WebInspector.StatusBarButton(WebInspector.U IString("Glue asynchronous events to causes"), "glue-async-status-bar-item"); |
| 241 this._glueParentButton.toggled = this._glueRecordsSetting.get(); | 291 this._glueParentButton.toggled = this._glueRecordsSetting.get(); |
| 242 this._presentationModel.setGlueRecords(this._glueParentButton.toggled); | 292 this._presentationModel.setGlueRecords(this._glueParentButton.toggled); |
| 243 this._glueParentButton.addEventListener("click", this._glueParentButtonC licked, this); | 293 this._glueParentButton.addEventListener("click", this._glueParentButtonC licked, this); |
| 244 this._statusBarItems.push(this._glueParentButton); | 294 this._statusBarButtons.push(this._glueParentButton); |
| 295 this._statusBarItems.push(this._glueParentButton.element); | |
| 245 | 296 |
| 246 this._durationFilterSelector = new WebInspector.StatusBarComboBox(this._ durationFilterChanged.bind(this)); | 297 this._statusTextContainer = document.createElement("div"); |
| 247 for (var presetIndex = 0; presetIndex < WebInspector.TimelinePanel.durat ionFilterPresetsMs.length; ++presetIndex) { | 298 this._statusBarItems.push(this._statusTextContainer); |
| 248 var durationMs = WebInspector.TimelinePanel.durationFilterPresetsMs[ presetIndex]; | |
| 249 var option = document.createElement("option"); | |
| 250 if (!durationMs) { | |
| 251 option.text = WebInspector.UIString("All"); | |
| 252 option.title = WebInspector.UIString("Show all records"); | |
| 253 } else { | |
| 254 option.text = WebInspector.UIString("\u2265 %dms", durationMs); | |
| 255 option.title = WebInspector.UIString("Hide records shorter than %dms", durationMs); | |
| 256 } | |
| 257 option._durationMs = durationMs; | |
| 258 this._durationFilterSelector.addOption(option); | |
| 259 this._durationFilterSelector.element.title = this._durationFilterSel ector.selectedOption().title; | |
| 260 } | |
| 261 this._statusBarItems.push(this._durationFilterSelector); | |
| 262 | 299 |
| 263 this._miscStatusBarItems = document.createElement("div"); | 300 this.recordsCounter = new WebInspector.StatusBarText(""); |
| 264 this._miscStatusBarItems.className = "status-bar-items timeline-misc-sta tus-bar-items"; | 301 this._statusTextContainer.appendChild(this.recordsCounter.element); |
| 265 | 302 |
| 266 this._statusBarFilters = this._miscStatusBarItems.createChild("div", "ti meline-misc-status-bar-filters"); | 303 this.frameStatistics = this._statusTextContainer.createChild("div", "sta tus-bar-item status-bar-text hidden"); |
| 267 var categories = WebInspector.TimelinePresentationModel.categories(); | |
| 268 for (var categoryName in categories) { | |
| 269 var category = categories[categoryName]; | |
| 270 if (category.overviewStripGroupIndex < 0) | |
| 271 continue; | |
| 272 this._statusBarFilters.appendChild(this._createTimelineCategoryStatu sBarCheckbox(category)); | |
| 273 } | |
| 274 | |
| 275 var statsContainer = this._statusBarFilters.createChild("div", "timeline -records-stats-container"); | |
| 276 this.recordsCounter = statsContainer.createChild("div", "timeline-record s-stats"); | |
| 277 this.frameStatistics = statsContainer.createChild("div", "timeline-recor ds-stats hidden"); | |
| 278 | 304 |
| 279 function getAnchor() | 305 function getAnchor() |
| 280 { | 306 { |
| 281 return this.frameStatistics; | 307 return this.frameStatistics; |
| 282 } | 308 } |
| 283 this._frameStatisticsPopoverHelper = new WebInspector.PopoverHelper(this .frameStatistics, getAnchor.bind(this), this._showFrameStatistics.bind(this)); | 309 this._frameStatisticsPopoverHelper = new WebInspector.PopoverHelper(this .frameStatistics, getAnchor.bind(this), this._showFrameStatistics.bind(this)); |
| 310 | |
| 311 this._miscStatusBarItems = document.createElement("div"); | |
| 312 this._miscStatusBarItems.className = "status-bar-item"; | |
| 313 this._statusBarItems.push(this._miscStatusBarItems); | |
| 314 }, | |
| 315 | |
| 316 _textFilterChanged: function(event) | |
| 317 { | |
| 318 var searchQuery = this._textFilter.value(); | |
| 319 this._presentationModel.setSearchFilter(null); | |
| 320 delete this._searchFilter; | |
| 321 | |
| 322 function cleanRecord(record) | |
| 323 { | |
| 324 delete record.clicked; | |
| 325 } | |
| 326 WebInspector.TimelinePresentationModel.forAllRecords(this._presentationM odel.rootRecord().children, cleanRecord); | |
| 327 | |
| 328 this.searchCanceled(); | |
| 329 if (searchQuery) { | |
| 330 this._searchFilter = new WebInspector.TimelineSearchFilter(createPla inTextSearchRegex(searchQuery, "i")); | |
| 331 this._presentationModel.setSearchFilter(this._searchFilter); | |
| 332 } | |
| 333 this._invalidateAndScheduleRefresh(true, true); | |
| 334 }, | |
| 335 | |
| 336 _durationFilterChanged: function() | |
| 337 { | |
| 338 var duration = this._durationComboBoxFilter.value(); | |
| 339 var minimumRecordDuration = +duration / 1000.0; | |
| 340 this._durationFilter.setMinimumRecordDuration(minimumRecordDuration); | |
| 341 this._invalidateAndScheduleRefresh(true, true); | |
| 342 }, | |
| 343 | |
| 344 _categoriesFilterChanged: function(name, event) | |
| 345 { | |
| 346 var categories = WebInspector.TimelinePresentationModel.categories(); | |
| 347 categories[name].hidden = !this._categoryFilters[name].checked(); | |
| 348 this._invalidateAndScheduleRefresh(true, true); | |
| 349 }, | |
| 350 | |
| 351 _onFiltersToggled: function(event) | |
| 352 { | |
| 353 var toggled = /** @type {boolean} */ (event.data); | |
| 354 this._filtersContainer.enableStyleClass("hidden", !toggled); | |
| 284 }, | 355 }, |
| 285 | 356 |
| 286 /** | 357 /** |
| 287 * @param {WebInspector.TimelineCategory} category | |
| 288 */ | |
| 289 _createTimelineCategoryStatusBarCheckbox: function(category) | |
| 290 { | |
| 291 var labelContainer = document.createElement("div"); | |
| 292 labelContainer.addStyleClass("timeline-category-statusbar-item"); | |
| 293 labelContainer.addStyleClass("timeline-category-" + category.name); | |
| 294 labelContainer.addStyleClass("status-bar-item"); | |
| 295 | |
| 296 var label = labelContainer.createChild("label"); | |
| 297 var checkBorder = label.createChild("div", "timeline-category-checkbox") ; | |
| 298 var checkElement = checkBorder.createChild("div", "timeline-category-che ckbox-check timeline-category-checkbox-checked"); | |
| 299 checkElement.type = "checkbox"; | |
| 300 checkElement.checked = true; | |
| 301 labelContainer.addEventListener("click", listener.bind(this), false); | |
| 302 | |
| 303 function listener(event) | |
| 304 { | |
| 305 var checked = !checkElement.checked; | |
| 306 checkElement.checked = checked; | |
| 307 category.hidden = !checked; | |
| 308 checkElement.enableStyleClass("timeline-category-checkbox-checked", checkElement.checked); | |
| 309 this._invalidateAndScheduleRefresh(true, true); | |
| 310 } | |
| 311 | |
| 312 var typeElement = label.createChild("span", "type"); | |
| 313 typeElement.textContent = category.title; | |
| 314 | |
| 315 return labelContainer; | |
| 316 }, | |
| 317 | |
| 318 /** | |
| 319 * @param {?WebInspector.ProgressIndicator} indicator | 358 * @param {?WebInspector.ProgressIndicator} indicator |
| 320 */ | 359 */ |
| 321 _setOperationInProgress: function(indicator) | 360 _setOperationInProgress: function(indicator) |
| 322 { | 361 { |
| 323 this._operationInProgress = !!indicator; | 362 this._operationInProgress = !!indicator; |
| 324 for (var i = 0; i < this._statusBarItems.length; ++i) | 363 for (var i = 0; i < this._statusBarButtons.length; ++i) |
| 325 this._statusBarItems[i].setEnabled(!this._operationInProgress); | 364 this._statusBarButtons[i].setEnabled(!this._operationInProgress); |
| 326 this._glueParentButton.setEnabled(!this._operationInProgress && !this._f rameController); | 365 this._glueParentButton.setEnabled(!this._operationInProgress && !this._f rameController); |
| 366 this._statusTextContainer.enableStyleClass("hidden", !!indicator); | |
| 327 this._miscStatusBarItems.removeChildren(); | 367 this._miscStatusBarItems.removeChildren(); |
| 328 this._miscStatusBarItems.appendChild(indicator ? indicator.element : thi s._statusBarFilters); | 368 if (indicator) |
| 369 this._miscStatusBarItems.appendChild(indicator.element); | |
| 329 }, | 370 }, |
| 330 | 371 |
| 331 _registerShortcuts: function() | 372 _registerShortcuts: function() |
| 332 { | 373 { |
| 333 this.registerShortcuts(WebInspector.TimelinePanelDescriptor.ShortcutKeys .StartStopRecording, this._toggleTimelineButtonClicked.bind(this)); | 374 this.registerShortcuts(WebInspector.TimelinePanelDescriptor.ShortcutKeys .StartStopRecording, this._toggleTimelineButtonClicked.bind(this)); |
| 334 this.registerShortcuts(WebInspector.TimelinePanelDescriptor.ShortcutKeys .SaveToFile, this._saveToFile.bind(this)); | 375 this.registerShortcuts(WebInspector.TimelinePanelDescriptor.ShortcutKeys .SaveToFile, this._saveToFile.bind(this)); |
| 335 this.registerShortcuts(WebInspector.TimelinePanelDescriptor.ShortcutKeys .LoadFromFile, this._selectFileToLoad.bind(this)); | 376 this.registerShortcuts(WebInspector.TimelinePanelDescriptor.ShortcutKeys .LoadFromFile, this._selectFileToLoad.bind(this)); |
| 336 }, | 377 }, |
| 337 | 378 |
| 338 _createFileSelector: function() | 379 _createFileSelector: function() |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 413 return progressIndicator; | 454 return progressIndicator; |
| 414 }, | 455 }, |
| 415 | 456 |
| 416 _rootRecord: function() | 457 _rootRecord: function() |
| 417 { | 458 { |
| 418 return this._presentationModel.rootRecord(); | 459 return this._presentationModel.rootRecord(); |
| 419 }, | 460 }, |
| 420 | 461 |
| 421 _updateRecordsCounter: function(recordsInWindowCount) | 462 _updateRecordsCounter: function(recordsInWindowCount) |
| 422 { | 463 { |
| 423 this.recordsCounter.textContent = WebInspector.UIString("%d of %d record s shown", recordsInWindowCount, this._allRecordsCount); | 464 this.recordsCounter.setText(WebInspector.UIString("%d of %d records show n", recordsInWindowCount, this._allRecordsCount)); |
| 424 }, | 465 }, |
| 425 | 466 |
| 426 _updateFrameStatistics: function(frames) | 467 _updateFrameStatistics: function(frames) |
| 427 { | 468 { |
| 428 if (frames.length) { | 469 if (frames.length) { |
| 429 this._lastFrameStatistics = new WebInspector.FrameStatistics(frames) ; | 470 this._lastFrameStatistics = new WebInspector.FrameStatistics(frames) ; |
| 430 var details = WebInspector.UIString("avg: %s, \u03c3: %s", | 471 var details = WebInspector.UIString("avg: %s, \u03c3: %s", |
| 431 Number.secondsToString(this._lastFrameStatistics.average, true), Number.secondsToString(this._lastFrameStatistics.stddev, true)); | 472 Number.secondsToString(this._lastFrameStatistics.average, true), Number.secondsToString(this._lastFrameStatistics.stddev, true)); |
| 432 } else | 473 } else |
| 433 this._lastFrameStatistics = null; | 474 this._lastFrameStatistics = null; |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 527 var frameMode = mode === WebInspector.TimelineOverviewPane.Mode.Frames; | 568 var frameMode = mode === WebInspector.TimelineOverviewPane.Mode.Frames; |
| 528 this._overviewModeSetting.set(mode); | 569 this._overviewModeSetting.set(mode); |
| 529 if (frameMode !== this._frameMode) { | 570 if (frameMode !== this._frameMode) { |
| 530 this._frameMode = frameMode; | 571 this._frameMode = frameMode; |
| 531 this._glueParentButton.setEnabled(!frameMode); | 572 this._glueParentButton.setEnabled(!frameMode); |
| 532 this._presentationModel.setGlueRecords(this._glueParentButton.toggle d && !frameMode); | 573 this._presentationModel.setGlueRecords(this._glueParentButton.toggle d && !frameMode); |
| 533 this._repopulateRecords(); | 574 this._repopulateRecords(); |
| 534 | 575 |
| 535 if (frameMode) { | 576 if (frameMode) { |
| 536 this.element.addStyleClass("timeline-frame-overview"); | 577 this.element.addStyleClass("timeline-frame-overview"); |
| 537 this.recordsCounter.addStyleClass("hidden"); | 578 this.recordsCounter.element.addStyleClass("hidden"); |
| 538 this.frameStatistics.removeStyleClass("hidden"); | 579 this.frameStatistics.removeStyleClass("hidden"); |
| 539 this._frameController = new WebInspector.TimelineFrameController (this._model, this._overviewPane, this._presentationModel); | 580 this._frameController = new WebInspector.TimelineFrameController (this._model, this._overviewPane, this._presentationModel); |
| 540 } else { | 581 } else { |
| 541 this._frameController.dispose(); | 582 this._frameController.dispose(); |
| 542 this._frameController = null; | 583 this._frameController = null; |
| 543 this.element.removeStyleClass("timeline-frame-overview"); | 584 this.element.removeStyleClass("timeline-frame-overview"); |
| 544 this.recordsCounter.removeStyleClass("hidden"); | 585 this.recordsCounter.element.removeStyleClass("hidden"); |
| 545 this.frameStatistics.addStyleClass("hidden"); | 586 this.frameStatistics.addStyleClass("hidden"); |
| 546 } | 587 } |
| 547 } | 588 } |
| 548 if (shouldShowMemory === this._memoryStatistics.visible()) | 589 if (shouldShowMemory === this._memoryStatistics.visible()) |
| 549 return; | 590 return; |
| 550 this._timelineMemorySplitter.enableStyleClass("hidden", !shouldShowMemor y); | 591 this._timelineMemorySplitter.enableStyleClass("hidden", !shouldShowMemor y); |
| 551 if (!shouldShowMemory) { | 592 if (!shouldShowMemory) { |
| 552 this._memoryStatistics.hide(); | 593 this._memoryStatistics.hide(); |
| 553 this._resize(this.splitView.sidebarWidth()); | 594 this._resize(this.splitView.sidebarWidth()); |
| 554 } else { | 595 } else { |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 567 return true; | 608 return true; |
| 568 if (this.toggleTimelineButton.toggled) { | 609 if (this.toggleTimelineButton.toggled) { |
| 569 this._model.stopRecording(); | 610 this._model.stopRecording(); |
| 570 } else { | 611 } else { |
| 571 this._model.startRecording(this._includeDomCounters); | 612 this._model.startRecording(this._includeDomCounters); |
| 572 WebInspector.userMetrics.TimelineStarted.record(); | 613 WebInspector.userMetrics.TimelineStarted.record(); |
| 573 } | 614 } |
| 574 return true; | 615 return true; |
| 575 }, | 616 }, |
| 576 | 617 |
| 577 _durationFilterChanged: function() | |
| 578 { | |
| 579 var option = this._durationFilterSelector.selectedOption(); | |
| 580 var minimumRecordDuration = +option._durationMs / 1000.0; | |
| 581 this._durationFilter.setMinimumRecordDuration(minimumRecordDuration); | |
| 582 this._durationFilterSelector.element.title = option.title; | |
| 583 this._invalidateAndScheduleRefresh(true, true); | |
| 584 }, | |
| 585 | |
| 586 _garbageCollectButtonClicked: function() | 618 _garbageCollectButtonClicked: function() |
| 587 { | 619 { |
| 588 HeapProfilerAgent.collectGarbage(); | 620 HeapProfilerAgent.collectGarbage(); |
| 589 }, | 621 }, |
| 590 | 622 |
| 591 _glueParentButtonClicked: function() | 623 _glueParentButtonClicked: function() |
| 592 { | 624 { |
| 593 var newValue = !this._glueParentButton.toggled; | 625 var newValue = !this._glueParentButton.toggled; |
| 594 this._glueParentButton.toggled = newValue; | 626 this._glueParentButton.toggled = newValue; |
| 595 this._presentationModel.setGlueRecords(newValue); | 627 this._presentationModel.setGlueRecords(newValue); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 660 | 692 |
| 661 /** | 693 /** |
| 662 * @param {number} sidebarWidth | 694 * @param {number} sidebarWidth |
| 663 */ | 695 */ |
| 664 _resize: function(sidebarWidth) | 696 _resize: function(sidebarWidth) |
| 665 { | 697 { |
| 666 this._closeRecordDetails(); | 698 this._closeRecordDetails(); |
| 667 this._graphRowsElementWidth = this._graphRowsElement.offsetWidth; | 699 this._graphRowsElementWidth = this._graphRowsElement.offsetWidth; |
| 668 this._containerElementHeight = this._containerElement.clientHeight; | 700 this._containerElementHeight = this._containerElement.clientHeight; |
| 669 this._scheduleRefresh(false, true); | 701 this._scheduleRefresh(false, true); |
| 670 var lastItemElement = this._statusBarItems[this._statusBarItems.length - 1].element; | |
| 671 var minFloatingStatusBarItemsOffset = lastItemElement.offsetLeft + lastI temElement.offsetWidth; | |
| 672 this._miscStatusBarItems.style.left = Math.max(minFloatingStatusBarItems Offset, sidebarWidth) + "px"; | |
| 673 }, | 702 }, |
| 674 | 703 |
| 675 _clearPanel: function() | 704 _clearPanel: function() |
| 676 { | 705 { |
| 677 this._model.reset(); | 706 this._model.reset(); |
| 678 }, | 707 }, |
| 679 | 708 |
| 680 _onRecordsCleared: function() | 709 _onRecordsCleared: function() |
| 681 { | 710 { |
| 682 this._resetPanel(); | 711 this._resetPanel(); |
| (...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1234 | 1263 |
| 1235 searchCanceled: function() | 1264 searchCanceled: function() |
| 1236 { | 1265 { |
| 1237 this._clearHighlight(); | 1266 this._clearHighlight(); |
| 1238 delete this._searchResults; | 1267 delete this._searchResults; |
| 1239 delete this._selectedSearchResult; | 1268 delete this._selectedSearchResult; |
| 1240 delete this._searchRegExp; | 1269 delete this._searchRegExp; |
| 1241 }, | 1270 }, |
| 1242 | 1271 |
| 1243 /** | 1272 /** |
| 1244 * @return {boolean} | |
| 1245 */ | |
| 1246 canFilter: function() | |
| 1247 { | |
| 1248 return true; | |
| 1249 }, | |
| 1250 | |
| 1251 performFilter: function(searchQuery) | |
| 1252 { | |
| 1253 this._presentationModel.setSearchFilter(null); | |
| 1254 delete this._searchFilter; | |
| 1255 | |
| 1256 function cleanRecord(record) | |
| 1257 { | |
| 1258 delete record.clicked; | |
| 1259 } | |
| 1260 WebInspector.TimelinePresentationModel.forAllRecords(this._presentationM odel.rootRecord().children, cleanRecord); | |
| 1261 | |
| 1262 this.searchCanceled(); | |
| 1263 if (searchQuery) { | |
| 1264 this._searchFilter = new WebInspector.TimelineSearchFilter(createPla inTextSearchRegex(searchQuery, "i")); | |
| 1265 this._presentationModel.setSearchFilter(this._searchFilter); | |
| 1266 } | |
| 1267 this._invalidateAndScheduleRefresh(true, true); | |
| 1268 }, | |
| 1269 | |
| 1270 /** | |
| 1271 * @param {string} query | 1273 * @param {string} query |
| 1272 * @param {boolean} shouldJump | 1274 * @param {boolean} shouldJump |
| 1273 */ | 1275 */ |
| 1274 performSearch: function(query, shouldJump) | 1276 performSearch: function(query, shouldJump) |
| 1275 { | 1277 { |
| 1276 this._searchRegExp = createPlainTextSearchRegex(query, "i"); | 1278 this._searchRegExp = createPlainTextSearchRegex(query, "i"); |
| 1277 delete this._searchResults; | 1279 delete this._searchResults; |
| 1278 this._updateSearchHighlight(true, shouldJump); | 1280 this._updateSearchHighlight(true, shouldJump); |
| 1279 }, | 1281 }, |
| 1280 | 1282 |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1614 | 1616 |
| 1615 /** | 1617 /** |
| 1616 * @param {!WebInspector.TimelinePresentationModel.Record} record | 1618 * @param {!WebInspector.TimelinePresentationModel.Record} record |
| 1617 * @return {boolean} | 1619 * @return {boolean} |
| 1618 */ | 1620 */ |
| 1619 accept: function(record) | 1621 accept: function(record) |
| 1620 { | 1622 { |
| 1621 return WebInspector.TimelineRecordListRow.testContentMatching(record, th is._regExp); | 1623 return WebInspector.TimelineRecordListRow.testContentMatching(record, th is._regExp); |
| 1622 } | 1624 } |
| 1623 } | 1625 } |
| OLD | NEW |