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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/network/NetworkPanel.js

Issue 2608043002: DevTools: extract modules (with extensions) (Closed)
Patch Set: fixes Created 3 years, 11 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2008, 2009 Anthony Ricaud <rik@webkit.org> 3 * Copyright (C) 2008, 2009 Anthony Ricaud <rik@webkit.org>
4 * Copyright (C) 2011 Google Inc. All rights reserved. 4 * Copyright (C) 2011 Google Inc. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 9 *
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 /** @type {?Components.FilmStripView} */ 46 /** @type {?Components.FilmStripView} */
47 this._filmStripView = null; 47 this._filmStripView = null;
48 /** @type {?Network.NetworkPanel.FilmStripRecorder} */ 48 /** @type {?Network.NetworkPanel.FilmStripRecorder} */
49 this._filmStripRecorder = null; 49 this._filmStripRecorder = null;
50 50
51 this._panelToolbar = new UI.Toolbar('', this.element); 51 this._panelToolbar = new UI.Toolbar('', this.element);
52 this._filterBar = new UI.FilterBar('networkPanel', true); 52 this._filterBar = new UI.FilterBar('networkPanel', true);
53 this._filterBar.show(this.element); 53 this._filterBar.show(this.element);
54 54
55 // Create top overview component. 55 // Create top overview component.
56 this._overviewPane = new UI.TimelineOverviewPane('network'); 56 this._overviewPane = new Perf_UI.TimelineOverviewPane('network');
57 this._overviewPane.addEventListener(UI.TimelineOverviewPane.Events.WindowCha nged, this._onWindowChanged.bind(this)); 57 this._overviewPane.addEventListener(
58 Perf_UI.TimelineOverviewPane.Events.WindowChanged, this._onWindowChanged .bind(this));
58 this._overviewPane.element.id = 'network-overview-panel'; 59 this._overviewPane.element.id = 'network-overview-panel';
59 this._networkOverview = new Network.NetworkOverview(); 60 this._networkOverview = new Network.NetworkOverview();
60 this._overviewPane.setOverviewControls([this._networkOverview]); 61 this._overviewPane.setOverviewControls([this._networkOverview]);
61 this._calculator = new Network.NetworkTransferTimeCalculator(); 62 this._calculator = new Network.NetworkTransferTimeCalculator();
62 63
63 this._splitWidget = new UI.SplitWidget(true, false, 'networkPanelSplitViewSt ate'); 64 this._splitWidget = new UI.SplitWidget(true, false, 'networkPanelSplitViewSt ate');
64 this._splitWidget.hideMain(); 65 this._splitWidget.hideMain();
65 66
66 this._splitWidget.show(this.element); 67 this._splitWidget.show(this.element);
67 68
(...skipping 30 matching lines...) Expand all
98 SDK.targetManager.addModelListener( 99 SDK.targetManager.addModelListener(
99 SDK.ResourceTreeModel, SDK.ResourceTreeModel.Events.WillReloadPage, this ._willReloadPage, this); 100 SDK.ResourceTreeModel, SDK.ResourceTreeModel.Events.WillReloadPage, this ._willReloadPage, this);
100 SDK.targetManager.addModelListener(SDK.ResourceTreeModel, SDK.ResourceTreeMo del.Events.Load, this._load, this); 101 SDK.targetManager.addModelListener(SDK.ResourceTreeModel, SDK.ResourceTreeMo del.Events.Load, this._load, this);
101 this._networkLogView.addEventListener(Network.NetworkLogView.Events.RequestS elected, this._onRequestSelected, this); 102 this._networkLogView.addEventListener(Network.NetworkLogView.Events.RequestS elected, this._onRequestSelected, this);
102 this._networkLogView.addEventListener( 103 this._networkLogView.addEventListener(
103 Network.NetworkLogView.Events.SearchCountUpdated, this._onSearchCountUpd ated, this); 104 Network.NetworkLogView.Events.SearchCountUpdated, this._onSearchCountUpd ated, this);
104 this._networkLogView.addEventListener( 105 this._networkLogView.addEventListener(
105 Network.NetworkLogView.Events.SearchIndexUpdated, this._onSearchIndexUpd ated, this); 106 Network.NetworkLogView.Events.SearchIndexUpdated, this._onSearchIndexUpd ated, this);
106 this._networkLogView.addEventListener(Network.NetworkLogView.Events.UpdateRe quest, this._onUpdateRequest, this); 107 this._networkLogView.addEventListener(Network.NetworkLogView.Events.UpdateRe quest, this._onUpdateRequest, this);
107 108
108 Components.DataSaverInfobar.maybeShowInPanel(this); 109 Main.DataSaverInfobar.maybeShowInPanel(this);
109 } 110 }
110 111
111 /** 112 /**
112 * @param {!Array<{filterType: !Network.NetworkLogView.FilterType, filterValue : string}>} filters 113 * @param {!Array<{filterType: !Network.NetworkLogView.FilterType, filterValue : string}>} filters
113 */ 114 */
114 static revealAndFilter(filters) { 115 static revealAndFilter(filters) {
115 var panel = Network.NetworkPanel._instance(); 116 var panel = Network.NetworkPanel._instance();
116 var filterString = ''; 117 var filterString = '';
117 for (var filter of filters) 118 for (var filter of filters)
118 filterString += `${filter.filterType}:${filter.filterValue} `; 119 filterString += `${filter.filterType}:${filter.filterValue} `;
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 * @param {boolean} toggled 219 * @param {boolean} toggled
219 */ 220 */
220 _toggleRecord(toggled) { 221 _toggleRecord(toggled) {
221 this._toggleRecordAction.setToggled(toggled); 222 this._toggleRecordAction.setToggled(toggled);
222 this._networkLogView.setRecording(toggled); 223 this._networkLogView.setRecording(toggled);
223 if (!toggled && this._filmStripRecorder) 224 if (!toggled && this._filmStripRecorder)
224 this._filmStripRecorder.stopRecording(this._filmStripAvailable.bind(this)) ; 225 this._filmStripRecorder.stopRecording(this._filmStripAvailable.bind(this)) ;
225 } 226 }
226 227
227 /** 228 /**
228 * @param {?Components.FilmStripModel} filmStripModel 229 * @param {?SDK.FilmStripModel} filmStripModel
229 */ 230 */
230 _filmStripAvailable(filmStripModel) { 231 _filmStripAvailable(filmStripModel) {
231 if (!filmStripModel) 232 if (!filmStripModel)
232 return; 233 return;
233 var calculator = this._networkLogView.timeCalculator(); 234 var calculator = this._networkLogView.timeCalculator();
234 this._filmStripView.setModel(filmStripModel, calculator.minimumBoundary() * 1000, calculator.boundarySpan() * 1000); 235 this._filmStripView.setModel(filmStripModel, calculator.minimumBoundary() * 1000, calculator.boundarySpan() * 1000);
235 this._networkOverview.setFilmStripModel(filmStripModel); 236 this._networkOverview.setFilmStripModel(filmStripModel);
236 var timestamps = filmStripModel.frames().map(mapTimestamp); 237 var timestamps = filmStripModel.frames().map(mapTimestamp);
237 238
238 /** 239 /**
239 * @param {!Components.FilmStripModel.Frame} frame 240 * @param {!SDK.FilmStripModel.Frame} frame
240 * @return {number} 241 * @return {number}
241 */ 242 */
242 function mapTimestamp(frame) { 243 function mapTimestamp(frame) {
243 return frame.timestamp / 1000; 244 return frame.timestamp / 1000;
244 } 245 }
245 246
246 this._networkLogView.addFilmStripFrames(timestamps); 247 this._networkLogView.addFilmStripFrames(timestamps);
247 } 248 }
248 249
249 /** 250 /**
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
654 655
655 /** 656 /**
656 * @override 657 * @override
657 */ 658 */
658 tracingComplete() { 659 tracingComplete() {
659 if (!this._tracingModel) 660 if (!this._tracingModel)
660 return; 661 return;
661 this._tracingModel.tracingComplete(); 662 this._tracingModel.tracingComplete();
662 SDK.targetManager.resumeReload(this._target); 663 SDK.targetManager.resumeReload(this._target);
663 this._target = null; 664 this._target = null;
664 this._callback(new Components.FilmStripModel(this._tracingModel, this._timeC alculator.minimumBoundary() * 1000)); 665 this._callback(new SDK.FilmStripModel(this._tracingModel, this._timeCalculat or.minimumBoundary() * 1000));
665 delete this._callback; 666 delete this._callback;
666 } 667 }
667 668
668 /** 669 /**
669 * @override 670 * @override
670 */ 671 */
671 tracingBufferUsage() { 672 tracingBufferUsage() {
672 } 673 }
673 674
674 /** 675 /**
(...skipping 18 matching lines...) Expand all
693 } 694 }
694 695
695 /** 696 /**
696 * @return {boolean} 697 * @return {boolean}
697 */ 698 */
698 isRecording() { 699 isRecording() {
699 return !!this._target; 700 return !!this._target;
700 } 701 }
701 702
702 /** 703 /**
703 * @param {function(?Components.FilmStripModel)} callback 704 * @param {function(?SDK.FilmStripModel)} callback
704 */ 705 */
705 stopRecording(callback) { 706 stopRecording(callback) {
706 if (!this._target) 707 if (!this._target)
707 return; 708 return;
708 709
709 this._target.tracingManager.stop(); 710 this._target.tracingManager.stop();
710 SDK.targetManager.suspendReload(this._target); 711 SDK.targetManager.suspendReload(this._target);
711 this._callback = callback; 712 this._callback = callback;
712 this._filmStripView.setStatusText(Common.UIString('Fetching frames...')); 713 this._filmStripView.setStatusText(Common.UIString('Fetching frames...'));
713 } 714 }
(...skipping 10 matching lines...) Expand all
724 * @param {string} actionId 725 * @param {string} actionId
725 * @return {boolean} 726 * @return {boolean}
726 */ 727 */
727 handleAction(context, actionId) { 728 handleAction(context, actionId) {
728 var panel = UI.context.flavor(Network.NetworkPanel); 729 var panel = UI.context.flavor(Network.NetworkPanel);
729 console.assert(panel && panel instanceof Network.NetworkPanel); 730 console.assert(panel && panel instanceof Network.NetworkPanel);
730 panel._toggleRecording(); 731 panel._toggleRecording();
731 return true; 732 return true;
732 } 733 }
733 }; 734 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698