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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/sdk/ServiceWorkerManager.js

Issue 1841863003: DevTools: move the force update SW on reload checkbox to the Resources / Service Workers view. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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) 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 26 matching lines...) Expand all
37 { 37 {
38 WebInspector.SDKObject.call(this, target); 38 WebInspector.SDKObject.call(this, target);
39 target.registerServiceWorkerDispatcher(new WebInspector.ServiceWorkerDispatc her(this)); 39 target.registerServiceWorkerDispatcher(new WebInspector.ServiceWorkerDispatc her(this));
40 this._lastAnonymousTargetId = 0; 40 this._lastAnonymousTargetId = 0;
41 this._agent = target.serviceWorkerAgent(); 41 this._agent = target.serviceWorkerAgent();
42 /** @type {!Map.<string, !WebInspector.ServiceWorker>} */ 42 /** @type {!Map.<string, !WebInspector.ServiceWorker>} */
43 this._workers = new Map(); 43 this._workers = new Map();
44 /** @type {!Map.<string, !WebInspector.ServiceWorkerRegistration>} */ 44 /** @type {!Map.<string, !WebInspector.ServiceWorkerRegistration>} */
45 this._registrations = new Map(); 45 this._registrations = new Map();
46 this.enable(); 46 this.enable();
47 this._forceUpdateSetting = WebInspector.settings.moduleSetting("serviceWorke rUpdateOnReload");
dgozman 2016/03/30 21:09:54 Just createSetting(), don't declare it in module.j
pfeldman 2016/03/31 05:02:31 Done.
48 if (this._forceUpdateSetting.get())
49 this._forceUpdateSettingChanged();
50 this._forceUpdateSetting.addChangeListener(this._forceUpdateSettingChanged, this);
47 } 51 }
48 52
49 WebInspector.ServiceWorkerManager.Events = { 53 WebInspector.ServiceWorkerManager.Events = {
50 WorkersUpdated: "WorkersUpdated", 54 WorkersUpdated: "WorkersUpdated",
51 RegistrationUpdated: "RegistrationUpdated", 55 RegistrationUpdated: "RegistrationUpdated",
52 RegistrationDeleted: "RegistrationDeleted", 56 RegistrationDeleted: "RegistrationDeleted",
53 DebugOnStartUpdated: "DebugOnStartUpdated" 57 DebugOnStartUpdated: "DebugOnStartUpdated"
54 } 58 }
horo 2016/03/30 05:17:35 If "force update on reload" flag is global, Servic
pfeldman 2016/03/30 17:11:44 I don't think so. This is a user setting, stored i
horo 2016/03/31 02:39:45 OK. Then please remove "DebugOnStartUpdated" from
pfeldman 2016/03/31 05:02:31 Done.
55 59
56 WebInspector.ServiceWorkerManager.prototype = { 60 WebInspector.ServiceWorkerManager.prototype = {
57 enable: function() 61 enable: function()
58 { 62 {
59 if (this._enabled) 63 if (this._enabled)
60 return; 64 return;
61 this._enabled = true; 65 this._enabled = true;
62 66
63 this._agent.enable(); 67 this._agent.enable();
64 WebInspector.targetManager.addEventListener(WebInspector.TargetManager.E vents.MainFrameNavigated, this._mainFrameNavigated, this); 68 WebInspector.targetManager.addEventListener(WebInspector.TargetManager.E vents.MainFrameNavigated, this._mainFrameNavigated, this);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 108
105 /** 109 /**
106 * @param {boolean} flag 110 * @param {boolean} flag
107 */ 111 */
108 setDebugOnStart: function(flag) 112 setDebugOnStart: function(flag)
109 { 113 {
110 this._agent.setDebugOnStart(flag); 114 this._agent.setDebugOnStart(flag);
111 }, 115 },
112 116
113 /** 117 /**
114 * @param {string} registrationId
115 * @param {boolean} flag
116 */
117 setForceUpdateOnPageLoad: function(registrationId, flag)
118 {
119 this._agent.setForceUpdateOnPageLoad(registrationId, flag);
120 },
121
122 /**
123 * @return {!Map.<string, !WebInspector.ServiceWorkerRegistration>} 118 * @return {!Map.<string, !WebInspector.ServiceWorkerRegistration>}
124 */ 119 */
125 registrations: function() 120 registrations: function()
126 { 121 {
127 return this._registrations; 122 return this._registrations;
128 }, 123 },
129 124
130 /** 125 /**
131 * @param {string} versionId 126 * @param {string} versionId
132 * @return {?WebInspector.ServiceWorkerVersion} 127 * @return {?WebInspector.ServiceWorkerVersion}
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 }, 350 },
356 351
357 /** 352 /**
358 * @param {!WebInspector.Event} event 353 * @param {!WebInspector.Event} event
359 */ 354 */
360 _mainFrameNavigated: function(event) 355 _mainFrameNavigated: function(event)
361 { 356 {
362 // Attach to the new worker set. 357 // Attach to the new worker set.
363 }, 358 },
364 359
360 /**
361 * @return {!WebInspector.Setting}
362 */
363 forceUpdateOnReloadSetting: function()
364 {
365 return this._forceUpdateSetting;
366 },
367
368 _forceUpdateSettingChanged: function()
369 {
370 this._agent.setForceUpdateOnPageLoad(this._forceUpdateSetting.get());
371 },
372
365 __proto__: WebInspector.SDKObject.prototype 373 __proto__: WebInspector.SDKObject.prototype
366 } 374 }
367 375
368 /** 376 /**
369 * @constructor 377 * @constructor
370 * @param {!WebInspector.ServiceWorkerManager} manager 378 * @param {!WebInspector.ServiceWorkerManager} manager
371 * @param {string} workerId 379 * @param {string} workerId
372 * @param {string} url 380 * @param {string} url
373 * @param {string} versionId 381 * @param {string} versionId
374 */ 382 */
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
824 }, 832 },
825 833
826 /** 834 /**
827 * @return {boolean} 835 * @return {boolean}
828 */ 836 */
829 _shouldBeRemoved: function() 837 _shouldBeRemoved: function()
830 { 838 {
831 return this._isRedundant() && (!this._hasErrorLog() || this._deleting); 839 return this._isRedundant() && (!this._hasErrorLog() || this._deleting);
832 } 840 }
833 } 841 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698