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

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

Issue 8200011: Add NetLog support to UDP sockets. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Don't do address conversions on windows when we don't have to. Created 9 years, 2 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 /** 5 /**
6 * A SourceEntry gathers all log entries with the same source. 6 * A SourceEntry gathers all log entries with the same source.
7 * 7 *
8 * @constructor 8 * @constructor
9 */ 9 */
10 function SourceEntry(logEntry, maxPreviousSourceId) { 10 function SourceEntry(logEntry, maxPreviousSourceId) {
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 break; 88 break;
89 case LogSourceType.DISK_CACHE_ENTRY: 89 case LogSourceType.DISK_CACHE_ENTRY:
90 case LogSourceType.MEMORY_CACHE_ENTRY: 90 case LogSourceType.MEMORY_CACHE_ENTRY:
91 this.description_ = e.params.key; 91 this.description_ = e.params.key;
92 break; 92 break;
93 case LogSourceType.SPDY_SESSION: 93 case LogSourceType.SPDY_SESSION:
94 if (e.params.host) 94 if (e.params.host)
95 this.description_ = e.params.host + ' (' + e.params.proxy + ')'; 95 this.description_ = e.params.host + ' (' + e.params.proxy + ')';
96 break; 96 break;
97 case LogSourceType.SOCKET: 97 case LogSourceType.SOCKET:
98 // Use description of parent source, if any.
98 if (e.params.source_dependency != undefined) { 99 if (e.params.source_dependency != undefined) {
99 var connectJobId = e.params.source_dependency.id; 100 var parentId = e.params.source_dependency.id;
100 var connectJob = g_browser.sourceTracker.getSourceEntry(connectJobId); 101 this.description_ = g_browser.sourceTracker.getDescription(parentId);
101 if (connectJob) 102 }
102 this.description_ = connectJob.getDescription(); 103 break;
104 case LogSourceType.UDP_SOCKET:
105 if (e.params.address != undefined) {
106 this.description_ = e.params.address;
107 // If the parent of |this| is a DNS_TRANSACTION, use
108 // '<DNS Server IP> [<DNS we're resolving>]'.
109 if (this.entries_[0].type == LogEventType.SOCKET_ALIVE &&
110 this.entries_[0].params.source_dependency != undefined) {
111 var parentId = this.entries_[0].params.source_dependency.id;
112 var parent = g_browser.sourceTracker.getSourceEntry(parentId);
113 if (parent &&
114 parent.getSourceType() == LogSourceType.DNS_TRANSACTION &&
115 parent.getDescription().length > 0) {
116 this.description_ += ' [' + parent.getDescription() + ']';
117 }
118 }
103 } 119 }
104 break; 120 break;
105 case LogSourceType.ASYNC_HOST_RESOLVER_REQUEST: 121 case LogSourceType.ASYNC_HOST_RESOLVER_REQUEST:
106 case LogSourceType.DNS_TRANSACTION: 122 case LogSourceType.DNS_TRANSACTION:
107 this.description_ = e.params.hostname; 123 this.description_ = e.params.hostname;
108 break; 124 break;
109 } 125 }
110 126
111 if (this.description_ == undefined) 127 if (this.description_ == undefined)
112 this.description_ = ''; 128 this.description_ = '';
(...skipping 12 matching lines...) Expand all
125 * Returns the starting entry for this source. Conceptually this is the 141 * Returns the starting entry for this source. Conceptually this is the
126 * first entry that was logged to this source. However, we skip over the 142 * first entry that was logged to this source. However, we skip over the
127 * TYPE_REQUEST_ALIVE entries which wrap TYPE_URL_REQUEST_START_JOB / 143 * TYPE_REQUEST_ALIVE entries which wrap TYPE_URL_REQUEST_START_JOB /
128 * TYPE_SOCKET_STREAM_CONNECT. 144 * TYPE_SOCKET_STREAM_CONNECT.
129 */ 145 */
130 SourceEntry.prototype.getStartEntry_ = function() { 146 SourceEntry.prototype.getStartEntry_ = function() {
131 if (this.entries_.length < 1) 147 if (this.entries_.length < 1)
132 return undefined; 148 return undefined;
133 if (this.entries_.length >= 2) { 149 if (this.entries_.length >= 2) {
134 if (this.entries_[0].type == LogEventType.REQUEST_ALIVE || 150 if (this.entries_[0].type == LogEventType.REQUEST_ALIVE ||
135 this.entries_[0].type == LogEventType.SOCKET_POOL_CONNECT_JOB) 151 this.entries_[0].type == LogEventType.SOCKET_POOL_CONNECT_JOB ||
152 this.entries_[1].type == LogEventType.UDP_CONNECT) {
136 return this.entries_[1]; 153 return this.entries_[1];
154 }
137 } 155 }
138 return this.entries_[0]; 156 return this.entries_[0];
139 }; 157 };
140 158
141 SourceEntry.prototype.getLogEntries = function() { 159 SourceEntry.prototype.getLogEntries = function() {
142 return this.entries_; 160 return this.entries_;
143 }; 161 };
144 162
145 SourceEntry.prototype.getSourceTypeString = function() { 163 SourceEntry.prototype.getSourceTypeString = function() {
146 return getKeyWithValue(LogSourceType, this.entries_[0].source.type); 164 return getKeyWithValue(LogSourceType, this.entries_[0].source.type);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 SourceEntry.prototype.getDuration = function() { 208 SourceEntry.prototype.getDuration = function() {
191 var startTicks = this.entries_[0].time; 209 var startTicks = this.entries_[0].time;
192 var startTime = timeutil.convertTimeTicksToDate(startTicks).getTime(); 210 var startTime = timeutil.convertTimeTicksToDate(startTicks).getTime();
193 var endTime = this.getEndTime(); 211 var endTime = this.getEndTime();
194 return endTime - startTime; 212 return endTime - startTime;
195 }; 213 };
196 214
197 SourceEntry.prototype.printAsText = function() { 215 SourceEntry.prototype.printAsText = function() {
198 return PrintSourceEntriesAsText(this.entries_); 216 return PrintSourceEntriesAsText(this.entries_);
199 }; 217 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698