Unverified Commit 33f4107c authored by Kenzie (Schmoll) Davisson's avatar Kenzie (Schmoll) Davisson Committed by GitHub

Reset default UserTag at the time of the first flutter frame (#86516)

* Reset default UserTag at the time of the first flutter frame
parent cd78190b
......@@ -859,6 +859,11 @@ mixin WidgetsBinding on BindingBase, ServicesBinding, SchedulerBinding, GestureB
firstFrameCallback = (List<FrameTiming> timings) {
assert(sendFramesToEngine);
if (!kReleaseMode) {
// Change the current user tag back to the default tag. At this point,
// the user tag should be set to "AppStartUp" (originally set in the
// engine), so we need to change it back to the default tag to mark
// the end of app start up for CPU profiles.
developer.UserTag.defaultTag.makeCurrent();
developer.Timeline.instantSync('Rasterized first useful frame');
developer.postEvent('Flutter.FirstFrame', <String, dynamic>{});
}
......
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:developer' as developer;
import 'dart:ui';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
void main() {
test('first frame callback sets the default UserTag', () {
final WidgetsBinding binding = WidgetsFlutterBinding.ensureInitialized();
expect(developer.getCurrentTag().label, equals('Default'));
developer.UserTag('test tag').makeCurrent();
expect(developer.getCurrentTag().label, equals('test tag'));
binding.drawFrame();
// Simulates the engine again.
binding.window.onReportTimings!(<FrameTiming>[]);
expect(developer.getCurrentTag().label, equals('Default'));
});
}
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