mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
This reverts commit 265168170d
.
Co-authored-by: Kaushik Iska <kaushikiska@google.com>
This commit is contained in:
parent
be0076f3f9
commit
cb88d2a3af
@ -34,8 +34,12 @@ class TimelineEvent {
|
||||
json['ph'] as String,
|
||||
json['pid'] as int,
|
||||
json['tid'] as int,
|
||||
json['dur'] != null ? Duration(microseconds: json['dur'] as int) : null,
|
||||
json['tdur'] != null ? Duration(microseconds: json['tdur'] as int) : null,
|
||||
json['dur'] != null
|
||||
? Duration(microseconds: json['dur'] as int)
|
||||
: null,
|
||||
json['tdur'] != null
|
||||
? Duration(microseconds: json['tdur'] as int)
|
||||
: null,
|
||||
json['ts'] as int,
|
||||
json['tts'] as int,
|
||||
json['args'] as Map<String, dynamic>,
|
||||
@ -120,20 +124,11 @@ class TimelineEvent {
|
||||
List<TimelineEvent> _parseEvents(Map<String, dynamic> json) {
|
||||
final List<dynamic> jsonEvents = json['traceEvents'] as List<dynamic>;
|
||||
|
||||
if (jsonEvents == null) {
|
||||
if (jsonEvents == null)
|
||||
return null;
|
||||
}
|
||||
|
||||
// TODO(vegorov): use instance method version of castFrom when it is available.
|
||||
final List<TimelineEvent> timelineEvents =
|
||||
Iterable.castFrom<dynamic, Map<String, dynamic>>(jsonEvents)
|
||||
.map<TimelineEvent>(
|
||||
(Map<String, dynamic> eventJson) => TimelineEvent(eventJson))
|
||||
.toList();
|
||||
|
||||
timelineEvents.sort((TimelineEvent e1, TimelineEvent e2) {
|
||||
return e1.timestampMicros.compareTo(e2.timestampMicros);
|
||||
});
|
||||
|
||||
return timelineEvents;
|
||||
return Iterable.castFrom<dynamic, Map<String, dynamic>>(jsonEvents)
|
||||
.map<TimelineEvent>((Map<String, dynamic> eventJson) => TimelineEvent(eventJson))
|
||||
.toList();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user