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

Side by Side Diff: chrome/browser/resources/net_internals/sourceentry.js

Issue 3119027: Adds HostResolveImpl Requests and Jobs to log. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 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 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * Each row in the filtered items list is backed by a SourceEntry. This 6 * Each row in the filtered items list is backed by a SourceEntry. This
7 * instance contains all of the data pertaining to that row, and notifies 7 * instance contains all of the data pertaining to that row, and notifies
8 * its parent view (the RequestsView) whenever its data changes. 8 * its parent view (the RequestsView) whenever its data changes.
9 * 9 *
10 * @constructor 10 * @constructor
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 this.row_.style.display = 'none'; 60 this.row_.style.display = 'none';
61 } 61 }
62 }; 62 };
63 63
64 SourceEntry.prototype.update = function(logEntry) { 64 SourceEntry.prototype.update = function(logEntry) {
65 var prevStartEntry = this.getStartEntry_(); 65 var prevStartEntry = this.getStartEntry_();
66 this.entries_.push(logEntry); 66 this.entries_.push(logEntry);
67 var curStartEntry = this.getStartEntry_(); 67 var curStartEntry = this.getStartEntry_();
68 68
69 // If we just got the first entry for this source. 69 // If we just got the first entry for this source.
70 if (!prevStartEntry && curStartEntry) { 70 if (prevStartEntry != curStartEntry) {
71 this.createRow_(); 71 if (!prevStartEntry)
72 this.createRow_();
73 else
74 this.updateDescription_();
72 75
73 // Only apply the filter during the first update. 76 // Only apply the filter during the first update.
74 // TODO(eroman): once filters use other data, apply it on each update. 77 // TODO(eroman): once filters use other data, apply it on each update.
75 var matchesFilter = this.matchesFilter(this.parentView_.currentFilter_); 78 var matchesFilter = this.matchesFilter(this.parentView_.currentFilter_);
76 this.setIsMatchedByFilter(matchesFilter); 79 this.setIsMatchedByFilter(matchesFilter);
77 } 80 }
78 }; 81 };
79 82
80 SourceEntry.prototype.onCheckboxToggled_ = function() { 83 SourceEntry.prototype.onCheckboxToggled_ = function() {
81 this.setSelected(this.getSelectionCheckbox().checked); 84 this.setSelected(this.getSelectionCheckbox().checked);
(...skipping 27 matching lines...) Expand all
109 }; 112 };
110 113
111 SourceEntry.prototype.onMouseover_ = function() { 114 SourceEntry.prototype.onMouseover_ = function() {
112 this.setMouseoverStyle(true); 115 this.setMouseoverStyle(true);
113 }; 116 };
114 117
115 SourceEntry.prototype.onMouseout_ = function() { 118 SourceEntry.prototype.onMouseout_ = function() {
116 this.setMouseoverStyle(false); 119 this.setMouseoverStyle(false);
117 }; 120 };
118 121
122 SourceEntry.prototype.updateDescription_ = function() {
123 this.descriptionCell_.innerHTML = '';
124 addTextNode(this.descriptionCell_, this.getDescription());
125 }
126
119 SourceEntry.prototype.createRow_ = function() { 127 SourceEntry.prototype.createRow_ = function() {
120 // Create a row. 128 // Create a row.
121 var tr = addNode(this.parentView_.tableBody_, 'tr'); 129 var tr = addNode(this.parentView_.tableBody_, 'tr');
122 tr.style.display = 'none'; 130 tr.style.display = 'none';
123 this.row_ = tr; 131 this.row_ = tr;
124 132
125 var selectionCol = addNode(tr, 'td'); 133 var selectionCol = addNode(tr, 'td');
126 var checkbox = addNode(selectionCol, 'input'); 134 var checkbox = addNode(selectionCol, 'input');
127 checkbox.type = 'checkbox'; 135 checkbox.type = 'checkbox';
128 136
129 var idCell = addNode(tr, 'td'); 137 var idCell = addNode(tr, 'td');
130 idCell.style.textAlign = 'right'; 138 idCell.style.textAlign = 'right';
131 139
132 var typeCell = addNode(tr, 'td'); 140 var typeCell = addNode(tr, 'td');
133 var descriptionCell = addNode(tr, 'td'); 141 var descriptionCell = addNode(tr, 'td');
142 this.descriptionCell_ = descriptionCell;
134 143
135 // Connect listeners. 144 // Connect listeners.
136 checkbox.onchange = this.onCheckboxToggled_.bind(this); 145 checkbox.onchange = this.onCheckboxToggled_.bind(this);
137 146
138 var onclick = this.onClicked_.bind(this); 147 var onclick = this.onClicked_.bind(this);
139 idCell.onclick = onclick; 148 idCell.onclick = onclick;
140 typeCell.onclick = onclick; 149 typeCell.onclick = onclick;
141 descriptionCell.onclick = onclick; 150 descriptionCell.onclick = onclick;
142 151
143 tr.onmouseover = this.onMouseover_.bind(this); 152 tr.onmouseover = this.onMouseover_.bind(this);
144 tr.onmouseout = this.onMouseout_.bind(this); 153 tr.onmouseout = this.onMouseout_.bind(this);
145 154
146 // Set the cell values to match this source's data. 155 // Set the cell values to match this source's data.
147 if (this.getSourceId() >= 0) 156 if (this.getSourceId() >= 0)
148 addTextNode(idCell, this.getSourceId()); 157 addTextNode(idCell, this.getSourceId());
149 else 158 else
150 addTextNode(idCell, "-"); 159 addTextNode(idCell, "-");
151 var sourceTypeString = this.getSourceTypeString(); 160 var sourceTypeString = this.getSourceTypeString();
152 addTextNode(typeCell, sourceTypeString); 161 addTextNode(typeCell, sourceTypeString);
153 addTextNode(descriptionCell, this.getDescription()); 162 this.updateDescription_();
154 163
155 // Add a CSS classname specific to this source type (so CSS can specify 164 // Add a CSS classname specific to this source type (so CSS can specify
156 // different stylings for different types). 165 // different stylings for different types).
157 changeClassName(this.row_, "source_" + sourceTypeString, true); 166 changeClassName(this.row_, "source_" + sourceTypeString, true);
158 }; 167 };
159 168
160 /** 169 /**
161 * Returns a description for this source log stream, which will be displayed 170 * Returns a description for this source log stream, which will be displayed
162 * in the list view. Most often this is a URL that identifies the request, 171 * in the list view. Most often this is a URL that identifies the request,
163 * or a hostname for a connect job, etc... 172 * or a hostname for a connect job, etc...
(...skipping 11 matching lines...) Expand all
175 184
176 if (e.params == undefined) 185 if (e.params == undefined)
177 return ''; 186 return '';
178 187
179 switch (e.source.type) { 188 switch (e.source.type) {
180 case LogSourceType.URL_REQUEST: 189 case LogSourceType.URL_REQUEST:
181 case LogSourceType.SOCKET_STREAM: 190 case LogSourceType.SOCKET_STREAM:
182 return e.params.url; 191 return e.params.url;
183 case LogSourceType.CONNECT_JOB: 192 case LogSourceType.CONNECT_JOB:
184 return e.params.group_name; 193 return e.params.group_name;
194 case LogSourceType.HOST_RESOLVER_IMPL_REQUEST:
195 case LogSourceType.HOST_RESOLVER_IMPL_JOB:
196 return e.params.host;
185 } 197 }
186 198
187 return ''; 199 return '';
188 }; 200 };
189 201
190 /** 202 /**
191 * Returns the starting entry for this source. Conceptually this is the 203 * Returns the starting entry for this source. Conceptually this is the
192 * first entry that was logged to this source. However, we skip over the 204 * first entry that was logged to this source. However, we skip over the
193 * TYPE_REQUEST_ALIVE entries which wrap TYPE_URL_REQUEST_START_JOB / 205 * TYPE_REQUEST_ALIVE entries which wrap TYPE_URL_REQUEST_START_JOB /
194 * TYPE_SOCKET_STREAM_CONNECT. 206 * TYPE_SOCKET_STREAM_CONNECT.
195 */ 207 */
196 SourceEntry.prototype.getStartEntry_ = function() { 208 SourceEntry.prototype.getStartEntry_ = function() {
197 if (this.entries_.length < 1) 209 if (this.entries_.length < 1)
198 return undefined; 210 return undefined;
199 if (this.entries_[0].type != LogEventType.REQUEST_ALIVE) 211 if (this.entries_.length >= 2) {
200 return this.entries_[0]; 212 if (this.entries_[0].type == LogEventType.REQUEST_ALIVE ||
201 if (this.entries_.length < 2) 213 this.entries_[0].type == LogEventType.SOCKET_POOL_CONNECT_JOB)
202 return undefined; 214 return this.entries_[1];
203 return this.entries_[1]; 215 }
216 return this.entries_[0];
204 }; 217 };
205 218
206 SourceEntry.prototype.getLogEntries = function() { 219 SourceEntry.prototype.getLogEntries = function() {
207 return this.entries_; 220 return this.entries_;
208 }; 221 };
209 222
210 SourceEntry.prototype.getSourceTypeString = function() { 223 SourceEntry.prototype.getSourceTypeString = function() {
211 return getKeyWithValue(LogSourceType, this.entries_[0].source.type); 224 return getKeyWithValue(LogSourceType, this.entries_[0].source.type);
212 }; 225 };
213 226
214 SourceEntry.prototype.getSelectionCheckbox = function() { 227 SourceEntry.prototype.getSelectionCheckbox = function() {
215 return this.row_.childNodes[0].firstChild; 228 return this.row_.childNodes[0].firstChild;
216 }; 229 };
217 230
218 SourceEntry.prototype.getSourceId = function() { 231 SourceEntry.prototype.getSourceId = function() {
219 return this.id_; 232 return this.id_;
220 }; 233 };
221 234
222 SourceEntry.prototype.remove = function() { 235 SourceEntry.prototype.remove = function() {
223 this.setSelected(false); 236 this.setSelected(false);
224 this.setIsMatchedByFilter(false); 237 this.setIsMatchedByFilter(false);
225 this.row_.parentNode.removeChild(this.row_); 238 this.row_.parentNode.removeChild(this.row_);
226 }; 239 };
227 240
OLDNEW
« no previous file with comments | « chrome/browser/resources/net_internals/main.css ('k') | chrome/service/net/service_url_request_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698