Skip to content

Commit e3d8493

Browse files
committed
Move more dart:developer usage under if (!kReleaseMode) {} guard
This mirrors changes done e.g. in [0] which did the same changes to e.g. `BindingBase` class. [0] flutter/flutter@07772a3 Issue WebKit/JetStream#95 Change-Id: I239e1e0a2206164c55050c4f21c74367d9817574 Reviewed-on: https://dart-review.googlesource.com/c/flute/+/442880 Commit-Queue: Martin Kustermann <[email protected]> Reviewed-by: Alexander Thomas <[email protected]>
1 parent 6e44eea commit e3d8493

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

framework/lib/src/foundation/binding.dart

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,9 @@ abstract class BindingBase {
140140
/// [initServiceExtensions] to have bindings initialize their
141141
/// VM service extensions, if any.
142142
BindingBase() {
143-
developer.Timeline.startSync('Framework initialization');
143+
if (!kReleaseMode) {
144+
developer.Timeline.startSync('Framework initialization');
145+
}
144146
assert(() {
145147
_debugConstructed = true;
146148
return true;
@@ -154,9 +156,10 @@ abstract class BindingBase {
154156
initServiceExtensions();
155157
assert(_debugServiceExtensionsRegistered);
156158

157-
developer.postEvent('Flutter.FrameworkInitialization', <String, String>{});
158-
159-
developer.Timeline.finishSync();
159+
if (!kReleaseMode) {
160+
developer.postEvent('Flutter.FrameworkInitialization', <String, String>{});
161+
developer.Timeline.finishSync();
162+
}
160163
}
161164

162165
bool _debugConstructed = false;
@@ -550,14 +553,19 @@ abstract class BindingBase {
550553
/// The [Future] returned by the `callback` argument is returned by [lockEvents].
551554
@protected
552555
Future<void> lockEvents(Future<void> Function() callback) {
553-
final developer.TimelineTask timelineTask = developer.TimelineTask()..start('Lock events');
556+
developer.TimelineTask? timelineTask;
557+
if (!kReleaseMode) {
558+
timelineTask = developer.TimelineTask()..start('Lock events');
559+
}
554560

555561
_lockCount += 1;
556562
final Future<void> future = callback();
557563
future.whenComplete(() {
558564
_lockCount -= 1;
559565
if (!locked) {
560-
timelineTask.finish();
566+
if (!kReleaseMode) {
567+
timelineTask!.finish();
568+
}
561569
unlocked();
562570
}
563571
});

0 commit comments

Comments
 (0)