@@ -2,18 +2,12 @@ library angular.watch_group;
2
2
3
3
import 'package:angular/change_detection/change_detection.dart' ;
4
4
import 'dart:collection' ;
5
- import 'package:angular/wtf .dart' ;
5
+ import 'package:angular/ng_tracing .dart' ;
6
6
7
7
part 'linked_list.dart' ;
8
8
part 'ast.dart' ;
9
9
part 'prototype_map.dart' ;
10
10
11
- var _WatchGroup_detect = traceCreateScope ('WatchGroup#detect()' );
12
- var _WatchGroup_fields = traceCreateScope ('WatchGroup#field()' );
13
- var _WatchGroup_field_handler = traceCreateScope ('WatchGroup#field_handler()' );
14
- var _WatchGroup_eval = traceCreateScope ('WatchGroup#eval()' );
15
- var _WatchGroup_reaction = traceCreateScope ('WatchGroup#reaction()' );
16
-
17
11
/**
18
12
* A function that is notified of changes to the model.
19
13
*
@@ -396,29 +390,27 @@ class RootWatchGroup extends WatchGroup {
396
390
AvgStopwatch evalStopwatch,
397
391
AvgStopwatch processStopwatch}) {
398
392
// Process the Records from the change detector
399
- var sDetect = traceEnter (_WatchGroup_detect );
400
- var s = traceEnter (_WatchGroup_fields );
393
+ var sDetect = traceEnter (ChangeDetector_check );
394
+ var sFields = traceEnter (ChangeDetector_fields );
401
395
Iterator <Record <_Handler >> changedRecordIterator =
402
396
(_changeDetector as ChangeDetector <_Handler >).collectChanges (
403
397
exceptionHandler: exceptionHandler,
404
398
stopwatch: fieldStopwatch);
405
- traceLeave (s);
406
399
if (processStopwatch != null ) processStopwatch.start ();
407
- s = traceEnter (_WatchGroup_field_handler );
408
400
while (changedRecordIterator.moveNext ()) {
409
401
var record = changedRecordIterator.current;
410
402
if (changeLog != null ) changeLog (record.handler.expression,
411
403
record.currentValue,
412
404
record.previousValue);
413
405
record.handler.onChange (record);
414
406
}
415
- traceLeave (s );
407
+ traceLeave (sFields );
416
408
if (processStopwatch != null ) processStopwatch.stop ();
417
409
418
410
if (evalStopwatch != null ) evalStopwatch.start ();
419
411
// Process our own function evaluations
420
412
_EvalWatchRecord evalRecord = _evalWatchHead;
421
- s = traceEnter (_WatchGroup_eval );
413
+ var sEval = traceEnter (ChangeDetector_eval );
422
414
int evalCount = 0 ;
423
415
while (evalRecord != null ) {
424
416
try {
@@ -434,14 +426,14 @@ class RootWatchGroup extends WatchGroup {
434
426
evalRecord = evalRecord._nextEvalWatch;
435
427
}
436
428
437
- traceLeave (s );
429
+ traceLeave (sEval );
438
430
traceLeave (sDetect);
439
431
if (evalStopwatch != null ) evalStopwatch..stop ()..increment (evalCount);
440
432
441
433
// Because the handler can forward changes between each other synchronously
442
434
// We need to call reaction functions asynchronously. This processes the
443
435
// asynchronous reaction function queue.
444
- s = traceEnter (_WatchGroup_reaction );
436
+ var sReaction = traceEnter (ChangeDetector_reaction );
445
437
int count = 0 ;
446
438
if (processStopwatch != null ) processStopwatch.start ();
447
439
Watch dirtyWatch = _dirtyWatchHead;
@@ -465,7 +457,7 @@ class RootWatchGroup extends WatchGroup {
465
457
_dirtyWatchTail = null ;
466
458
root._removeCount = 0 ;
467
459
}
468
- traceLeave (s );
460
+ traceLeaveVal (sReaction, count );
469
461
if (processStopwatch != null ) processStopwatch..stop ()..increment (count);
470
462
return count;
471
463
}
@@ -511,7 +503,12 @@ class Watch {
511
503
void invoke () {
512
504
if (_deleted || ! _dirty) return ;
513
505
_dirty = false ;
514
- reactionFn (_record.currentValue, _record.previousValue);
506
+ var s = traceEnabled ? traceEnter1 (ChangeDetector_invoke , expression) : null ;
507
+ try {
508
+ reactionFn (_record.currentValue, _record.previousValue);
509
+ } finally {
510
+ if (traceEnabled) traceLeave (s);
511
+ }
515
512
}
516
513
517
514
void remove () {
0 commit comments