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

Side by Side Diff: Source/devtools/front_end/profiler/CanvasProfileView.js

Issue 475803002: Make profiling lock global rather than per Target (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Extracted Lock.js Created 6 years, 4 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after
693 } else { 693 } else {
694 this._recording = true; 694 this._recording = true;
695 this._startFrameCapturing(); 695 this._startFrameCapturing();
696 } 696 }
697 return this._recording; 697 return this._recording;
698 }, 698 },
699 699
700 _runSingleFrameCapturing: function() 700 _runSingleFrameCapturing: function()
701 { 701 {
702 var frameId = this._selectedFrameId(); 702 var frameId = this._selectedFrameId();
703 this._target.profilingLock.acquire(); 703 WebInspector.profilingLock.acquire();
704 CanvasAgent.captureFrame(frameId, this._didStartCapturingFrame.bind(this , frameId)); 704 CanvasAgent.captureFrame(frameId, this._didStartCapturingFrame.bind(this , frameId));
705 this._target.profilingLock.release(); 705 WebInspector.profilingLock.release();
706 }, 706 },
707 707
708 _startFrameCapturing: function() 708 _startFrameCapturing: function()
709 { 709 {
710 var frameId = this._selectedFrameId(); 710 var frameId = this._selectedFrameId();
711 this._target.profilingLock.acquire(); 711 WebInspector.profilingLock.acquire();
712 CanvasAgent.startCapturing(frameId, this._didStartCapturingFrame.bind(th is, frameId)); 712 CanvasAgent.startCapturing(frameId, this._didStartCapturingFrame.bind(th is, frameId));
713 }, 713 },
714 714
715 _stopFrameCapturing: function() 715 _stopFrameCapturing: function()
716 { 716 {
717 if (!this._lastProfileHeader) { 717 if (!this._lastProfileHeader) {
718 this._target.profilingLock.release(); 718 WebInspector.profilingLock.release();
719 return; 719 return;
720 } 720 }
721 var profileHeader = this._lastProfileHeader; 721 var profileHeader = this._lastProfileHeader;
722 var traceLogId = profileHeader.traceLogId(); 722 var traceLogId = profileHeader.traceLogId();
723 this._lastProfileHeader = null; 723 this._lastProfileHeader = null;
724 function didStopCapturing() 724 function didStopCapturing()
725 { 725 {
726 profileHeader._updateCapturingStatus(); 726 profileHeader._updateCapturingStatus();
727 } 727 }
728 CanvasAgent.stopCapturing(traceLogId, didStopCapturing); 728 CanvasAgent.stopCapturing(traceLogId, didStopCapturing);
729 this._target.profilingLock.release(); 729 WebInspector.profilingLock.release();
730 }, 730 },
731 731
732 /** 732 /**
733 * @param {string|undefined} frameId 733 * @param {string|undefined} frameId
734 * @param {?Protocol.Error} error 734 * @param {?Protocol.Error} error
735 * @param {!CanvasAgent.TraceLogId} traceLogId 735 * @param {!CanvasAgent.TraceLogId} traceLogId
736 */ 736 */
737 _didStartCapturingFrame: function(frameId, error, traceLogId) 737 _didStartCapturingFrame: function(frameId, error, traceLogId)
738 { 738 {
739 if (error || this._lastProfileHeader && this._lastProfileHeader.traceLog Id() === traceLogId) 739 if (error || this._lastProfileHeader && this._lastProfileHeader.traceLog Id() === traceLogId)
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after
1280 }, 1280 },
1281 1281
1282 clearResourceStates: function() 1282 clearResourceStates: function()
1283 { 1283 {
1284 this._currentResourceStates = {}; 1284 this._currentResourceStates = {};
1285 this.dispatchEventToListeners(WebInspector.CanvasTraceLogPlayerProxy.Eve nts.CanvasReplayStateChanged); 1285 this.dispatchEventToListeners(WebInspector.CanvasTraceLogPlayerProxy.Eve nts.CanvasReplayStateChanged);
1286 }, 1286 },
1287 1287
1288 __proto__: WebInspector.Object.prototype 1288 __proto__: WebInspector.Object.prototype
1289 } 1289 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698