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

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

Issue 2623743002: DevTools: extract modules (non-extensions) (Closed)
Patch Set: rebaseline 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 25 matching lines...) Expand all
36 constructor() { 36 constructor() {
37 super('network'); 37 super('network');
38 this.registerRequiredCSS('network/networkPanel.css'); 38 this.registerRequiredCSS('network/networkPanel.css');
39 39
40 this._networkLogShowOverviewSetting = Common.settings.createSetting('network LogShowOverview', true); 40 this._networkLogShowOverviewSetting = Common.settings.createSetting('network LogShowOverview', true);
41 this._networkLogLargeRowsSetting = Common.settings.createSetting('networkLog LargeRows', false); 41 this._networkLogLargeRowsSetting = Common.settings.createSetting('networkLog LargeRows', false);
42 this._networkRecordFilmStripSetting = Common.settings.createSetting('network RecordFilmStripSetting', false); 42 this._networkRecordFilmStripSetting = Common.settings.createSetting('network RecordFilmStripSetting', false);
43 this._toggleRecordAction = 43 this._toggleRecordAction =
44 /** @type {!UI.Action }*/ (UI.actionRegistry.action('network.toggle-reco rding')); 44 /** @type {!UI.Action }*/ (UI.actionRegistry.action('network.toggle-reco rding'));
45 45
46 /** @type {?Components.FilmStripView} */ 46 /** @type {?PerfUI.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 PerfUI.TimelineOverviewPane('network');
57 this._overviewPane.addEventListener(UI.TimelineOverviewPane.Events.WindowCha nged, this._onWindowChanged.bind(this)); 57 this._overviewPane.addEventListener(
58 PerfUI.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 150 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 if (toggled) 309 if (toggled)
309 this._overviewPane.show(this.element, this._splitWidget.element); 310 this._overviewPane.show(this.element, this._splitWidget.element);
310 else 311 else
311 this._overviewPane.detach(); 312 this._overviewPane.detach();
312 this.doResize(); 313 this.doResize();
313 } 314 }
314 315
315 _toggleRecordFilmStrip() { 316 _toggleRecordFilmStrip() {
316 var toggled = this._networkRecordFilmStripSetting.get(); 317 var toggled = this._networkRecordFilmStripSetting.get();
317 if (toggled && !this._filmStripRecorder) { 318 if (toggled && !this._filmStripRecorder) {
318 this._filmStripView = new Components.FilmStripView(); 319 this._filmStripView = new PerfUI.FilmStripView();
319 this._filmStripView.setMode(Components.FilmStripView.Modes.FrameBased); 320 this._filmStripView.setMode(PerfUI.FilmStripView.Modes.FrameBased);
320 this._filmStripView.element.classList.add('network-film-strip'); 321 this._filmStripView.element.classList.add('network-film-strip');
321 this._filmStripRecorder = 322 this._filmStripRecorder =
322 new Network.NetworkPanel.FilmStripRecorder(this._networkLogView.timeCa lculator(), this._filmStripView); 323 new Network.NetworkPanel.FilmStripRecorder(this._networkLogView.timeCa lculator(), this._filmStripView);
323 this._filmStripView.show(this.element, this.element.firstElementChild); 324 this._filmStripView.show(this.element, this.element.firstElementChild);
324 this._filmStripView.addEventListener( 325 this._filmStripView.addEventListener(PerfUI.FilmStripView.Events.FrameSele cted, this._onFilmFrameSelected, this);
325 Components.FilmStripView.Events.FrameSelected, this._onFilmFrameSelect ed, this); 326 this._filmStripView.addEventListener(PerfUI.FilmStripView.Events.FrameEnte r, this._onFilmFrameEnter, this);
326 this._filmStripView.addEventListener(Components.FilmStripView.Events.Frame Enter, this._onFilmFrameEnter, this); 327 this._filmStripView.addEventListener(PerfUI.FilmStripView.Events.FrameExit , this._onFilmFrameExit, this);
327 this._filmStripView.addEventListener(Components.FilmStripView.Events.Frame Exit, this._onFilmFrameExit, this);
328 this._resetFilmStripView(); 328 this._resetFilmStripView();
329 } 329 }
330 330
331 if (!toggled && this._filmStripRecorder) { 331 if (!toggled && this._filmStripRecorder) {
332 this._filmStripView.detach(); 332 this._filmStripView.detach();
333 this._filmStripView = null; 333 this._filmStripView = null;
334 this._filmStripRecorder = null; 334 this._filmStripRecorder = null;
335 } 335 }
336 } 336 }
337 337
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
623 }; 623 };
624 624
625 625
626 /** 626 /**
627 * @implements {SDK.TracingManagerClient} 627 * @implements {SDK.TracingManagerClient}
628 * @unrestricted 628 * @unrestricted
629 */ 629 */
630 Network.NetworkPanel.FilmStripRecorder = class { 630 Network.NetworkPanel.FilmStripRecorder = class {
631 /** 631 /**
632 * @param {!Network.NetworkTimeCalculator} timeCalculator 632 * @param {!Network.NetworkTimeCalculator} timeCalculator
633 * @param {!Components.FilmStripView} filmStripView 633 * @param {!PerfUI.FilmStripView} filmStripView
634 */ 634 */
635 constructor(timeCalculator, filmStripView) { 635 constructor(timeCalculator, filmStripView) {
636 this._timeCalculator = timeCalculator; 636 this._timeCalculator = timeCalculator;
637 this._filmStripView = filmStripView; 637 this._filmStripView = filmStripView;
638 } 638 }
639 639
640 /** 640 /**
641 * @override 641 * @override
642 */ 642 */
643 tracingStarted() { 643 tracingStarted() {
(...skipping 10 matching lines...) Expand all
654 654
655 /** 655 /**
656 * @override 656 * @override
657 */ 657 */
658 tracingComplete() { 658 tracingComplete() {
659 if (!this._tracingModel) 659 if (!this._tracingModel)
660 return; 660 return;
661 this._tracingModel.tracingComplete(); 661 this._tracingModel.tracingComplete();
662 SDK.targetManager.resumeReload(this._target); 662 SDK.targetManager.resumeReload(this._target);
663 this._target = null; 663 this._target = null;
664 this._callback(new Components.FilmStripModel(this._tracingModel, this._timeC alculator.minimumBoundary() * 1000)); 664 this._callback(new SDK.FilmStripModel(this._tracingModel, this._timeCalculat or.minimumBoundary() * 1000));
665 delete this._callback; 665 delete this._callback;
666 } 666 }
667 667
668 /** 668 /**
669 * @override 669 * @override
670 */ 670 */
671 tracingBufferUsage() { 671 tracingBufferUsage() {
672 } 672 }
673 673
674 /** 674 /**
(...skipping 18 matching lines...) Expand all
693 } 693 }
694 694
695 /** 695 /**
696 * @return {boolean} 696 * @return {boolean}
697 */ 697 */
698 isRecording() { 698 isRecording() {
699 return !!this._target; 699 return !!this._target;
700 } 700 }
701 701
702 /** 702 /**
703 * @param {function(?Components.FilmStripModel)} callback 703 * @param {function(?SDK.FilmStripModel)} callback
704 */ 704 */
705 stopRecording(callback) { 705 stopRecording(callback) {
706 if (!this._target) 706 if (!this._target)
707 return; 707 return;
708 708
709 this._target.tracingManager.stop(); 709 this._target.tracingManager.stop();
710 SDK.targetManager.suspendReload(this._target); 710 SDK.targetManager.suspendReload(this._target);
711 this._callback = callback; 711 this._callback = callback;
712 this._filmStripView.setStatusText(Common.UIString('Fetching frames...')); 712 this._filmStripView.setStatusText(Common.UIString('Fetching frames...'));
713 } 713 }
(...skipping 10 matching lines...) Expand all
724 * @param {string} actionId 724 * @param {string} actionId
725 * @return {boolean} 725 * @return {boolean}
726 */ 726 */
727 handleAction(context, actionId) { 727 handleAction(context, actionId) {
728 var panel = UI.context.flavor(Network.NetworkPanel); 728 var panel = UI.context.flavor(Network.NetworkPanel);
729 console.assert(panel && panel instanceof Network.NetworkPanel); 729 console.assert(panel && panel instanceof Network.NetworkPanel);
730 panel._toggleRecording(); 730 panel._toggleRecording();
731 return true; 731 return true;
732 } 732 }
733 }; 733 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698