OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 * @constructor | 6 * @constructor |
7 * @extends {WebInspector.VBox} | 7 * @extends {WebInspector.VBox} |
8 * @param {!WebInspector.NetworkRequest} request | 8 * @param {!WebInspector.NetworkRequest} request |
9 */ | 9 */ |
10 WebInspector.EventSourceMessagesView = function(request) | 10 WebInspector.EventSourceMessagesView = function(request) |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 | 72 |
73 /** | 73 /** |
74 * @constructor | 74 * @constructor |
75 * @extends {WebInspector.SortableDataGridNode} | 75 * @extends {WebInspector.SortableDataGridNode} |
76 * @param {!WebInspector.NetworkRequest.EventSourceMessage} message | 76 * @param {!WebInspector.NetworkRequest.EventSourceMessage} message |
77 */ | 77 */ |
78 WebInspector.EventSourceMessageNode = function(message) | 78 WebInspector.EventSourceMessageNode = function(message) |
79 { | 79 { |
80 this._message = message; | 80 this._message = message; |
81 var time = new Date(message.time * 1000); | 81 var time = new Date(message.time * 1000); |
82 var timeText = ("0" + time.getHours()).substr(-2) + ":" + ("0" + time.getMin
utes()).substr(-2)+ ":" + ("0" + time.getSeconds()).substr(-2) + "." + ("00" + t
ime.getMilliseconds()).substr(-3); | 82 var timeText = ("0" + time.getHours()).substr(-2) + ":" + ("0" + time.getMin
utes()).substr(-2) + ":" + ("0" + time.getSeconds()).substr(-2) + "." + ("00" +
time.getMilliseconds()).substr(-3); |
83 var timeNode = createElement("div"); | 83 var timeNode = createElement("div"); |
84 timeNode.createTextChild(timeText); | 84 timeNode.createTextChild(timeText); |
85 timeNode.title = time.toLocaleString(); | 85 timeNode.title = time.toLocaleString(); |
86 WebInspector.SortableDataGridNode.call(this, {id: message.eventId, type: mes
sage.eventName, data: message.data, time: timeNode}); | 86 WebInspector.SortableDataGridNode.call(this, {id: message.eventId, type: mes
sage.eventName, data: message.data, time: timeNode}); |
87 } | 87 } |
88 | 88 |
89 WebInspector.EventSourceMessageNode.prototype = { | 89 WebInspector.EventSourceMessageNode.prototype = { |
90 __proto__: WebInspector.SortableDataGridNode.prototype | 90 __proto__: WebInspector.SortableDataGridNode.prototype |
91 } | 91 } |
92 | 92 |
93 /** | 93 /** |
94 * @param {string} field | 94 * @param {string} field |
95 * @param {!WebInspector.EventSourceMessageNode} a | 95 * @param {!WebInspector.EventSourceMessageNode} a |
96 * @param {!WebInspector.EventSourceMessageNode} b | 96 * @param {!WebInspector.EventSourceMessageNode} b |
97 * @return {number} | 97 * @return {number} |
98 */ | 98 */ |
99 WebInspector.EventSourceMessageNodeComparator = function(field, a, b) | 99 WebInspector.EventSourceMessageNodeComparator = function(field, a, b) |
100 { | 100 { |
101 var aValue = a._message[field]; | 101 var aValue = a._message[field]; |
102 var bValue = b._message[field]; | 102 var bValue = b._message[field]; |
103 return aValue < bValue ? -1 : aValue > bValue ? 1 : 0; | 103 return aValue < bValue ? -1 : aValue > bValue ? 1 : 0; |
104 } | 104 } |
105 | 105 |
106 /** @type {!Object.<string, !WebInspector.SortableDataGrid.NodeComparator>} */ | 106 /** @type {!Object.<string, !WebInspector.SortableDataGrid.NodeComparator>} */ |
107 WebInspector.EventSourceMessageNode.Comparators = { | 107 WebInspector.EventSourceMessageNode.Comparators = { |
108 "id": WebInspector.EventSourceMessageNodeComparator.bind(null, "eventId"), | 108 "id": WebInspector.EventSourceMessageNodeComparator.bind(null, "eventId"), |
109 "type": WebInspector.EventSourceMessageNodeComparator.bind(null, "eventName"
), | 109 "type": WebInspector.EventSourceMessageNodeComparator.bind(null, "eventName"
), |
110 "time": WebInspector.EventSourceMessageNodeComparator.bind(null, "time") | 110 "time": WebInspector.EventSourceMessageNodeComparator.bind(null, "time") |
111 }; | 111 }; |
OLD | NEW |