refactor(WTF): rename scopes to follow coding conventions

This commit is contained in:
Victor Berchet 2015-08-24 17:01:07 -07:00
parent c349bbbc08
commit b29b045d78
5 changed files with 30 additions and 30 deletions

View File

@ -84,7 +84,7 @@ export class AppViewManager {
return this._utils.getComponentInstance(hostView, boundElementIndex); return this._utils.getComponentInstance(hostView, boundElementIndex);
} }
_scope_createRootHostView: WtfScopeFn = wtfCreateScope('AppViewManager#createRootHostView()'); _createRootHostViewScope: WtfScopeFn = wtfCreateScope('AppViewManager#createRootHostView()');
/** /**
* Load component view into existing element. * Load component view into existing element.
* *
@ -141,7 +141,7 @@ export class AppViewManager {
*/ */
createRootHostView(hostProtoViewRef: ProtoViewRef, overrideSelector: string, createRootHostView(hostProtoViewRef: ProtoViewRef, overrideSelector: string,
injector: Injector): HostViewRef { injector: Injector): HostViewRef {
var s = this._scope_createRootHostView(); var s = this._createRootHostViewScope();
var hostProtoView: viewModule.AppProtoView = internalProtoView(hostProtoViewRef); var hostProtoView: viewModule.AppProtoView = internalProtoView(hostProtoViewRef);
var hostElementSelector = overrideSelector; var hostElementSelector = overrideSelector;
if (isBlank(hostElementSelector)) { if (isBlank(hostElementSelector)) {
@ -157,14 +157,14 @@ export class AppViewManager {
return wtfLeave(s, hostView.ref); return wtfLeave(s, hostView.ref);
} }
_scope_destroyRootHostView: WtfScopeFn = wtfCreateScope('AppViewManager#destroyRootHostView()'); _destroyRootHostViewScope: WtfScopeFn = wtfCreateScope('AppViewManager#destroyRootHostView()');
/** /**
* Remove the View created with {@link AppViewManager#createRootHostView}. * Remove the View created with {@link AppViewManager#createRootHostView}.
*/ */
destroyRootHostView(hostViewRef: HostViewRef) { destroyRootHostView(hostViewRef: HostViewRef) {
// Note: Don't put the hostView into the view pool // Note: Don't put the hostView into the view pool
// as it is depending on the element for which it was created. // as it is depending on the element for which it was created.
var s = this._scope_destroyRootHostView(); var s = this._destroyRootHostViewScope();
var hostView = internalView(<ViewRef>hostViewRef); var hostView = internalView(<ViewRef>hostViewRef);
this._renderer.detachFragment(hostView.renderFragment); this._renderer.detachFragment(hostView.renderFragment);
this._renderer.dehydrateView(hostView.render); this._renderer.dehydrateView(hostView.render);
@ -174,7 +174,7 @@ export class AppViewManager {
wtfLeave(s); wtfLeave(s);
} }
_scope_createEmbeddedViewInContainer: WtfScopeFn = _createEmbeddedViewInContainerScope: WtfScopeFn =
wtfCreateScope('AppViewManager#createEmbeddedViewInContainer()'); wtfCreateScope('AppViewManager#createEmbeddedViewInContainer()');
/** /**
* *
@ -182,7 +182,7 @@ export class AppViewManager {
*/ */
createEmbeddedViewInContainer(viewContainerLocation: ElementRef, atIndex: number, createEmbeddedViewInContainer(viewContainerLocation: ElementRef, atIndex: number,
templateRef: TemplateRef): ViewRef { templateRef: TemplateRef): ViewRef {
var s = this._scope_createEmbeddedViewInContainer(); var s = this._createEmbeddedViewInContainerScope();
var protoView = internalProtoView(templateRef.protoViewRef); var protoView = internalProtoView(templateRef.protoViewRef);
if (protoView.type !== ViewType.EMBEDDED) { if (protoView.type !== ViewType.EMBEDDED) {
throw new BaseException('This method can only be called with embedded ProtoViews!'); throw new BaseException('This method can only be called with embedded ProtoViews!');
@ -191,7 +191,7 @@ export class AppViewManager {
templateRef.elementRef, null)); templateRef.elementRef, null));
} }
_scope_createHostViewInContainer: WtfScopeFn = _createHostViewInContainerScope: WtfScopeFn =
wtfCreateScope('AppViewManager#createHostViewInContainer()'); wtfCreateScope('AppViewManager#createHostViewInContainer()');
/** /**
* *
@ -200,7 +200,7 @@ export class AppViewManager {
createHostViewInContainer(viewContainerLocation: ElementRef, atIndex: number, createHostViewInContainer(viewContainerLocation: ElementRef, atIndex: number,
protoViewRef: ProtoViewRef, protoViewRef: ProtoViewRef,
imperativelyCreatedInjector: ResolvedBinding[]): HostViewRef { imperativelyCreatedInjector: ResolvedBinding[]): HostViewRef {
var s = this._scope_createHostViewInContainer(); var s = this._createHostViewInContainerScope();
var protoView = internalProtoView(protoViewRef); var protoView = internalProtoView(protoViewRef);
if (protoView.type !== ViewType.HOST) { if (protoView.type !== ViewType.HOST) {
throw new BaseException('This method can only be called with host ProtoViews!'); throw new BaseException('This method can only be called with host ProtoViews!');
@ -255,27 +255,27 @@ export class AppViewManager {
} }
} }
_scope_destroyViewInContainer = wtfCreateScope('AppViewMananger#destroyViewInContainer()'); _destroyViewInContainerScope = wtfCreateScope('AppViewMananger#destroyViewInContainer()');
/** /**
* *
* See {@link AppViewManager#createViewInContainer}. * See {@link AppViewManager#createViewInContainer}.
*/ */
destroyViewInContainer(viewContainerLocation: ElementRef, atIndex: number) { destroyViewInContainer(viewContainerLocation: ElementRef, atIndex: number) {
var s = this._scope_destroyViewInContainer(); var s = this._destroyViewInContainerScope();
var parentView = internalView(viewContainerLocation.parentView); var parentView = internalView(viewContainerLocation.parentView);
var boundElementIndex = viewContainerLocation.boundElementIndex; var boundElementIndex = viewContainerLocation.boundElementIndex;
this._destroyViewInContainer(parentView, boundElementIndex, atIndex); this._destroyViewInContainer(parentView, boundElementIndex, atIndex);
wtfLeave(s); wtfLeave(s);
} }
_scope_attachViewInContainer = wtfCreateScope('AppViewMananger#attachViewInContainer()'); _attachViewInContainerScope = wtfCreateScope('AppViewMananger#attachViewInContainer()');
/** /**
* *
* See {@link AppViewManager#detachViewInContainer}. * See {@link AppViewManager#detachViewInContainer}.
*/ */
attachViewInContainer(viewContainerLocation: ElementRef, atIndex: number, attachViewInContainer(viewContainerLocation: ElementRef, atIndex: number,
viewRef: ViewRef): ViewRef { viewRef: ViewRef): ViewRef {
var s = this._scope_attachViewInContainer(); var s = this._attachViewInContainerScope();
var view = internalView(viewRef); var view = internalView(viewRef);
var parentView = internalView(viewContainerLocation.parentView); var parentView = internalView(viewContainerLocation.parentView);
var boundElementIndex = viewContainerLocation.boundElementIndex; var boundElementIndex = viewContainerLocation.boundElementIndex;
@ -290,13 +290,13 @@ export class AppViewManager {
return wtfLeave(s, viewRef); return wtfLeave(s, viewRef);
} }
_scope_detachViewInContainer = wtfCreateScope('AppViewMananger#detachViewInContainer()'); _detachViewInContainerScope = wtfCreateScope('AppViewMananger#detachViewInContainer()');
/** /**
* *
* See {@link AppViewManager#attachViewInContainer}. * See {@link AppViewManager#attachViewInContainer}.
*/ */
detachViewInContainer(viewContainerLocation: ElementRef, atIndex: number): ViewRef { detachViewInContainer(viewContainerLocation: ElementRef, atIndex: number): ViewRef {
var s = this._scope_detachViewInContainer(); var s = this._detachViewInContainerScope();
var parentView = internalView(viewContainerLocation.parentView); var parentView = internalView(viewContainerLocation.parentView);
var boundElementIndex = viewContainerLocation.boundElementIndex; var boundElementIndex = viewContainerLocation.boundElementIndex;
var viewContainer = parentView.viewContainers[boundElementIndex]; var viewContainer = parentView.viewContainers[boundElementIndex];

View File

@ -32,7 +32,7 @@ import {wtfLeave, wtfCreateScope, WtfScopeFn} from '../profile/profile';
*/ */
@Injectable() @Injectable()
export class LifeCycle { export class LifeCycle {
static _scope_tick: WtfScopeFn = wtfCreateScope('LifeCycle#tick()'); static _tickScope: WtfScopeFn = wtfCreateScope('LifeCycle#tick()');
_changeDetector: ChangeDetector; _changeDetector: ChangeDetector;
_enforceNoNewChanges: boolean; _enforceNoNewChanges: boolean;
@ -74,7 +74,7 @@ export class LifeCycle {
throw new BaseException("LifeCycle.tick is called recursively"); throw new BaseException("LifeCycle.tick is called recursively");
} }
var s = LifeCycle._scope_tick(); var s = LifeCycle._tickScope();
try { try {
this._runningTick = true; this._runningTick = true;
this._changeDetector.detectChanges(); this._changeDetector.detectChanges();

View File

@ -25,7 +25,7 @@ function noopScope(arg0?: any, arg1?: any): any {
* *
* Used to mark scope entry. The return value is used to leave the scope. * Used to mark scope entry. The return value is used to leave the scope.
* *
* final myScope = wtfCreateScope('MyClass#myMethod(ascii someVal)'); * var myScope = wtfCreateScope('MyClass#myMethod(ascii someVal)');
* *
* someMethod() { * someMethod() {
* var s = myScope('Foo'); // 'Foo' gets stored in tracing UI * var s = myScope('Foo'); // 'Foo' gets stored in tracing UI

View File

@ -50,10 +50,10 @@ export class DomRenderer extends Renderer {
this._document = document; this._document = document;
} }
_scope_createRootHostView: WtfScopeFn = wtfCreateScope('DomRenderer#createRootHostView()'); _createRootHostViewScope: WtfScopeFn = wtfCreateScope('DomRenderer#createRootHostView()');
createRootHostView(hostProtoViewRef: RenderProtoViewRef, fragmentCount: number, createRootHostView(hostProtoViewRef: RenderProtoViewRef, fragmentCount: number,
hostElementSelector: string): RenderViewWithFragments { hostElementSelector: string): RenderViewWithFragments {
var s = this._scope_createRootHostView(); var s = this._createRootHostViewScope();
var hostProtoView = resolveInternalDomProtoView(hostProtoViewRef); var hostProtoView = resolveInternalDomProtoView(hostProtoViewRef);
var element = DOM.querySelector(this._document, hostElementSelector); var element = DOM.querySelector(this._document, hostElementSelector);
if (isBlank(element)) { if (isBlank(element)) {
@ -63,9 +63,9 @@ export class DomRenderer extends Renderer {
return wtfLeave(s, this._createView(hostProtoView, element)); return wtfLeave(s, this._createView(hostProtoView, element));
} }
_scope_createView = wtfCreateScope('DomRenderer#createView()'); _createViewScope = wtfCreateScope('DomRenderer#createView()');
createView(protoViewRef: RenderProtoViewRef, fragmentCount: number): RenderViewWithFragments { createView(protoViewRef: RenderProtoViewRef, fragmentCount: number): RenderViewWithFragments {
var s = this._scope_createView(); var s = this._createViewScope();
var protoView = resolveInternalDomProtoView(protoViewRef); var protoView = resolveInternalDomProtoView(protoViewRef);
return wtfLeave(s, this._createView(protoView, null)); return wtfLeave(s, this._createView(protoView, null));
} }
@ -109,9 +109,9 @@ export class DomRenderer extends Renderer {
moveNodesAfterSibling(element, resolveInternalDomFragment(fragmentRef)); moveNodesAfterSibling(element, resolveInternalDomFragment(fragmentRef));
} }
_scope_detachFragment = wtfCreateScope('DomRenderer#detachFragment()'); _detachFragmentScope = wtfCreateScope('DomRenderer#detachFragment()');
detachFragment(fragmentRef: RenderFragmentRef) { detachFragment(fragmentRef: RenderFragmentRef) {
var s = this._scope_detachFragment(); var s = this._detachFragmentScope();
var fragmentNodes = resolveInternalDomFragment(fragmentRef); var fragmentNodes = resolveInternalDomFragment(fragmentRef);
for (var i = 0; i < fragmentNodes.length; i++) { for (var i = 0; i < fragmentNodes.length; i++) {
DOM.remove(fragmentNodes[i]); DOM.remove(fragmentNodes[i]);
@ -201,9 +201,9 @@ export class DomRenderer extends Renderer {
DOM.setText(view.boundTextNodes[textNodeIndex], text); DOM.setText(view.boundTextNodes[textNodeIndex], text);
} }
_scope_setEventDispatcher = wtfCreateScope('DomRenderer#setEventDispatcher()'); _setEventDispatcherScope = wtfCreateScope('DomRenderer#setEventDispatcher()');
setEventDispatcher(viewRef: RenderViewRef, dispatcher: any /*api.EventDispatcher*/): void { setEventDispatcher(viewRef: RenderViewRef, dispatcher: any /*api.EventDispatcher*/): void {
var s = this._scope_setEventDispatcher(); var s = this._setEventDispatcherScope();
var view = resolveInternalDomView(viewRef); var view = resolveInternalDomView(viewRef);
view.eventDispatcher = dispatcher; view.eventDispatcher = dispatcher;
wtfLeave(s); wtfLeave(s);

View File

@ -15,8 +15,8 @@ export interface NgZoneZone extends Zone { _innerZone: boolean; }
* `Zone`. The default `onTurnDone` runs the Angular change detection. * `Zone`. The default `onTurnDone` runs the Angular change detection.
*/ */
export class NgZone { export class NgZone {
_zone_run_scope: WtfScopeFn = wtfCreateScope(`NgZone#run()`); _runScope: WtfScopeFn = wtfCreateScope(`NgZone#run()`);
_zone_microtask: WtfScopeFn = wtfCreateScope(`NgZone#microtask()`); _microtaskScope: WtfScopeFn = wtfCreateScope(`NgZone#microtask()`);
// Code executed in _mountZone does not trigger the onTurnDone. // Code executed in _mountZone does not trigger the onTurnDone.
_mountZone; _mountZone;
@ -141,7 +141,7 @@ export class NgZone {
if (this._disabled) { if (this._disabled) {
return fn(); return fn();
} else { } else {
var s = this._zone_run_scope(); var s = this._runScope();
try { try {
return this._innerZone.run(fn); return this._innerZone.run(fn);
} finally { } finally {
@ -175,7 +175,7 @@ export class NgZone {
} }
_createInnerZone(zone, enableLongStackTrace) { _createInnerZone(zone, enableLongStackTrace) {
var _zone_microtask = this._zone_microtask; var microtaskScope = this._microtaskScope;
var ngZone = this; var ngZone = this;
var errorHandling; var errorHandling;
@ -228,7 +228,7 @@ export class NgZone {
return function(fn) { return function(fn) {
ngZone._pendingMicrotasks++; ngZone._pendingMicrotasks++;
var microtask = function() { var microtask = function() {
var s = _zone_microtask(); var s = microtaskScope();
try { try {
fn(); fn();
} finally { } finally {