refactor(ivy): remove TView.pipeDestroyHooks (#27955)

PR Close #27955
This commit is contained in:
Marc Laval 2019-01-07 10:38:55 +01:00 committed by Kara Erickson
parent 45880532bf
commit 996435b79a
5 changed files with 1 additions and 26 deletions

View File

@ -725,7 +725,6 @@ export function createTView(
viewHooks: null, viewHooks: null,
viewCheckHooks: null, viewCheckHooks: null,
destroyHooks: null, destroyHooks: null,
pipeDestroyHooks: null,
cleanup: null, cleanup: null,
contentQueries: null, contentQueries: null,
components: null, components: null,

View File

@ -437,17 +437,6 @@ export interface TView {
*/ */
destroyHooks: HookData|null; destroyHooks: HookData|null;
/**
* Array of pipe ngOnDestroy hooks that should be executed when this view is destroyed.
*
* Even indices: Index of pipe in data
* Odd indices: Hook function
*
* These must be stored separately from directive destroy hooks because their contexts
* are stored in data.
*/
pipeDestroyHooks: HookData|null;
/** /**
* When a view is destroyed, listeners need to be released and outputs need to be * When a view is destroyed, listeners need to be released and outputs need to be
* unsubscribed. This cleanup array stores both listener data (in chunks of 4) * unsubscribed. This cleanup array stores both listener data (in chunks of 4)

View File

@ -427,7 +427,6 @@ function cleanUpView(viewOrContainer: LView | LContainer): void {
if ((viewOrContainer as LView).length >= HEADER_OFFSET) { if ((viewOrContainer as LView).length >= HEADER_OFFSET) {
const view = viewOrContainer as LView; const view = viewOrContainer as LView;
executeOnDestroys(view); executeOnDestroys(view);
executePipeOnDestroys(view);
removeListeners(view); removeListeners(view);
const hostTNode = view[HOST_NODE]; const hostTNode = view[HOST_NODE];
// For component views only, the local renderer is destroyed as clean up time. // For component views only, the local renderer is destroyed as clean up time.
@ -486,14 +485,6 @@ function executeOnDestroys(view: LView): void {
} }
} }
/** Calls pipe destroy hooks for this view */
function executePipeOnDestroys(lView: LView): void {
const pipeDestroyHooks = lView[TVIEW] && lView[TVIEW].pipeDestroyHooks;
if (pipeDestroyHooks) {
callHooks(lView !, pipeDestroyHooks);
}
}
export function getRenderParent(tNode: TNode, currentView: LView): RElement|null { export function getRenderParent(tNode: TNode, currentView: LView): RElement|null {
if (canInsertNativeNode(tNode, currentView)) { if (canInsertNativeNode(tNode, currentView)) {
// If we are asked for a render parent of the root component we need to do low-level DOM // If we are asked for a render parent of the root component we need to do low-level DOM

View File

@ -33,8 +33,7 @@ export function pipe(index: number, pipeName: string): any {
pipeDef = getPipeDef(pipeName, tView.pipeRegistry); pipeDef = getPipeDef(pipeName, tView.pipeRegistry);
tView.data[adjustedIndex] = pipeDef; tView.data[adjustedIndex] = pipeDef;
if (pipeDef.onDestroy) { if (pipeDef.onDestroy) {
(tView.pipeDestroyHooks || (tView.pipeDestroyHooks = [ (tView.destroyHooks || (tView.destroyHooks = [])).push(adjustedIndex, pipeDef.onDestroy);
])).push(adjustedIndex, pipeDef.onDestroy);
} }
} else { } else {
pipeDef = tView.data[adjustedIndex] as PipeDef<any>; pipeDef = tView.data[adjustedIndex] as PipeDef<any>;

View File

@ -584,9 +584,6 @@
{ {
"name": "executeOnDestroys" "name": "executeOnDestroys"
}, },
{
"name": "executePipeOnDestroys"
},
{ {
"name": "extendStatics" "name": "extendStatics"
}, },