refactor(platform-browser): use performance API for async animations (#53963)

This commit adds a standard performance marker

PR Close #53963
This commit is contained in:
Matthieu Riegler
2024-01-17 22:37:37 +01:00
committed by Alex Rickabaugh
parent 3e31f1a34e
commit ed8857e46f
3 changed files with 7 additions and 5 deletions
@@ -1223,15 +1223,15 @@
{
"name": "optimizeGroupPlayer"
},
{
"name": "options"
},
{
"name": "parseAndConvertBindingsForDefinition"
},
{
"name": "parseTimelineCommand"
},
{
"name": "performanceMarkFeature"
},
{
"name": "processInjectorTypesWithProviders"
},
@@ -7,7 +7,7 @@
*/
import {DOCUMENT} from '@angular/common';
import {ANIMATION_MODULE_TYPE, EnvironmentProviders, makeEnvironmentProviders, NgZone, RendererFactory2} from '@angular/core';
import {ANIMATION_MODULE_TYPE, EnvironmentProviders, makeEnvironmentProviders, NgZone, RendererFactory2, ɵperformanceMarkFeature as performanceMarkFeature} from '@angular/core';
import {ɵDomRendererFactory2 as DomRendererFactory2} from '@angular/platform-browser';
import {AsyncAnimationRendererFactory} from './async_animation_renderer';
@@ -42,6 +42,7 @@ import {AsyncAnimationRendererFactory} from './async_animation_renderer';
*/
export function provideAnimationsAsync(type: 'animations'|'noop' = 'animations'):
EnvironmentProviders {
performanceMarkFeature('NgAsyncAnimations');
return makeEnvironmentProviders([
{
provide: RendererFactory2,
@@ -5,7 +5,7 @@
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import {ModuleWithProviders, NgModule, Provider} from '@angular/core';
import {ModuleWithProviders, NgModule, Provider, ɵperformanceMarkFeature as performanceMarkFeature} from '@angular/core';
import {BrowserModule} from '@angular/platform-browser';
import {BROWSER_ANIMATIONS_PROVIDERS, BROWSER_NOOP_ANIMATIONS_PROVIDERS} from './providers';
@@ -81,6 +81,7 @@ export class BrowserAnimationsModule {
* @publicApi
*/
export function provideAnimations(): Provider[] {
performanceMarkFeature('NgEagerAnimations');
// Return a copy to prevent changes to the original array in case any in-place
// alterations are performed to the `provideAnimations` call results in app code.
return [...BROWSER_ANIMATIONS_PROVIDERS];