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

Unified Diff: third_party/WebKit/Source/devtools/front_end/sdk/TracingModel.js

Issue 2163093003: [DevTools] Remove Object.values and Object.isEmpty from utilities.js (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/devtools/front_end/sdk/TracingModel.js
diff --git a/third_party/WebKit/Source/devtools/front_end/sdk/TracingModel.js b/third_party/WebKit/Source/devtools/front_end/sdk/TracingModel.js
index 1e50f8d70a35095a674900d0e895d3d37c873d4a..d9d800767c26b7d11646ac1d7abbcfdac2448905 100644
--- a/third_party/WebKit/Source/devtools/front_end/sdk/TracingModel.js
+++ b/third_party/WebKit/Source/devtools/front_end/sdk/TracingModel.js
@@ -160,16 +160,16 @@ WebInspector.TracingModel.prototype = {
this._backingStorage.appendString(this._firstWritePending ? "[]" : "]");
this._backingStorage.finishWriting();
this._firstWritePending = false;
- for (var process of Object.values(this._processById)) {
- for (var thread of Object.values(process._threads))
+ for (var process of this._processById.values()) {
+ for (var thread of process._threads.values())
thread.tracingComplete();
}
},
reset: function()
{
- /** @type {!Object.<(number|string), !WebInspector.TracingModel.Process>} */
- this._processById = {};
+ /** @type {!Map<(number|string), !WebInspector.TracingModel.Process>} */
+ this._processById = new Map();
this._processByName = new Map();
this._minimumRecordTime = 0;
this._maximumRecordTime = 0;
@@ -193,10 +193,10 @@ WebInspector.TracingModel.prototype = {
*/
_addEvent: function(payload)
{
- var process = this._processById[payload.pid];
+ var process = this._processById.get(payload.pid);
if (!process) {
process = new WebInspector.TracingModel.Process(this, payload.pid);
- this._processById[payload.pid] = process;
+ this._processById.set(payload.pid, process);
}
var eventsDelimiter = ",\n";
@@ -272,7 +272,7 @@ WebInspector.TracingModel.prototype = {
*/
sortedProcesses: function()
{
- return WebInspector.TracingModel.NamedObject._sort(Object.values(this._processById));
+ return WebInspector.TracingModel.NamedObject._sort(Array.from(this._processById.values()));
lushnikov 2016/07/20 03:02:50 valuesArray
kozy 2016/07/20 17:55:18 Done.
},
/**
@@ -750,8 +750,8 @@ WebInspector.TracingModel.Process = function(model, id)
WebInspector.TracingModel.NamedObject.call(this);
this._setName("Process " + id);
this._id = id;
- /** @type {!Object.<number, !WebInspector.TracingModel.Thread>} */
- this._threads = {};
+ /** @type {!Map<number, !WebInspector.TracingModel.Thread>} */
+ this._threads = new Map();
this._threadByName = new Map();
this._model = model;
}
@@ -771,10 +771,10 @@ WebInspector.TracingModel.Process.prototype = {
*/
threadById: function(id)
{
- var thread = this._threads[id];
+ var thread = this._threads.get(id);
if (!thread) {
thread = new WebInspector.TracingModel.Thread(this, id);
- this._threads[id] = thread;
+ this._threads.set(id, thread);
}
return thread;
},
@@ -811,7 +811,7 @@ WebInspector.TracingModel.Process.prototype = {
*/
sortedThreads: function()
{
- return WebInspector.TracingModel.NamedObject._sort(Object.values(this._threads));
+ return WebInspector.TracingModel.NamedObject._sort(Array.from(this._threads.values()));
lushnikov 2016/07/20 03:02:50 valuesArray
kozy 2016/07/20 17:55:18 Done.
},
__proto__: WebInspector.TracingModel.NamedObject.prototype

Powered by Google App Engine
This is Rietveld 408576698