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

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

Issue 1314783010: DevTools: fix race conditions while recording film strips (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: use counter, not a flag to track reload suspension Created 5 years, 3 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 687 matching lines...) Expand 10 before | Expand all | Expand 10 after
698 }, 698 },
699 699
700 /** 700 /**
701 * @override 701 * @override
702 */ 702 */
703 tracingComplete: function() 703 tracingComplete: function()
704 { 704 {
705 if (!this._tracingModel) 705 if (!this._tracingModel)
706 return; 706 return;
707 this._tracingModel.tracingComplete(); 707 this._tracingModel.tracingComplete();
708 var resourceTreeModel = this._target.resourceTreeModel;
709 this._target = null;
710 setImmediate(resourceTreeModel.resumeReload.bind(resourceTreeModel));
708 this._callback(new WebInspector.FilmStripModel(this._tracingModel, this. _timeCalculator.minimumBoundary() * 1000)); 711 this._callback(new WebInspector.FilmStripModel(this._tracingModel, this. _timeCalculator.minimumBoundary() * 1000));
709 delete this._callback; 712 delete this._callback;
710 }, 713 },
711 714
712 /** 715 /**
713 * @override 716 * @override
714 */ 717 */
715 tracingBufferUsage: function() 718 tracingBufferUsage: function()
716 { 719 {
717 }, 720 },
718 721
719 /** 722 /**
720 * @override 723 * @override
721 * @param {number} progress 724 * @param {number} progress
722 */ 725 */
723 eventsRetrievalProgress: function(progress) 726 eventsRetrievalProgress: function(progress)
724 { 727 {
725 }, 728 },
726 729
727 startRecording: function() 730 startRecording: function()
728 { 731 {
732 this._filmStripView.reset();
733 this._filmStripView.setStatusText(WebInspector.UIString("Recording frame s..."));
729 if (this._target) 734 if (this._target)
730 return; 735 return;
731 736
732 this._target = WebInspector.targetManager.mainTarget(); 737 this._target = WebInspector.targetManager.mainTarget();
733 if (this._tracingModel) 738 if (this._tracingModel)
734 this._tracingModel.reset(); 739 this._tracingModel.reset();
735 else 740 else
736 this._tracingModel = new WebInspector.TracingModel(new WebInspector. TempFileBackingStorage("tracing")); 741 this._tracingModel = new WebInspector.TracingModel(new WebInspector. TempFileBackingStorage("tracing"));
737 this._target.tracingManager.start(this, "-*,disabled-by-default-devtools .screenshot", ""); 742 this._target.tracingManager.start(this, "-*,disabled-by-default-devtools .screenshot", "");
738 this._filmStripView.reset();
739 this._filmStripView.setStatusText(WebInspector.UIString("Recording frame s..."));
740 }, 743 },
741 744
742 /** 745 /**
743 * @return {boolean} 746 * @return {boolean}
744 */ 747 */
745 isRecording: function() 748 isRecording: function()
746 { 749 {
747 return !!this._target; 750 return !!this._target;
748 }, 751 },
749 752
750 /** 753 /**
751 * @param {function(?WebInspector.FilmStripModel)} callback 754 * @param {function(?WebInspector.FilmStripModel)} callback
752 */ 755 */
753 stopRecording: function(callback) 756 stopRecording: function(callback)
754 { 757 {
755 if (!this._target) 758 if (!this._target)
756 return; 759 return;
757 760
758 this._target.tracingManager.stop(); 761 this._target.tracingManager.stop();
759 this._target = null; 762 this._target.resourceTreeModel.suspendReload();
760 this._callback = callback; 763 this._callback = callback;
761 this._filmStripView.setStatusText(WebInspector.UIString("Fetching frames ...")); 764 this._filmStripView.setStatusText(WebInspector.UIString("Fetching frames ..."));
762 } 765 }
763 } 766 }
764 767
765 /** 768 /**
766 * @constructor 769 * @constructor
767 * @implements {WebInspector.ActionDelegate} 770 * @implements {WebInspector.ActionDelegate}
768 */ 771 */
769 WebInspector.NetworkPanel.RecordActionDelegate = function() 772 WebInspector.NetworkPanel.RecordActionDelegate = function()
770 { 773 {
771 } 774 }
772 WebInspector.NetworkPanel.RecordActionDelegate.prototype = { 775 WebInspector.NetworkPanel.RecordActionDelegate.prototype = {
773 /** 776 /**
774 * @override 777 * @override
775 * @param {!WebInspector.Context} context 778 * @param {!WebInspector.Context} context
776 * @param {string} actionId 779 * @param {string} actionId
777 */ 780 */
778 handleAction: function(context, actionId) 781 handleAction: function(context, actionId)
779 { 782 {
780 var panel = WebInspector.context.flavor(WebInspector.NetworkPanel); 783 var panel = WebInspector.context.flavor(WebInspector.NetworkPanel);
781 console.assert(panel && panel instanceof WebInspector.NetworkPanel); 784 console.assert(panel && panel instanceof WebInspector.NetworkPanel);
782 panel._toggleRecording(); 785 panel._toggleRecording();
783 } 786 }
784 } 787 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/bindings/TempFile.js ('k') | Source/devtools/front_end/sdk/ResourceTreeModel.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698