Skip to content

Commit

Permalink
Use wasm-compatible conditional import in timeline.dart, avoid emitti…
Browse files Browse the repository at this point in the history
…ng timeline events in SchedulerBinding (flutter#144682)
  • Loading branch information
mkustermann authored Mar 6, 2024
1 parent 7a88767 commit aba7bc3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/flutter/lib/src/foundation/timeline.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import 'dart:typed_data';
import 'package:meta/meta.dart';

import '_timeline_io.dart'
if (dart.library.js_util) '_timeline_web.dart' as impl;
if (dart.library.js_interop) '_timeline_web.dart' as impl;
import 'constants.dart';

/// Measures how long blocks of code take to run.
Expand Down
8 changes: 6 additions & 2 deletions packages/flutter/lib/src/scheduler/binding.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1318,13 +1318,17 @@ mixin SchedulerBinding on BindingBase {
final List<FrameCallback> localPostFrameCallbacks =
List<FrameCallback>.of(_postFrameCallbacks);
_postFrameCallbacks.clear();
Timeline.startSync('POST_FRAME');
if (!kReleaseMode) {
FlutterTimeline.startSync('POST_FRAME');
}
try {
for (final FrameCallback callback in localPostFrameCallbacks) {
_invokeFrameCallback(callback, _currentFrameTimeStamp!);
}
} finally {
Timeline.finishSync();
if (!kReleaseMode) {
FlutterTimeline.finishSync();
}
}
} finally {
_schedulerPhase = SchedulerPhase.idle;
Expand Down

0 comments on commit aba7bc3

Please sign in to comment.