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

Side by Side Diff: Source/devtools/front_end/sdk/ResourceTreeModel.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
« no previous file with comments | « Source/devtools/front_end/network/NetworkPanel.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 this._agent = target.pageAgent(); 46 this._agent = target.pageAgent();
47 this._agent.enable(); 47 this._agent.enable();
48 48
49 this._fetchResourceTree(); 49 this._fetchResourceTree();
50 50
51 target.registerPageDispatcher(new WebInspector.PageDispatcher(this)); 51 target.registerPageDispatcher(new WebInspector.PageDispatcher(this));
52 52
53 this._pendingConsoleMessages = {}; 53 this._pendingConsoleMessages = {};
54 this._securityOriginFrameCount = {}; 54 this._securityOriginFrameCount = {};
55 this._inspectedPageURL = ""; 55 this._inspectedPageURL = "";
56 this._pendingReloadOptions = null;
57 this._reloadSuspensionCount = 0;
56 } 58 }
57 59
58 WebInspector.ResourceTreeModel.EventTypes = { 60 WebInspector.ResourceTreeModel.EventTypes = {
59 FrameAdded: "FrameAdded", 61 FrameAdded: "FrameAdded",
60 FrameNavigated: "FrameNavigated", 62 FrameNavigated: "FrameNavigated",
61 FrameDetached: "FrameDetached", 63 FrameDetached: "FrameDetached",
62 FrameResized: "FrameResized", 64 FrameResized: "FrameResized",
63 MainFrameNavigated: "MainFrameNavigated", 65 MainFrameNavigated: "MainFrameNavigated",
64 ResourceAdded: "ResourceAdded", 66 ResourceAdded: "ResourceAdded",
65 WillLoadCachedResources: "WillLoadCachedResources", 67 WillLoadCachedResources: "WillLoadCachedResources",
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 * @param {string} url 492 * @param {string} url
491 * @param {!WebInspector.ResourceType} type 493 * @param {!WebInspector.ResourceType} type
492 * @param {string} mimeType 494 * @param {string} mimeType
493 * @return {!WebInspector.Resource} 495 * @return {!WebInspector.Resource}
494 */ 496 */
495 _createResourceFromFramePayload: function(frame, url, type, mimeType) 497 _createResourceFromFramePayload: function(frame, url, type, mimeType)
496 { 498 {
497 return new WebInspector.Resource(this.target(), null, url, frame.url, fr ame.id, frame.loaderId, type, mimeType); 499 return new WebInspector.Resource(this.target(), null, url, frame.url, fr ame.id, frame.loaderId, type, mimeType);
498 }, 500 },
499 501
502 suspendReload: function()
503 {
504 this._reloadSuspensionCount++;
505 },
506
507 resumeReload: function()
508 {
509 this._reloadSuspensionCount--;
510 console.assert(this._reloadSuspensionCount >= 0, "Unbalanced call to Res ourceTreeModel.resumeReload()");
511 if (!this._reloadSuspensionCount && this._pendingReloadOptions)
512 this.reloadPage.apply(this, this._pendingReloadOptions);
513 },
514
500 /** 515 /**
501 * @param {boolean=} ignoreCache 516 * @param {boolean=} ignoreCache
502 * @param {string=} scriptToEvaluateOnLoad 517 * @param {string=} scriptToEvaluateOnLoad
503 */ 518 */
504 reloadPage: function(ignoreCache, scriptToEvaluateOnLoad) 519 reloadPage: function(ignoreCache, scriptToEvaluateOnLoad)
505 { 520 {
521 if (this._reloadSuspensionCount) {
522 this._pendingReloadOptions = [ignoreCache, scriptToEvaluateOnLoad];
523 return;
524 }
525 this._pendingReloadOptions = null;
506 this.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes. WillReloadPage); 526 this.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes. WillReloadPage);
507 this._agent.reload(ignoreCache, scriptToEvaluateOnLoad); 527 this._agent.reload(ignoreCache, scriptToEvaluateOnLoad);
508 }, 528 },
509 529
510 __proto__: WebInspector.SDKModel.prototype 530 __proto__: WebInspector.SDKModel.prototype
511 } 531 }
512 532
513 /** 533 /**
514 * @constructor 534 * @constructor
515 * @param {!WebInspector.ResourceTreeModel} model 535 * @param {!WebInspector.ResourceTreeModel} model
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
915 }, 935 },
916 936
917 /** 937 /**
918 * @override 938 * @override
919 */ 939 */
920 interstitialHidden: function() 940 interstitialHidden: function()
921 { 941 {
922 // Frontend is not interested in interstitials. 942 // Frontend is not interested in interstitials.
923 } 943 }
924 } 944 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/network/NetworkPanel.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698