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

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

Issue 9288084: Added Net logging to FileStream. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Clarified comments Created 8 years, 10 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 var SourceEntry = (function() { 5 var SourceEntry = (function() {
6 'use strict'; 6 'use strict';
7 7
8 /** 8 /**
9 * A SourceEntry gathers all log entries with the same source. 9 * A SourceEntry gathers all log entries with the same source.
10 * 10 *
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 parent.getDescription().length > 0) { 124 parent.getDescription().length > 0) {
125 this.description_ += ' [' + parent.getDescription() + ']'; 125 this.description_ += ' [' + parent.getDescription() + ']';
126 } 126 }
127 } 127 }
128 } 128 }
129 break; 129 break;
130 case LogSourceType.ASYNC_HOST_RESOLVER_REQUEST: 130 case LogSourceType.ASYNC_HOST_RESOLVER_REQUEST:
131 case LogSourceType.DNS_TRANSACTION: 131 case LogSourceType.DNS_TRANSACTION:
132 this.description_ = e.params.hostname; 132 this.description_ = e.params.hostname;
133 break; 133 break;
134 case LogSourceType.FILESTREAM:
135 /* Use the open info */
136 e = this.findLogEntryByType(LogEventType.FILE_STREAM_OPEN);
137 if (e != undefined)
138 this.description_ = e.params.file_name;
139 break;
134 } 140 }
135 141
136 if (this.description_ == undefined) 142 if (this.description_ == undefined)
137 this.description_ = ''; 143 this.description_ = '';
138 }, 144 },
139 145
140 /** 146 /**
141 * Returns a description for this source log stream, which will be displayed 147 * Returns a description for this source log stream, which will be displayed
142 * in the list view. Most often this is a URL that identifies the request, 148 * in the list view. Most often this is a URL that identifies the request,
143 * or a hostname for a connect job, etc... 149 * or a hostname for a connect job, etc...
(...skipping 14 matching lines...) Expand all
158 if (this.entries_.length >= 2) { 164 if (this.entries_.length >= 2) {
159 if (this.entries_[0].type == LogEventType.REQUEST_ALIVE || 165 if (this.entries_[0].type == LogEventType.REQUEST_ALIVE ||
160 this.entries_[0].type == LogEventType.SOCKET_POOL_CONNECT_JOB || 166 this.entries_[0].type == LogEventType.SOCKET_POOL_CONNECT_JOB ||
161 this.entries_[1].type == LogEventType.UDP_CONNECT) { 167 this.entries_[1].type == LogEventType.UDP_CONNECT) {
162 return this.entries_[1]; 168 return this.entries_[1];
163 } 169 }
164 } 170 }
165 return this.entries_[0]; 171 return this.entries_[0];
166 }, 172 },
167 173
174 /**
175 * Returns the first entry with the specified type, or undefined if not
176 * found.
177 */
178 findLogEntryByType: function(type) {
179 for (var i = 0; i < this.entries_.length; ++i) {
180 if (this.entries_[i].type == type) {
181 return this.entries_[i];
182 }
183 }
184 return undefined;
185 },
186
168 getLogEntries: function() { 187 getLogEntries: function() {
169 return this.entries_; 188 return this.entries_;
170 }, 189 },
171 190
172 getSourceTypeString: function() { 191 getSourceTypeString: function() {
173 return getKeyWithValue(LogSourceType, this.entries_[0].source.type); 192 return getKeyWithValue(LogSourceType, this.entries_[0].source.type);
174 }, 193 },
175 194
176 getSourceType: function() { 195 getSourceType: function() {
177 return this.entries_[0].source.type; 196 return this.entries_[0].source.type;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 * Prints descriptive text about |entries_| to a new node added to the end 244 * Prints descriptive text about |entries_| to a new node added to the end
226 * of |parent|. 245 * of |parent|.
227 */ 246 */
228 printAsText: function(parent) { 247 printAsText: function(parent) {
229 printLogEntriesAsText(this.entries_, parent); 248 printLogEntriesAsText(this.entries_, parent);
230 } 249 }
231 }; 250 };
232 251
233 return SourceEntry; 252 return SourceEntry;
234 })(); 253 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698