perf(ivy): remove global state access in createEmbeddedViewAndNode (#31959)

PR Close #31959
This commit is contained in:
Pawel Kozlowski 2019-08-01 16:53:09 +02:00 committed by Alex Rickabaugh
parent a8e2ee1343
commit 6f98107d5e
2 changed files with 3 additions and 9 deletions

View File

@ -11,7 +11,7 @@ import {assertLContainerOrUndefined} from '../assert';
import {ACTIVE_INDEX, CONTAINER_HEADER_OFFSET, LContainer} from '../interfaces/container'; import {ACTIVE_INDEX, CONTAINER_HEADER_OFFSET, LContainer} from '../interfaces/container';
import {RenderFlags} from '../interfaces/definition'; import {RenderFlags} from '../interfaces/definition';
import {TContainerNode, TNodeType} from '../interfaces/node'; import {TContainerNode, TNodeType} from '../interfaces/node';
import {FLAGS, LView, LViewFlags, PARENT, QUERIES, TVIEW, TView, T_HOST} from '../interfaces/view'; import {FLAGS, LView, LViewFlags, PARENT, TVIEW, TView, T_HOST} from '../interfaces/view';
import {assertNodeType} from '../node_assert'; import {assertNodeType} from '../node_assert';
import {insertView, removeView} from '../node_manipulation'; import {insertView, removeView} from '../node_manipulation';
import {enterView, getIsParent, getLView, getPreviousOrParentTNode, isCreationMode, leaveView, setIsParent, setPreviousOrParentTNode} from '../state'; import {enterView, getIsParent, getLView, getPreviousOrParentTNode, isCreationMode, leaveView, setIsParent, setPreviousOrParentTNode} from '../state';

View File

@ -369,16 +369,11 @@ export function allocExpando(view: LView, numSlotsToAlloc: number) {
////////////////////////// //////////////////////////
/** /**
* Used for creating the LViewNode of a dynamic embedded view, * Used for creating the LView of a dynamic embedded view, either through
* either through ViewContainerRef.createEmbeddedView() or TemplateRef.createEmbeddedView(). * ViewContainerRef.createEmbeddedView() or TemplateRef.createEmbeddedView().
* Such lViewNode will then be renderer with renderEmbeddedTemplate() (see below).
*/ */
export function createEmbeddedViewAndNode<T>( export function createEmbeddedViewAndNode<T>(
tView: TView, context: T, declarationView: LView, injectorIndex: number): LView { tView: TView, context: T, declarationView: LView, injectorIndex: number): LView {
const _isParent = getIsParent();
const _previousOrParentTNode = getPreviousOrParentTNode();
setPreviousOrParentTNode(null !, true);
const lView = createLView(declarationView, tView, context, LViewFlags.CheckAlways, null, null); const lView = createLView(declarationView, tView, context, LViewFlags.CheckAlways, null, null);
lView[DECLARATION_VIEW] = declarationView; lView[DECLARATION_VIEW] = declarationView;
@ -388,7 +383,6 @@ export function createEmbeddedViewAndNode<T>(
tView.node !.injectorIndex = injectorIndex; tView.node !.injectorIndex = injectorIndex;
} }
setPreviousOrParentTNode(_previousOrParentTNode, _isParent);
return lView; return lView;
} }