@@ -9,12 +9,12 @@ import {ExceptionHandler} from './exception_handler';
9
9
import { TemplateLoader } from 'angular2/src/render/dom/compiler/template_loader' ;
10
10
import { TemplateResolver } from './compiler/template_resolver' ;
11
11
import { DirectiveMetadataReader } from './compiler/directive_metadata_reader' ;
12
- import { DirectiveBinding } from './compiler/element_injector' ;
13
12
import { List , ListWrapper } from 'angular2/src/facade/collection' ;
14
13
import { Promise , PromiseWrapper } from 'angular2/src/facade/async' ;
15
14
import { VmTurnZone } from 'angular2/src/core/zone/vm_turn_zone' ;
16
15
import { LifeCycle } from 'angular2/src/core/life_cycle/life_cycle' ;
17
- import { ShadowDomStrategy , NativeShadowDomStrategy , EmulatedUnscopedShadowDomStrategy } from 'angular2/src/core/compiler/shadow_dom_strategy' ;
16
+ import { ShadowDomStrategy } from 'angular2/src/render/dom/shadow_dom/shadow_dom_strategy' ;
17
+ import { EmulatedUnscopedShadowDomStrategy } from 'angular2/src/render/dom/shadow_dom/emulated_unscoped_shadow_dom_strategy' ;
18
18
import { XHR } from 'angular2/src/services/xhr' ;
19
19
import { XHRImpl } from 'angular2/src/services/xhr_impl' ;
20
20
import { EventManager , DomEventsPlugin } from 'angular2/src/render/dom/events/event_manager' ;
@@ -27,6 +27,13 @@ import {StyleInliner} from 'angular2/src/render/dom/shadow_dom/style_inliner';
27
27
import { Component } from 'angular2/src/core/annotations/annotations' ;
28
28
import { PrivateComponentLoader } from 'angular2/src/core/compiler/private_component_loader' ;
29
29
import { TestabilityRegistry , Testability } from 'angular2/src/core/testability/testability' ;
30
+ import { ViewFactory , VIEW_POOL_CAPACITY } from 'angular2/src/core/compiler/view_factory' ;
31
+ import { ProtoViewFactory } from 'angular2/src/core/compiler/proto_view_factory' ;
32
+ import { Renderer } from 'angular2/src/render/api' ;
33
+ import { DirectDomRenderer } from 'angular2/src/render/dom/direct_dom_renderer' ;
34
+ import * as rc from 'angular2/src/render/dom/compiler/compiler' ;
35
+ import * as rvf from 'angular2/src/render/dom/view/view_factory' ;
36
+
30
37
import {
31
38
appViewToken ,
32
39
appChangeDetectorToken ,
@@ -60,7 +67,7 @@ function _injectorBindings(appComponentType): List<Binding> {
60
67
return element ;
61
68
} , [ appComponentAnnotatedTypeToken , appDocumentToken ] ) ,
62
69
bind ( appViewToken ) . toAsyncFactory ( ( changeDetection , compiler , injector , appElement ,
63
- appComponentAnnotatedType , strategy , eventManager , testability , registry ) => {
70
+ appComponentAnnotatedType , testability , registry , viewFactory ) => {
64
71
65
72
// We need to do this here to ensure that we create Testability and
66
73
// it's ready on the window for users.
@@ -73,18 +80,18 @@ function _injectorBindings(appComponentType): List<Binding> {
73
80
}
74
81
return compiler . compileRoot (
75
82
appElement ,
76
- DirectiveBinding . createFromType ( appComponentAnnotatedType . type , appComponentAnnotatedType . annotation )
83
+ appComponentAnnotatedType . type
77
84
) . then (
78
85
( appProtoView ) => {
79
86
// The light Dom of the app element is not considered part of
80
87
// the angular application. Thus the context and lightDomInjector are
81
88
// empty.
82
- var view = appProtoView . instantiate ( null , eventManager ) ;
83
- view . hydrate ( injector , null , null , new Object ( ) , null ) ;
89
+ var view = viewFactory . getView ( appProtoView ) ;
90
+ view . hydrate ( injector , null , new Object ( ) , null ) ;
84
91
return view ;
85
92
} ) ;
86
93
} , [ ChangeDetection , Compiler , Injector , appElementToken , appComponentAnnotatedTypeToken ,
87
- ShadowDomStrategy , EventManager , Testability , TestabilityRegistry ] ) ,
94
+ Testability , TestabilityRegistry , ViewFactory ] ) ,
88
95
89
96
bind ( appChangeDetectorToken ) . toFactory ( ( rootView ) => rootView . changeDetector ,
90
97
[ appViewToken ] ) ,
@@ -98,6 +105,23 @@ function _injectorBindings(appComponentType): List<Binding> {
98
105
bind ( ShadowDomStrategy ) . toFactory (
99
106
( styleUrlResolver , doc ) => new EmulatedUnscopedShadowDomStrategy ( styleUrlResolver , doc . head ) ,
100
107
[ StyleUrlResolver , appDocumentToken ] ) ,
108
+ bind ( Renderer ) . toClass ( DirectDomRenderer ) ,
109
+ bind ( rc . Compiler ) . toClass ( rc . DefaultCompiler ) ,
110
+ // TODO(tbosch): We need an explicit factory here, as
111
+ // we are getting errors in dart2js with mirrors...
112
+ bind ( rvf . ViewFactory ) . toFactory (
113
+ ( capacity , eventManager , shadowDomStrategy ) => new rvf . ViewFactory ( capacity , eventManager , shadowDomStrategy ) ,
114
+ [ rvf . VIEW_POOL_CAPACITY , EventManager , ShadowDomStrategy ]
115
+ ) ,
116
+ bind ( rvf . VIEW_POOL_CAPACITY ) . toValue ( 100000 ) ,
117
+ ProtoViewFactory ,
118
+ // TODO(tbosch): We need an explicit factory here, as
119
+ // we are getting errors in dart2js with mirrors...
120
+ bind ( ViewFactory ) . toFactory (
121
+ ( capacity ) => new ViewFactory ( capacity ) ,
122
+ [ VIEW_POOL_CAPACITY ]
123
+ ) ,
124
+ bind ( VIEW_POOL_CAPACITY ) . toValue ( 100000 ) ,
101
125
Compiler ,
102
126
CompilerCache ,
103
127
TemplateResolver ,
0 commit comments