@@ -2,18 +2,12 @@ library angular.watch_group;
22
33import 'package:angular/change_detection/change_detection.dart' ;
44import 'dart:collection' ;
5- import 'package:angular/wtf .dart' ;
5+ import 'package:angular/ng_tracing .dart' ;
66
77part 'linked_list.dart' ;
88part 'ast.dart' ;
99part 'prototype_map.dart' ;
1010
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-
1711/**
1812 * A function that is notified of changes to the model.
1913 *
@@ -396,29 +390,27 @@ class RootWatchGroup extends WatchGroup {
396390 AvgStopwatch evalStopwatch,
397391 AvgStopwatch processStopwatch}) {
398392 // 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 );
401395 Iterator <Record <_Handler >> changedRecordIterator =
402396 (_changeDetector as ChangeDetector <_Handler >).collectChanges (
403397 exceptionHandler: exceptionHandler,
404398 stopwatch: fieldStopwatch);
405- traceLeave (s);
406399 if (processStopwatch != null ) processStopwatch.start ();
407- s = traceEnter (_WatchGroup_field_handler );
408400 while (changedRecordIterator.moveNext ()) {
409401 var record = changedRecordIterator.current;
410402 if (changeLog != null ) changeLog (record.handler.expression,
411403 record.currentValue,
412404 record.previousValue);
413405 record.handler.onChange (record);
414406 }
415- traceLeave (s );
407+ traceLeave (sFields );
416408 if (processStopwatch != null ) processStopwatch.stop ();
417409
418410 if (evalStopwatch != null ) evalStopwatch.start ();
419411 // Process our own function evaluations
420412 _EvalWatchRecord evalRecord = _evalWatchHead;
421- s = traceEnter (_WatchGroup_eval );
413+ var sEval = traceEnter (ChangeDetector_eval );
422414 int evalCount = 0 ;
423415 while (evalRecord != null ) {
424416 try {
@@ -434,14 +426,14 @@ class RootWatchGroup extends WatchGroup {
434426 evalRecord = evalRecord._nextEvalWatch;
435427 }
436428
437- traceLeave (s );
429+ traceLeave (sEval );
438430 traceLeave (sDetect);
439431 if (evalStopwatch != null ) evalStopwatch..stop ()..increment (evalCount);
440432
441433 // Because the handler can forward changes between each other synchronously
442434 // We need to call reaction functions asynchronously. This processes the
443435 // asynchronous reaction function queue.
444- s = traceEnter (_WatchGroup_reaction );
436+ var sReaction = traceEnter (ChangeDetector_reaction );
445437 int count = 0 ;
446438 if (processStopwatch != null ) processStopwatch.start ();
447439 Watch dirtyWatch = _dirtyWatchHead;
@@ -465,7 +457,7 @@ class RootWatchGroup extends WatchGroup {
465457 _dirtyWatchTail = null ;
466458 root._removeCount = 0 ;
467459 }
468- traceLeave (s );
460+ traceLeaveVal (sReaction, count );
469461 if (processStopwatch != null ) processStopwatch..stop ()..increment (count);
470462 return count;
471463 }
@@ -511,7 +503,12 @@ class Watch {
511503 void invoke () {
512504 if (_deleted || ! _dirty) return ;
513505 _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+ }
515512 }
516513
517514 void remove () {
0 commit comments