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

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

Issue 2470593002: [Devtools] New network canvas timeline now properly shows initiators (Closed)
Patch Set: changes 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/front_end/network/NetworkLogViewColumns.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2008, 2009 Anthony Ricaud <rik@webkit.org> 3 * Copyright (C) 2008, 2009 Anthony Ricaud <rik@webkit.org>
4 * Copyright (C) 2011 Google Inc. All rights reserved. 4 * Copyright (C) 2011 Google Inc. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 9 *
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 this._dataGrid.element.addEventListener("mousemove", this._dataGridMouse Move.bind(this), true); 344 this._dataGrid.element.addEventListener("mousemove", this._dataGridMouse Move.bind(this), true);
345 this._dataGrid.element.addEventListener("mouseleave", this._dataGridMous eLeave.bind(this), true); 345 this._dataGrid.element.addEventListener("mouseleave", this._dataGridMous eLeave.bind(this), true);
346 }, 346 },
347 347
348 /** 348 /**
349 * @param {!Event} event 349 * @param {!Event} event
350 */ 350 */
351 _dataGridMouseMove: function(event) 351 _dataGridMouseMove: function(event)
352 { 352 {
353 var node = this._dataGrid.dataGridNodeFromNode(event.target); 353 var node = this._dataGrid.dataGridNodeFromNode(event.target);
354 this._setHoveredNode(node); 354 var highlightInitiatorChain = event.shiftKey;
355 this._highlightInitiatorChain((event.shiftKey && node) ? node.request() : null); 355 this._setHoveredNode(node, highlightInitiatorChain);
356 this._highlightInitiatorChain((highlightInitiatorChain && node) ? node.r equest() : null);
356 }, 357 },
357 358
358 _dataGridMouseLeave: function() 359 _dataGridMouseLeave: function()
359 { 360 {
360 this._setHoveredNode(null); 361 this._setHoveredNode(null);
361 this._highlightInitiatorChain(null); 362 this._highlightInitiatorChain(null);
362 }, 363 },
363 364
364 /** 365 /**
365 * @param {?WebInspector.NetworkRequest} request 366 * @param {?WebInspector.NetworkRequest} request
367 * @param {boolean} highlightInitiatorChain
366 */ 368 */
367 setHoveredRequest: function(request) 369 setHoveredRequest: function(request, highlightInitiatorChain)
368 { 370 {
369 this._setHoveredNode(request ? this._nodesByRequestId.get(request.reques tId) : null); 371 this._setHoveredNode(request ? this._nodesByRequestId.get(request.reques tId) : null, highlightInitiatorChain);
372 this._highlightInitiatorChain((request && highlightInitiatorChain) ? req uest : null);
370 }, 373 },
371 374
372 /** 375 /**
373 * @param {?WebInspector.NetworkDataGridNode} node 376 * @param {?WebInspector.NetworkDataGridNode} node
377 * @param {boolean=} highlightInitiatorChain
374 */ 378 */
375 _setHoveredNode: function(node) 379 _setHoveredNode: function(node, highlightInitiatorChain)
376 { 380 {
377 if (this._hoveredNode) 381 if (this._hoveredNode)
378 this._hoveredNode.element().classList.remove("hover"); 382 this._hoveredNode.element().classList.remove("hover");
379 this._hoveredNode = node; 383 this._hoveredNode = node;
380 if (this._hoveredNode) 384 if (this._hoveredNode)
381 this._hoveredNode.element().classList.add("hover"); 385 this._hoveredNode.element().classList.add("hover");
382 this._columns.setHoveredRequest(this._hoveredNode ? this._hoveredNode.re quest() : null); 386 this._columns.setHoveredRequest(this._hoveredNode ? this._hoveredNode.re quest() : null, !!highlightInitiatorChain);
383 }, 387 },
384 388
385 /** 389 /**
386 * @param {!Event} event 390 * @param {!Event} event
387 */ 391 */
388 _dataGridMouseDown: function(event) 392 _dataGridMouseDown: function(event)
389 { 393 {
390 if ((!this._dataGrid.selectedNode && event.button) || event.target.enclo singNodeOrSelfWithNodeName("a")) 394 if ((!this._dataGrid.selectedNode && event.button) || event.target.enclo singNodeOrSelfWithNodeName("a"))
391 event.consume(); 395 event.consume();
392 }, 396 },
393 397
394 /** 398 /**
395 * @param {?WebInspector.NetworkRequest} request 399 * @param {?WebInspector.NetworkRequest} request
396 */ 400 */
397 _highlightInitiatorChain: function(request) 401 _highlightInitiatorChain: function(request)
398 { 402 {
399 if (this._requestWithHighlightedInitiators === request) 403 if (this._requestWithHighlightedInitiators === request)
400 return; 404 return;
401 this._requestWithHighlightedInitiators = request; 405 this._requestWithHighlightedInitiators = request;
402 406
403 if (!request) { 407 if (!request) {
404 for (var node of this._nodesByRequestId.values()) { 408 for (var node of this._nodesByRequestId.values()) {
405 if (!node.dataGrid) 409 if (!node.dataGrid)
406 continue; 410 continue;
407 node.element().classList.remove("network-node-on-initiator-path" , "network-node-on-initiated-path"); 411 node.element().classList.remove("network-node-on-initiator-path" , "network-node-on-initiated-path");
408 } 412 }
409 return; 413 return;
410 } 414 }
411 415
412 var initiators = request.initiatorChain(); 416 var initiatorGraph = request.initiatorGraph();
413 var initiated = new Set();
414 for (var node of this._nodesByRequestId.values()) { 417 for (var node of this._nodesByRequestId.values()) {
415 if (!node.dataGrid) 418 if (!node.dataGrid)
416 continue; 419 continue;
417 var localInitiators = node.request().initiatorChain(); 420 node.element().classList.toggle("network-node-on-initiator-path", no de.request() !== request && initiatorGraph.initiators.has(node.request()));
418 if (localInitiators.has(request)) 421 node.element().classList.toggle("network-node-on-initiated-path", no de.request() !== request && initiatorGraph.initiated.has(node.request()));
419 initiated.add(node.request());
420 }
421
422 for (var node of this._nodesByRequestId.values()) {
423 if (!node.dataGrid)
424 continue;
425 node.element().classList.toggle("network-node-on-initiator-path", no de.request() !== request && initiators.has(node.request()));
426 node.element().classList.toggle("network-node-on-initiated-path", no de.request() !== request && initiated.has(node.request()));
427 } 422 }
428 }, 423 },
429 424
430 _updateSummaryBar: function() 425 _updateSummaryBar: function()
431 { 426 {
432 var requestsNumber = this._nodesByRequestId.size; 427 var requestsNumber = this._nodesByRequestId.size;
433 428
434 if (!requestsNumber) { 429 if (!requestsNumber) {
435 this._showRecordingHint(); 430 this._showRecordingHint();
436 return; 431 return;
(...skipping 1333 matching lines...) Expand 10 before | Expand all | Expand 10 after
1770 * @return {boolean} 1765 * @return {boolean}
1771 */ 1766 */
1772 WebInspector.NetworkLogView._requestTimeFilter = function(windowStart, windowEnd , request) 1767 WebInspector.NetworkLogView._requestTimeFilter = function(windowStart, windowEnd , request)
1773 { 1768 {
1774 if (request.issueTime() > windowEnd) 1769 if (request.issueTime() > windowEnd)
1775 return false; 1770 return false;
1776 if (request.endTime !== -1 && request.endTime < windowStart) 1771 if (request.endTime !== -1 && request.endTime < windowStart)
1777 return false; 1772 return false;
1778 return true; 1773 return true;
1779 }; 1774 };
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/front_end/network/NetworkLogViewColumns.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698