Skip to content

Commit

Permalink
refactor(platform-browser): use performance API for async animations (#…
Browse files Browse the repository at this point in the history
…53963)

This commit adds a standard performance marker

PR Close #53963
  • Loading branch information
JeanMeche authored and alxhub committed Feb 21, 2024
1 parent 3e31f1a commit ed8857e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1223,15 +1223,15 @@
{
"name": "optimizeGroupPlayer"
},
{
"name": "options"
},
{
"name": "parseAndConvertBindingsForDefinition"
},
{
"name": "parseTimelineCommand"
},
{
"name": "performanceMarkFeature"
},
{
"name": "processInjectorTypesWithProviders"
},
Expand Down
3 changes: 2 additions & 1 deletion packages/platform-browser/animations/async/src/providers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -42,6 +42,7 @@ import {AsyncAnimationRendererFactory} from './async_animation_renderer';
*/
export function provideAnimationsAsync(type: 'animations'|'noop' = 'animations'):
EnvironmentProviders {
performanceMarkFeature('NgAsyncAnimations');
return makeEnvironmentProviders([
{
provide: RendererFactory2,
Expand Down
3 changes: 2 additions & 1 deletion packages/platform-browser/animations/src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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];
Expand Down

0 comments on commit ed8857e

Please sign in to comment.