refactor(view): introduce AppViewManager to consolidate logic

AppViewManager is the single entry point to changing the view hierarchy.
It is split between the manager itself which does coordination and
helper methods, so both are easily testable in isolation.

Also, ViewContainer is now only a pure reference to a bound element
with the previous functionality but does not contain the list of views
any more.

Part of #1477
This commit is contained in:
Tobias Bosch
2015-04-24 17:53:06 -07:00
parent f78406392b
commit bfa381b35a
27 changed files with 1514 additions and 1216 deletions

View File

@ -6,7 +6,7 @@ import {ReflectionCapabilities} from 'angular2/src/reflection/reflection_capabil
import {App} from './app';
import {VIEW_POOL_CAPACITY} from 'angular2/src/core/compiler/view_factory';
import {APP_VIEW_POOL_CAPACITY} from 'angular2/src/core/compiler/view_pool';
import {bind} from 'angular2/di';
export function main() {
@ -15,7 +15,7 @@ export function main() {
}
function createBindings():List {
return [bind(VIEW_POOL_CAPACITY).toValue(100000)];
return [bind(APP_VIEW_POOL_CAPACITY).toValue(100000)];
}
export function setupReflector() {

View File

@ -9,7 +9,7 @@ import {window, document, gc} from 'angular2/src/facade/browser';
import {getIntParameter, getStringParameter, bindAction} from 'angular2/src/test_lib/benchmark_util';
import {If} from 'angular2/directives';
import {BrowserDomAdapter} from 'angular2/src/dom/browser_adapter';
import {ViewFactory, VIEW_POOL_CAPACITY} from 'angular2/src/core/compiler/view_factory';
import {APP_VIEW_POOL_CAPACITY} from 'angular2/src/core/compiler/view_pool';
import * as rvf from 'angular2/src/render/dom/view/view_factory';
import {bind} from 'angular2/di';
@ -17,7 +17,7 @@ function createBindings():List {
var viewCacheCapacity = getStringParameter('viewcache') == 'true' ? 10000 : 1;
return [
bind(rvf.VIEW_POOL_CAPACITY).toValue(viewCacheCapacity),
bind(VIEW_POOL_CAPACITY).toValue(viewCacheCapacity)
bind(APP_VIEW_POOL_CAPACITY).toValue(viewCacheCapacity)
];
}