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

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

Issue 2717393003: [DevTools] Turn starting tracing into promise. (Closed)
Patch Set: more work Created 3 years, 9 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 661 matching lines...) Expand 10 before | Expand all | Expand 10 after
672 */ 672 */
673 constructor(timeCalculator, filmStripView) { 673 constructor(timeCalculator, filmStripView) {
674 /** @type {?SDK.Target} */ 674 /** @type {?SDK.Target} */
675 this._target = null; 675 this._target = null;
676 this._timeCalculator = timeCalculator; 676 this._timeCalculator = timeCalculator;
677 this._filmStripView = filmStripView; 677 this._filmStripView = filmStripView;
678 } 678 }
679 679
680 /** 680 /**
681 * @override 681 * @override
682 */
683 tracingStarted() {
684 }
685
686 /**
687 * @override
688 * @param {!Array.<!SDK.TracingManager.EventPayload>} events 682 * @param {!Array.<!SDK.TracingManager.EventPayload>} events
689 */ 683 */
690 traceEventsCollected(events) { 684 traceEventsCollected(events) {
691 if (this._tracingModel) 685 if (this._tracingModel)
692 this._tracingModel.addEvents(events); 686 this._tracingModel.addEvents(events);
693 } 687 }
694 688
695 /** 689 /**
696 * @override 690 * @override
697 */ 691 */
698 tracingComplete() { 692 tracingComplete() {
699 if (!this._tracingModel || !this._target) 693 if (!this._tracingModel || !this._target)
700 return; 694 return;
701 this._tracingModel.tracingComplete(); 695 this._tracingModel.tracingComplete();
702 SDK.targetManager.resumeReload(this._target); 696 var resourceTreeModel = SDK.ResourceTreeModel.fromTarget(this._target);
703 this._target = null; 697 this._target = null;
704 this._callback(new SDK.FilmStripModel(this._tracingModel, this._timeCalculat or.minimumBoundary() * 1000)); 698 this._callback(new SDK.FilmStripModel(this._tracingModel, this._timeCalculat or.minimumBoundary() * 1000));
705 delete this._callback; 699 delete this._callback;
700 if (resourceTreeModel)
701 resourceTreeModel.resumeReload();
706 } 702 }
707 703
708 /** 704 /**
709 * @override 705 * @override
710 */ 706 */
711 tracingBufferUsage() { 707 tracingBufferUsage() {
712 } 708 }
713 709
714 /** 710 /**
715 * @override 711 * @override
(...skipping 24 matching lines...) Expand all
740 } 736 }
741 737
742 /** 738 /**
743 * @param {function(?SDK.FilmStripModel)} callback 739 * @param {function(?SDK.FilmStripModel)} callback
744 */ 740 */
745 stopRecording(callback) { 741 stopRecording(callback) {
746 if (!this._target) 742 if (!this._target)
747 return; 743 return;
748 744
749 this._target.tracingManager.stop(); 745 this._target.tracingManager.stop();
750 SDK.targetManager.suspendReload(this._target); 746 var resourceTreeModel = SDK.ResourceTreeModel.fromTarget(this._target);
747 if (resourceTreeModel)
748 resourceTreeModel.suspendReload();
751 this._callback = callback; 749 this._callback = callback;
752 this._filmStripView.setStatusText(Common.UIString('Fetching frames...')); 750 this._filmStripView.setStatusText(Common.UIString('Fetching frames...'));
753 } 751 }
754 }; 752 };
755 753
756 /** 754 /**
757 * @implements {UI.ActionDelegate} 755 * @implements {UI.ActionDelegate}
758 * @unrestricted 756 * @unrestricted
759 */ 757 */
760 Network.NetworkPanel.RecordActionDelegate = class { 758 Network.NetworkPanel.RecordActionDelegate = class {
761 /** 759 /**
762 * @override 760 * @override
763 * @param {!UI.Context} context 761 * @param {!UI.Context} context
764 * @param {string} actionId 762 * @param {string} actionId
765 * @return {boolean} 763 * @return {boolean}
766 */ 764 */
767 handleAction(context, actionId) { 765 handleAction(context, actionId) {
768 var panel = UI.context.flavor(Network.NetworkPanel); 766 var panel = UI.context.flavor(Network.NetworkPanel);
769 console.assert(panel && panel instanceof Network.NetworkPanel); 767 console.assert(panel && panel instanceof Network.NetworkPanel);
770 panel._toggleRecording(); 768 panel._toggleRecording();
771 return true; 769 return true;
772 } 770 }
773 }; 771 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698