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

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

Issue 2109813003: [DevTools] No NetworkManager and NetworkLog for v8only mode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed review comments Created 4 years, 5 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 53
54 /** @type {!Map<!SecurityAgent.CertificateId, !Promise<!NetworkAgent.Certifi cateDetails>>} */ 54 /** @type {!Map<!SecurityAgent.CertificateId, !Promise<!NetworkAgent.Certifi cateDetails>>} */
55 this._certificateDetailsCache = new Map(); 55 this._certificateDetailsCache = new Map();
56 56
57 this._bypassServiceWorkerSetting = WebInspector.settings.createSetting("bypa ssServiceWorker", false); 57 this._bypassServiceWorkerSetting = WebInspector.settings.createSetting("bypa ssServiceWorker", false);
58 if (this._bypassServiceWorkerSetting.get()) 58 if (this._bypassServiceWorkerSetting.get())
59 this._bypassServiceWorkerChanged(); 59 this._bypassServiceWorkerChanged();
60 this._bypassServiceWorkerSetting.addChangeListener(this._bypassServiceWorker Changed, this); 60 this._bypassServiceWorkerSetting.addChangeListener(this._bypassServiceWorker Changed, this);
61 61
62 WebInspector.moduleSetting("cacheDisabled").addChangeListener(this._cacheDis abledSettingChanged, this); 62 WebInspector.moduleSetting("cacheDisabled").addChangeListener(this._cacheDis abledSettingChanged, this);
63
64 console.assert(!target[WebInspector.NetworkManager._symbol]);
65 target[WebInspector.NetworkManager._symbol] = this;
66 WebInspector.targetManager.addEventListener(WebInspector.TargetManager.Event s.TargetDisposed, this._targetDisposed, this);
dgozman 2016/06/30 17:24:33 Hmm... It's strange this is a TargetManager's even
eostroukhov-old 2016/06/30 21:38:28 Discussed offline, nvm for now.
63 } 67 }
64 68
65 WebInspector.NetworkManager.EventTypes = { 69 WebInspector.NetworkManager.EventTypes = {
66 RequestStarted: "RequestStarted", 70 RequestStarted: "RequestStarted",
67 RequestUpdated: "RequestUpdated", 71 RequestUpdated: "RequestUpdated",
68 RequestFinished: "RequestFinished", 72 RequestFinished: "RequestFinished",
69 RequestUpdateDropped: "RequestUpdateDropped", 73 RequestUpdateDropped: "RequestUpdateDropped",
70 ResponseReceived: "ResponseReceived" 74 ResponseReceived: "ResponseReceived"
71 } 75 }
72 76
73 WebInspector.NetworkManager._MIMETypes = { 77 WebInspector.NetworkManager._MIMETypes = {
74 "text/html": {"document": true}, 78 "text/html": {"document": true},
75 "text/xml": {"document": true}, 79 "text/xml": {"document": true},
76 "text/plain": {"document": true}, 80 "text/plain": {"document": true},
77 "application/xhtml+xml": {"document": true}, 81 "application/xhtml+xml": {"document": true},
78 "image/svg+xml": {"document": true}, 82 "image/svg+xml": {"document": true},
79 "text/css": {"stylesheet": true}, 83 "text/css": {"stylesheet": true},
80 "text/xsl": {"stylesheet": true}, 84 "text/xsl": {"stylesheet": true},
81 "text/vtt": {"texttrack": true}, 85 "text/vtt": {"texttrack": true},
82 } 86 }
83 87
88 WebInspector.NetworkManager._symbol = Symbol("NetworkManager");
89
90 /**
91 * @param {!WebInspector.Target} target
92 * @return {?WebInspector.NetworkManager}
93 */
94 WebInspector.NetworkManager.fromTarget = function(target)
95 {
96 return target[WebInspector.NetworkManager._symbol] || null;
97 }
98
84 /** @typedef {{download: number, upload: number, latency: number, title: string} } */ 99 /** @typedef {{download: number, upload: number, latency: number, title: string} } */
85 WebInspector.NetworkManager.Conditions; 100 WebInspector.NetworkManager.Conditions;
86 /** @type {!WebInspector.NetworkManager.Conditions} */ 101 /** @type {!WebInspector.NetworkManager.Conditions} */
87 WebInspector.NetworkManager.NoThrottlingConditions = {title: WebInspector.UIStri ng("No throttling"), download: -1, upload: -1, latency: 0}; 102 WebInspector.NetworkManager.NoThrottlingConditions = {title: WebInspector.UIStri ng("No throttling"), download: -1, upload: -1, latency: 0};
88 /** @type {!WebInspector.NetworkManager.Conditions} */ 103 /** @type {!WebInspector.NetworkManager.Conditions} */
89 WebInspector.NetworkManager.OfflineConditions = {title: WebInspector.UIString("O ffline"), download: 0, upload: 0, latency: 0}; 104 WebInspector.NetworkManager.OfflineConditions = {title: WebInspector.UIString("O ffline"), download: 0, upload: 0, latency: 0};
90 105
91 WebInspector.NetworkManager.prototype = { 106 WebInspector.NetworkManager.prototype = {
92 /** 107 /**
93 * @param {string} url 108 * @param {string} url
94 * @return {!WebInspector.NetworkRequest} 109 * @return {!WebInspector.NetworkRequest}
95 */ 110 */
96 inflightRequestForURL: function(url) 111 inflightRequestForURL: function(url)
97 { 112 {
98 return this._dispatcher._inflightRequestsByURL[url]; 113 return this._dispatcher._inflightRequestsByURL[url];
99 }, 114 },
100 115
101 /** 116 /**
102 * @param {!WebInspector.Event} event 117 * @param {!WebInspector.Event} event
103 */ 118 */
104 _cacheDisabledSettingChanged: function(event) 119 _cacheDisabledSettingChanged: function(event)
105 { 120 {
106 var enabled = /** @type {boolean} */ (event.data); 121 var enabled = /** @type {boolean} */ (event.data);
107 this._networkAgent.setCacheDisabled(enabled); 122 this._networkAgent.setCacheDisabled(enabled);
108 }, 123 },
109 124
110 dispose: function() 125 /**
126 * @param {!WebInspector.Event} event
127 */
128 _targetDisposed: function(event)
dgozman 2016/06/30 17:24:33 I wonder whether we should put this functionality
eostroukhov-old 2016/06/30 21:38:28 Done.
111 { 129 {
112 WebInspector.moduleSetting("cacheDisabled").removeChangeListener(this._c acheDisabledSettingChanged, this); 130 var target = /** @type {!WebInspector.Target} */ (event.data);
131 if (target === this._target)
132 WebInspector.moduleSetting("cacheDisabled").removeChangeListener(thi s._cacheDisabledSettingChanged, this);
dgozman 2016/06/30 17:24:32 Please also do the same for DebuggerModel. Thanks!
dgozman 2016/06/30 17:24:33 Please also remove the listener for TargetDisposed
eostroukhov-old 2016/06/30 21:38:28 Done.
eostroukhov-old 2016/06/30 21:38:28 Done.
113 }, 133 },
114 134
115 /** 135 /**
116 * @param {!SecurityAgent.CertificateId} certificateId 136 * @param {!SecurityAgent.CertificateId} certificateId
117 * @return {!Promise<!NetworkAgent.CertificateDetails>} 137 * @return {!Promise<!NetworkAgent.CertificateDetails>}
118 */ 138 */
119 certificateDetailsPromise: function(certificateId) 139 certificateDetailsPromise: function(certificateId)
120 { 140 {
121 var cachedPromise = this._certificateDetailsCache.get(certificateId); 141 var cachedPromise = this._certificateDetailsCache.get(certificateId);
122 if (cachedPromise) 142 if (cachedPromise)
(...skipping 784 matching lines...) Expand 10 before | Expand all | Expand 10 after
907 WebInspector.ResourceLoader.load(url, headers, callback); 927 WebInspector.ResourceLoader.load(url, headers, callback);
908 }, 928 },
909 929
910 __proto__: WebInspector.Object.prototype 930 __proto__: WebInspector.Object.prototype
911 } 931 }
912 932
913 /** 933 /**
914 * @type {!WebInspector.MultitargetNetworkManager} 934 * @type {!WebInspector.MultitargetNetworkManager}
915 */ 935 */
916 WebInspector.multitargetNetworkManager; 936 WebInspector.multitargetNetworkManager;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698