Unverified Commit 37e25238 authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

Attempt to reduce usage of runtimeType (#31696)

parent fe9512fa
...@@ -11,3 +11,23 @@ ...@@ -11,3 +11,23 @@
/// a particular block of code will not be executed in release mode, and hence /// a particular block of code will not be executed in release mode, and hence
/// can be removed. /// can be removed.
const bool kReleaseMode = bool.fromEnvironment('dart.vm.product', defaultValue: false); const bool kReleaseMode = bool.fromEnvironment('dart.vm.product', defaultValue: false);
/// A constant that is true if the application was compiled in profile mode.
///
/// More specifically, this is a constant that is true if the application was
/// compiled in Dart with the '-Ddart.vm.profile=true' flag.
///
/// Since this is a const value, it can be used to indicate to the compiler that
/// a particular block of code will not be executed in profle mode, an hence
/// can be removed.
const bool kProfileMode = bool.fromEnvironment('dart.vm.profile', defaultValue: false);
/// A constant that is true if the application was compiled in debug mode.
///
/// More specifically, this is a constant that is true if the application was
/// not compiled with '-Ddart.vm.product=true' and '-Ddart.vm.profile=true'.
///
/// Since this is a const value, it can be used to indicate to the compiler that
/// a particular block of code will not be executed in debug mode, and hence
/// can be removed.
const bool kDebugMode = !kReleaseMode && !kProfileMode;
...@@ -280,7 +280,7 @@ abstract class ImplicitlyAnimatedWidgetState<T extends ImplicitlyAnimatedWidget> ...@@ -280,7 +280,7 @@ abstract class ImplicitlyAnimatedWidgetState<T extends ImplicitlyAnimatedWidget>
super.initState(); super.initState();
_controller = AnimationController( _controller = AnimationController(
duration: widget.duration, duration: widget.duration,
debugLabel: '${widget.toStringShort()}', debugLabel: kDebugMode ? '${widget.toStringShort()}' : null,
vsync: this, vsync: this,
); );
_updateCurve(); _updateCurve();
......
...@@ -507,7 +507,7 @@ class BallisticScrollActivity extends ScrollActivity { ...@@ -507,7 +507,7 @@ class BallisticScrollActivity extends ScrollActivity {
TickerProvider vsync, TickerProvider vsync,
) : super(delegate) { ) : super(delegate) {
_controller = AnimationController.unbounded( _controller = AnimationController.unbounded(
debugLabel: '$runtimeType', debugLabel: kDebugMode ? '$runtimeType' : null,
vsync: vsync, vsync: vsync,
) )
..addListener(_tick) ..addListener(_tick)
......
...@@ -90,7 +90,7 @@ mixin SingleTickerProviderStateMixin<T extends StatefulWidget> on State<T> imple ...@@ -90,7 +90,7 @@ mixin SingleTickerProviderStateMixin<T extends StatefulWidget> on State<T> imple
'mixing in a SingleTickerProviderStateMixin, use a regular TickerProviderStateMixin.' 'mixing in a SingleTickerProviderStateMixin, use a regular TickerProviderStateMixin.'
); );
}()); }());
_ticker = Ticker(onTick, debugLabel: 'created by $this'); _ticker = Ticker(onTick, debugLabel: kDebugMode ? 'created by $this' : null);
// We assume that this is called from initState, build, or some sort of // We assume that this is called from initState, build, or some sort of
// event handler, and that thus TickerMode.of(context) would return true. We // event handler, and that thus TickerMode.of(context) would return true. We
// can't actually check that here because if we're in initState then we're // can't actually check that here because if we're in initState then we're
......
...@@ -281,8 +281,12 @@ class KernelCompiler { ...@@ -281,8 +281,12 @@ class KernelCompiler {
command.add('--aot'); command.add('--aot');
command.add('--tfa'); command.add('--tfa');
} }
// If we're not targeting product (release) mode and we're still aot, then
// target profile mode.
if (targetProductVm) { if (targetProductVm) {
command.add('-Ddart.vm.product=true'); command.add('-Ddart.vm.product=true');
} else if (aot) {
command.add('-Ddart.vm.profile=true');
} }
if (incrementalCompilerByteStorePath != null) { if (incrementalCompilerByteStorePath != null) {
command.add('--incremental'); command.add('--incremental');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment