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

Unified Diff: tracing/tracing/model/event_set.html

Issue 2162963002: [polymer] Merge of master into polymer10-migration (Closed) Base URL: git@github.com:catapult-project/catapult.git@polymer10-migration
Patch Set: Merge polymer10-migration int polymer10-merge 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
« no previous file with comments | « tracing/tracing/model/event_container.html ('k') | tracing/tracing/model/global_memory_dump_test.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tracing/tracing/model/event_set.html
diff --git a/tracing/tracing/model/event_set.html b/tracing/tracing/model/event_set.html
index c79ddc85302d780c6a385d43ce176fa1da52027a..ad3b5f8520be7b94df31c1be49f433172e232dd1 100644
--- a/tracing/tracing/model/event_set.html
+++ b/tracing/tracing/model/event_set.html
@@ -190,21 +190,14 @@ tr.exportTo('tr.model', function() {
});
},
- getEventsOrganizedByCallback: function(cb) {
- var eventsByCallback = {};
- for (var i = 0; i < this.length; i++) {
- var event = this[i];
- var key = cb(event);
-
- if (key === undefined)
- throw new Error('An event could not be organized');
-
- if (eventsByCallback[key] === undefined)
- eventsByCallback[key] = new EventSet();
-
- eventsByCallback[key].push(event);
- }
- return eventsByCallback;
+ /**
+ * @param {!function(!tr.model.Event):string} cb
+ * @param {*=} opt_this
+ * @return {!Object}
+ */
+ getEventsOrganizedByCallback: function(cb, opt_this) {
+ var groupedEvents = tr.b.group(this, cb, opt_this || this);
+ return tr.b.mapItems(groupedEvents, (_, events) => new EventSet(events));
},
enumEventsOfType: function(type, func) {
« no previous file with comments | « tracing/tracing/model/event_container.html ('k') | tracing/tracing/model/global_memory_dump_test.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698