@@ -29,7 +29,7 @@ type Timespan = {
29
29
export type IPerformanceLogger = {
30
30
addTimespan ( string , number , string | void ) : void ,
31
31
startTimespan ( string , string | void ) : void ,
32
- stopTimespan ( string ) : void ,
32
+ stopTimespan ( string , options ?: { update ?: boolean } ) : void ,
33
33
clear ( ) : void ,
34
34
clearCompleted ( ) : void ,
35
35
clearExceptTimespans ( Array < string > ) : void ,
@@ -107,7 +107,7 @@ function createPerformanceLogger(): IPerformanceLogger {
107
107
}
108
108
} ,
109
109
110
- stopTimespan ( key : string ) {
110
+ stopTimespan ( key : string , options ?: { update ?: boolean } ) {
111
111
const timespan = this . _timespans [ key ] ;
112
112
if ( ! timespan || ! timespan . startTime ) {
113
113
if ( PRINT_TO_CONSOLE && __DEV__ ) {
@@ -118,7 +118,7 @@ function createPerformanceLogger(): IPerformanceLogger {
118
118
}
119
119
return ;
120
120
}
121
- if ( timespan . endTime ) {
121
+ if ( timespan . endTime && ! options ?. update ) {
122
122
if ( PRINT_TO_CONSOLE && __DEV__ ) {
123
123
infoLog (
124
124
'PerformanceLogger: Attempting to end a timespan that has already ended ' ,
@@ -134,8 +134,10 @@ function createPerformanceLogger(): IPerformanceLogger {
134
134
infoLog ( 'PerformanceLogger.js' , 'end: ' + key ) ;
135
135
}
136
136
137
- Systrace . endAsyncEvent ( key , _cookies [ key ] ) ;
138
- delete _cookies [ key ] ;
137
+ if ( _cookies [ key ] != null ) {
138
+ Systrace . endAsyncEvent ( key , _cookies [ key ] ) ;
139
+ delete _cookies [ key ] ;
140
+ }
139
141
} ,
140
142
141
143
clear ( ) {
0 commit comments