@@ -15,6 +15,7 @@ import {
1515import { AppViewManagerUtils } from './view_manager_utils' ;
1616import { AppViewPool } from './view_pool' ;
1717import { AppViewListener } from './view_listener' ;
18+ import { wtfCreateScope , wtfLeave , WtfScopeFn } from '../../profile/profile' ;
1819
1920/**
2021 * Entry point for creating, moving views in the view hierarchy and destroying views.
@@ -83,6 +84,7 @@ export class AppViewManager {
8384 return this . _utils . getComponentInstance ( hostView , boundElementIndex ) ;
8485 }
8586
87+ _scope_createRootHostView : WtfScopeFn = wtfCreateScope ( 'AppViewManager#createRootHostView()' ) ;
8688 /**
8789 * Load component view into existing element.
8890 *
@@ -139,6 +141,7 @@ export class AppViewManager {
139141 */
140142 createRootHostView ( hostProtoViewRef : ProtoViewRef , overrideSelector : string ,
141143 injector : Injector ) : HostViewRef {
144+ var s = this . _scope_createRootHostView ( ) ;
142145 var hostProtoView : viewModule . AppProtoView = internalProtoView ( hostProtoViewRef ) ;
143146 var hostElementSelector = overrideSelector ;
144147 if ( isBlank ( hostElementSelector ) ) {
@@ -151,51 +154,60 @@ export class AppViewManager {
151154
152155 this . _renderer . hydrateView ( hostView . render ) ;
153156 this . _utils . hydrateRootHostView ( hostView , injector ) ;
154-
155- return hostView . ref ;
157+ return wtfLeave ( s , hostView . ref ) ;
156158 }
157159
160+ _scope_destroyRootHostView : WtfScopeFn = wtfCreateScope ( 'AppViewManager#destroyRootHostView()' ) ;
158161 /**
159162 * Remove the View created with {@link AppViewManager#createRootHostView}.
160163 */
161164 destroyRootHostView ( hostViewRef : HostViewRef ) {
162165 // Note: Don't put the hostView into the view pool
163166 // as it is depending on the element for which it was created.
167+ var s = this . _scope_destroyRootHostView ( ) ;
164168 var hostView = internalView ( < ViewRef > hostViewRef ) ;
165169 this . _renderer . detachFragment ( hostView . renderFragment ) ;
166170 this . _renderer . dehydrateView ( hostView . render ) ;
167171 this . _viewDehydrateRecurse ( hostView ) ;
168172 this . _viewListener . viewDestroyed ( hostView ) ;
169173 this . _renderer . destroyView ( hostView . render ) ;
174+ wtfLeave ( s ) ;
170175 }
171176
177+ _scope_createEmbeddedViewInContainer : WtfScopeFn =
178+ wtfCreateScope ( 'AppViewManager#createEmbeddedViewInContainer()' ) ;
172179 /**
173180 *
174181 * See {@link AppViewManager#destroyViewInContainer}.
175182 */
176183 createEmbeddedViewInContainer ( viewContainerLocation : ElementRef , atIndex : number ,
177184 templateRef : TemplateRef ) : ViewRef {
185+ var s = this . _scope_createEmbeddedViewInContainer ( ) ;
178186 var protoView = internalProtoView ( templateRef . protoViewRef ) ;
179187 if ( protoView . type !== ViewType . EMBEDDED ) {
180188 throw new BaseException ( 'This method can only be called with embedded ProtoViews!' ) ;
181189 }
182- return this . _createViewInContainer ( viewContainerLocation , atIndex , protoView ,
183- templateRef . elementRef , null ) ;
190+ return wtfLeave ( s , this . _createViewInContainer ( viewContainerLocation , atIndex , protoView ,
191+ templateRef . elementRef , null ) ) ;
184192 }
185193
194+ _scope_createHostViewInContainer : WtfScopeFn =
195+ wtfCreateScope ( 'AppViewManager#createHostViewInContainer()' ) ;
186196 /**
187197 *
188198 * See {@link AppViewManager#destroyViewInContainer}.
189199 */
190200 createHostViewInContainer ( viewContainerLocation : ElementRef , atIndex : number ,
191201 protoViewRef : ProtoViewRef ,
192202 imperativelyCreatedInjector : ResolvedBinding [ ] ) : HostViewRef {
203+ var s = this . _scope_createHostViewInContainer ( ) ;
193204 var protoView = internalProtoView ( protoViewRef ) ;
194205 if ( protoView . type !== ViewType . HOST ) {
195206 throw new BaseException ( 'This method can only be called with host ProtoViews!' ) ;
196207 }
197- return this . _createViewInContainer ( viewContainerLocation , atIndex , protoView ,
198- viewContainerLocation , imperativelyCreatedInjector ) ;
208+ return wtfLeave (
209+ s , this . _createViewInContainer ( viewContainerLocation , atIndex , protoView ,
210+ viewContainerLocation , imperativelyCreatedInjector ) ) ;
199211 }
200212
201213 /**
@@ -243,22 +255,27 @@ export class AppViewManager {
243255 }
244256 }
245257
258+ _scope_destroyViewInContainer = wtfCreateScope ( 'AppViewMananger#destroyViewInContainer()' ) ;
246259 /**
247260 *
248261 * See {@link AppViewManager#createViewInContainer}.
249262 */
250263 destroyViewInContainer ( viewContainerLocation : ElementRef , atIndex : number ) {
264+ var s = this . _scope_destroyViewInContainer ( ) ;
251265 var parentView = internalView ( viewContainerLocation . parentView ) ;
252266 var boundElementIndex = viewContainerLocation . boundElementIndex ;
253267 this . _destroyViewInContainer ( parentView , boundElementIndex , atIndex ) ;
268+ wtfLeave ( s ) ;
254269 }
255270
271+ _scope_attachViewInContainer = wtfCreateScope ( 'AppViewMananger#attachViewInContainer()' ) ;
256272 /**
257273 *
258274 * See {@link AppViewManager#detachViewInContainer}.
259275 */
260276 attachViewInContainer ( viewContainerLocation : ElementRef , atIndex : number ,
261277 viewRef : ViewRef ) : ViewRef {
278+ var s = this . _scope_attachViewInContainer ( ) ;
262279 var view = internalView ( viewRef ) ;
263280 var parentView = internalView ( viewContainerLocation . parentView ) ;
264281 var boundElementIndex = viewContainerLocation . boundElementIndex ;
@@ -270,21 +287,23 @@ export class AppViewManager {
270287 // context view that might have been used.
271288 this . _utils . attachViewInContainer ( parentView , boundElementIndex , null , null , atIndex , view ) ;
272289 this . _attachRenderView ( parentView , boundElementIndex , atIndex , view ) ;
273- return viewRef ;
290+ return wtfLeave ( s , viewRef ) ;
274291 }
275292
293+ _scope_detachViewInContainer = wtfCreateScope ( 'AppViewMananger#detachViewInContainer()' ) ;
276294 /**
277295 *
278296 * See {@link AppViewManager#attachViewInContainer}.
279297 */
280298 detachViewInContainer ( viewContainerLocation : ElementRef , atIndex : number ) : ViewRef {
299+ var s = this . _scope_detachViewInContainer ( ) ;
281300 var parentView = internalView ( viewContainerLocation . parentView ) ;
282301 var boundElementIndex = viewContainerLocation . boundElementIndex ;
283302 var viewContainer = parentView . viewContainers [ boundElementIndex ] ;
284303 var view = viewContainer . views [ atIndex ] ;
285304 this . _utils . detachViewInContainer ( parentView , boundElementIndex , atIndex ) ;
286305 this . _renderer . detachFragment ( view . renderFragment ) ;
287- return view . ref ;
306+ return wtfLeave ( s , view . ref ) ;
288307 }
289308
290309 _createMainView ( protoView : viewModule . AppProtoView ,
0 commit comments