File tree Expand file tree Collapse file tree 4 files changed +23
-2
lines changed
packages/core/src/render3 Expand file tree Collapse file tree 4 files changed +23
-2
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,9 @@ export function applyChanges(component: {}): void;
1010// @public
1111export type DirectiveDebugMetadata = AngularDirectiveDebugMetadata | AcxDirectiveDebugMetadata | AngularComponentDebugMetadata | AcxComponentDebugMetadata | WizComponentDebugMetadata ;
1212
13+ // @public
14+ export function enableProfiling(): () => void ;
15+
1316// @public
1417export function getComponent<T >(element : Element ): T | null ;
1518
Original file line number Diff line number Diff line change 99import { InjectionToken } from '../../di' ;
1010import { isTypeProvider } from '../../di/provider_collection' ;
1111import { assertDefined , assertEqual } from '../../util/assert' ;
12+ import { performanceMarkFeature } from '../../util/performance' ;
1213import { setProfiler } from '../profiler' ;
1314import { Profiler , ProfilerEvent } from '../profiler_types' ;
1415import { stringifyForError } from '../util/stringify_utils' ;
@@ -224,7 +225,19 @@ function getProviderTokenMeasureName<T>(token: any) {
224225 }
225226}
226227
228+ /**
229+ * Start listening to the Angular's internal performance-related events and route those to the Chrome DevTools performance panel.
230+ * This enables Angular-specific data visualization when recording a performance profile directly in the Chrome DevTools.
231+ *
232+ * @returns a function that can be invoked to stop sending profiling data.
233+ */
227234export function enableProfiling ( ) {
228- setInjectorProfiler ( chromeDevToolsInjectorProfiler ) ;
229- setProfiler ( devToolsProfiler ) ;
235+ performanceMarkFeature ( 'Chrome DevTools profiling' ) ;
236+ const removeInjectorProfiler = setInjectorProfiler ( chromeDevToolsInjectorProfiler ) ;
237+ const removeProfiler = setProfiler ( devToolsProfiler ) ;
238+
239+ return ( ) => {
240+ removeInjectorProfiler ( ) ;
241+ removeProfiler ( ) ;
242+ } ;
230243}
Original file line number Diff line number Diff line change 1616 */
1717
1818export { applyChanges } from './util/change_detection_utils' ;
19+ export { enableProfiling } from './debug/chrome_dev_tools_performance' ;
1920export {
2021 DirectiveDebugMetadata ,
2122 getComponent ,
Original file line number Diff line number Diff line change @@ -33,6 +33,8 @@ import {
3333} from './injector_discovery_utils' ;
3434import { getSignalGraph } from './signal_debug' ;
3535
36+ import { enableProfiling } from '../debug/chrome_dev_tools_performance' ;
37+
3638/**
3739 * This file introduces series of globally accessible debug tools
3840 * to allow for the Angular debugging story to function.
@@ -82,6 +84,8 @@ const globalUtilsFunctions = {
8284 'getDirectives' : getDirectives ,
8385 'applyChanges' : applyChanges ,
8486 'isSignal' : isSignal ,
87+
88+ 'enableProfiling' : enableProfiling ,
8589} ;
8690type CoreGlobalUtilsFunctions = keyof typeof globalUtilsFunctions ;
8791type ExternalGlobalUtilsFunctions = keyof NgGlobalPublishUtils ;
You can’t perform that action at this time.
0 commit comments