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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/network/NetworkWaterfallColumn.js

Issue 2483853004: [Devtools] Renamed Network's Timeline to Waterfall (Closed)
Patch Set: [Devtools] Renamed Network's Timeline to Waterfall Created 4 years, 1 month 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 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 * @unrestricted 5 * @unrestricted
6 */ 6 */
7 WebInspector.NetworkTimelineColumn = class extends WebInspector.VBox { 7 WebInspector.NetworkWaterfallColumn = class extends WebInspector.VBox {
8 /** 8 /**
9 * @param {number} rowHeight 9 * @param {number} rowHeight
10 * @param {!WebInspector.NetworkTimeCalculator} calculator 10 * @param {!WebInspector.NetworkTimeCalculator} calculator
11 */ 11 */
12 constructor(rowHeight, calculator) { 12 constructor(rowHeight, calculator) {
13 // TODO(allada) Make this a shadowDOM when the NetworkTimelineColumn gets mo ved into NetworkLogViewColumns. 13 // TODO(allada) Make this a shadowDOM when the NetworkWaterfallColumn gets m oved into NetworkLogViewColumns.
14 super(false); 14 super(false);
15 this.registerRequiredCSS('network/networkTimelineColumn.css'); 15 this.registerRequiredCSS('network/networkWaterfallColumn.css');
16 16
17 this._canvas = this.contentElement.createChild('canvas'); 17 this._canvas = this.contentElement.createChild('canvas');
18 this._canvas.tabIndex = 1; 18 this._canvas.tabIndex = 1;
19 this.setDefaultFocusedElement(this._canvas); 19 this.setDefaultFocusedElement(this._canvas);
20 this._canvasPosition = this._canvas.getBoundingClientRect(); 20 this._canvasPosition = this._canvas.getBoundingClientRect();
21 21
22 /** @const */ 22 /** @const */
23 this._leftPadding = 5; 23 this._leftPadding = 5;
24 /** @const */ 24 /** @const */
25 this._fontSize = 10; 25 this._fontSize = 10;
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 178
179 scheduleDraw() { 179 scheduleDraw() {
180 if (this._updateRequestID) 180 if (this._updateRequestID)
181 return; 181 return;
182 this._updateRequestID = this.element.window().requestAnimationFrame(() => th is.update()); 182 this._updateRequestID = this.element.window().requestAnimationFrame(() => th is.update());
183 } 183 }
184 184
185 /** 185 /**
186 * @param {number=} scrollTop 186 * @param {number=} scrollTop
187 * @param {!Map<string, !Array<number>>=} eventDividers 187 * @param {!Map<string, !Array<number>>=} eventDividers
188 * @param {!WebInspector.NetworkTimelineColumn.RequestData=} requestData 188 * @param {!WebInspector.NetworkWaterfallColumn.RequestData=} requestData
189 */ 189 */
190 update(scrollTop, eventDividers, requestData) { 190 update(scrollTop, eventDividers, requestData) {
191 if (scrollTop !== undefined) 191 if (scrollTop !== undefined)
192 this._scrollTop = scrollTop; 192 this._scrollTop = scrollTop;
193 if (requestData) { 193 if (requestData) {
194 this._requestData = requestData.requests; 194 this._requestData = requestData.requests;
195 this._navigationRequest = requestData.navigationRequest; 195 this._navigationRequest = requestData.navigationRequest;
196 this._calculateCanvasSize(); 196 this._calculateCanvasSize();
197 } 197 }
198 if (eventDividers !== undefined) 198 if (eventDividers !== undefined)
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 context.lineTo(x, this._offsetHeight); 317 context.lineTo(x, this._offsetHeight);
318 } 318 }
319 context.stroke(); 319 context.stroke();
320 } 320 }
321 context.restore(); 321 context.restore();
322 } 322 }
323 323
324 /** 324 /**
325 * @return {number} 325 * @return {number}
326 */ 326 */
327 _timelineDuration() { 327 _waterfallDuration() {
328 return this._calculator.maximumBoundary() - this._calculator.minimumBoundary (); 328 return this._calculator.maximumBoundary() - this._calculator.minimumBoundary ();
329 } 329 }
330 330
331 /** 331 /**
332 * @param {!WebInspector.RequestTimeRangeNames=} type 332 * @param {!WebInspector.RequestTimeRangeNames=} type
333 * @return {number} 333 * @return {number}
334 */ 334 */
335 _getBarHeight(type) { 335 _getBarHeight(type) {
336 var types = WebInspector.RequestTimeRangeNames; 336 var types = WebInspector.RequestTimeRangeNames;
337 switch (type) { 337 switch (type) {
(...skipping 11 matching lines...) Expand all
349 } 349 }
350 350
351 /** 351 /**
352 * @param {!WebInspector.NetworkRequest} request 352 * @param {!WebInspector.NetworkRequest} request
353 * @return {string} 353 * @return {string}
354 */ 354 */
355 _borderColorForResourceType(request) { 355 _borderColorForResourceType(request) {
356 var resourceType = request.resourceType(); 356 var resourceType = request.resourceType();
357 if (this._borderColorsForResourceTypeCache.has(resourceType)) 357 if (this._borderColorsForResourceTypeCache.has(resourceType))
358 return this._borderColorsForResourceTypeCache.get(resourceType); 358 return this._borderColorsForResourceTypeCache.get(resourceType);
359 var colorsForResourceType = WebInspector.NetworkTimelineColumn._colorsForRes ourceType; 359 var colorsForResourceType = WebInspector.NetworkWaterfallColumn._colorsForRe sourceType;
360 var color = colorsForResourceType[resourceType] || colorsForResourceType.Oth er; 360 var color = colorsForResourceType[resourceType] || colorsForResourceType.Oth er;
361 var parsedColor = WebInspector.Color.parse(color); 361 var parsedColor = WebInspector.Color.parse(color);
362 var hsla = parsedColor.hsla(); 362 var hsla = parsedColor.hsla();
363 hsla[1] /= 2; 363 hsla[1] /= 2;
364 hsla[2] -= Math.min(hsla[2], 0.2); 364 hsla[2] -= Math.min(hsla[2], 0.2);
365 var resultColor = /** @type {string} */ (parsedColor.asString(null)); 365 var resultColor = /** @type {string} */ (parsedColor.asString(null));
366 this._borderColorsForResourceTypeCache.set(resourceType, resultColor); 366 this._borderColorsForResourceTypeCache.set(resourceType, resultColor);
367 return resultColor; 367 return resultColor;
368 } 368 }
369 369
370 /** 370 /**
371 * @param {!CanvasRenderingContext2D} context 371 * @param {!CanvasRenderingContext2D} context
372 * @param {!WebInspector.NetworkRequest} request 372 * @param {!WebInspector.NetworkRequest} request
373 * @return {string|!CanvasGradient} 373 * @return {string|!CanvasGradient}
374 */ 374 */
375 _colorForResourceType(context, request) { 375 _colorForResourceType(context, request) {
376 var colorsForResourceType = WebInspector.NetworkTimelineColumn._colorsForRes ourceType; 376 var colorsForResourceType = WebInspector.NetworkWaterfallColumn._colorsForRe sourceType;
377 var resourceType = request.resourceType(); 377 var resourceType = request.resourceType();
378 var color = colorsForResourceType[resourceType] || colorsForResourceType.Oth er; 378 var color = colorsForResourceType[resourceType] || colorsForResourceType.Oth er;
379 if (request.cached()) 379 if (request.cached())
380 return color; 380 return color;
381 381
382 if (this._colorsForResourceTypeCache.has(color)) 382 if (this._colorsForResourceTypeCache.has(color))
383 return this._colorsForResourceTypeCache.get(color); 383 return this._colorsForResourceTypeCache.get(color);
384 var parsedColor = WebInspector.Color.parse(color); 384 var parsedColor = WebInspector.Color.parse(color);
385 var hsla = parsedColor.hsla(); 385 var hsla = parsedColor.hsla();
386 hsla[1] -= Math.min(hsla[1], 0.28); 386 hsla[1] -= Math.min(hsla[1], 0.28);
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
577 return; 577 return;
578 context.save(); 578 context.save();
579 context.beginPath(); 579 context.beginPath();
580 context.fillStyle = color; 580 context.fillStyle = color;
581 context.rect(0, y, this._offsetWidth, this._rowHeight); 581 context.rect(0, y, this._offsetWidth, this._rowHeight);
582 context.fill(); 582 context.fill();
583 context.restore(); 583 context.restore();
584 584
585 /** 585 /**
586 * @return {string} 586 * @return {string}
587 * @this {WebInspector.NetworkTimelineColumn} 587 * @this {WebInspector.NetworkWaterfallColumn}
588 */ 588 */
589 function getRowColor() { 589 function getRowColor() {
590 if (this._hoveredRequest === request) 590 if (this._hoveredRequest === request)
591 return this._rowHoverColor; 591 return this._rowHoverColor;
592 if (this._initiatorGraph) { 592 if (this._initiatorGraph) {
593 if (this._initiatorGraph.initiators.has(request)) 593 if (this._initiatorGraph.initiators.has(request))
594 return this._parentInitiatorColor; 594 return this._parentInitiatorColor;
595 if (this._initiatorGraph.initiated.has(request)) 595 if (this._initiatorGraph.initiated.has(request))
596 return this._initiatedColor; 596 return this._initiatedColor;
597 } 597 }
598 if (this._navigationRequest === request) 598 if (this._navigationRequest === request)
599 return this._rowNavigationRequestColor; 599 return this._rowNavigationRequestColor;
600 if (rowNumber % 2 === 1) 600 if (rowNumber % 2 === 1)
601 return 'transparent'; 601 return 'transparent';
602 return this._rowStripeColor; 602 return this._rowStripeColor;
603 } 603 }
604 } 604 }
605 }; 605 };
606 606
607 /** 607 /**
608 * @typedef {{requests: !Array<!WebInspector.NetworkRequest>, navigationRequest: ?WebInspector.NetworkRequest}} 608 * @typedef {{requests: !Array<!WebInspector.NetworkRequest>, navigationRequest: ?WebInspector.NetworkRequest}}
609 */ 609 */
610 WebInspector.NetworkTimelineColumn.RequestData; 610 WebInspector.NetworkWaterfallColumn.RequestData;
611 611
612 WebInspector.NetworkTimelineColumn._colorsForResourceType = { 612 WebInspector.NetworkWaterfallColumn._colorsForResourceType = {
613 document: 'hsl(215, 100%, 80%)', 613 document: 'hsl(215, 100%, 80%)',
614 font: 'hsl(8, 100%, 80%)', 614 font: 'hsl(8, 100%, 80%)',
615 media: 'hsl(272, 64%, 80%)', 615 media: 'hsl(272, 64%, 80%)',
616 image: 'hsl(272, 64%, 80%)', 616 image: 'hsl(272, 64%, 80%)',
617 script: 'hsl(31, 100%, 80%)', 617 script: 'hsl(31, 100%, 80%)',
618 stylesheet: 'hsl(90, 50%, 80%)', 618 stylesheet: 'hsl(90, 50%, 80%)',
619 texttrack: 'hsl(8, 100%, 80%)', 619 texttrack: 'hsl(8, 100%, 80%)',
620 websocket: 'hsl(0, 0%, 95%)', 620 websocket: 'hsl(0, 0%, 95%)',
621 xhr: 'hsl(53, 100%, 80%)', 621 xhr: 'hsl(53, 100%, 80%)',
622 other: 'hsl(0, 0%, 95%)' 622 other: 'hsl(0, 0%, 95%)'
623 }; 623 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698