X Tutup
Skip to content

Commit a885f37

Browse files
committed
fix(web_workers): remove unnecessary setup module and AppRootUrl
Since AppRootUrl is removed, the logic for extending and emitting the root url as part of the setup seems unnecessary. BREAKING CHANGES: The setupWebWorker function exported from angular2/platform/worker_app no longer returns a promise of providers, but instead synchronously returns providers. Related to #5815 Closes #5820
1 parent ed2c25e commit a885f37

File tree

8 files changed

+6
-72
lines changed

8 files changed

+6
-72
lines changed

modules/angular2/src/compiler/anchor_based_app_root_url.ts

Lines changed: 0 additions & 16 deletions
This file was deleted.

modules/angular2/src/compiler/compiler.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import {RuntimeCompiler} from 'angular2/src/compiler/runtime_compiler';
2525
import {ElementSchemaRegistry} from 'angular2/src/compiler/schema/element_schema_registry';
2626
import {DomElementSchemaRegistry} from 'angular2/src/compiler/schema/dom_element_schema_registry';
2727
import {UrlResolver, DEFAULT_PACKAGE_URL_PROVIDER} from 'angular2/src/compiler/url_resolver';
28-
import {AnchorBasedAppRootUrl} from 'angular2/src/compiler/anchor_based_app_root_url';
2928
import {Parser, Lexer} from 'angular2/src/core/change_detection/change_detection';
3029

3130
function _createChangeDetectorGenConfig() {
@@ -49,6 +48,5 @@ export const COMPILER_PROVIDERS: Array<Type | Provider | any[]> = CONST_EXPR([
4948
new Provider(Compiler, {useExisting: RuntimeCompiler}),
5049
DomElementSchemaRegistry,
5150
new Provider(ElementSchemaRegistry, {useExisting: DomElementSchemaRegistry}),
52-
AnchorBasedAppRootUrl,
5351
UrlResolver
5452
]);

modules/angular2/src/platform/worker_app_common.ts

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,7 @@ import {
3131
} from 'angular2/src/web_workers/shared/render_view_with_fragments_store';
3232
import {WebWorkerEventDispatcher} from 'angular2/src/web_workers/worker/event_dispatcher';
3333
import {NgZone} from 'angular2/src/core/zone/ng_zone';
34-
import {Promise, PromiseWrapper, PromiseCompleter} from 'angular2/src/facade/async';
35-
import {SETUP_CHANNEL} from 'angular2/src/web_workers/shared/messaging_api';
36-
import {ObservableWrapper} from 'angular2/src/facade/async';
34+
import {Promise, PromiseWrapper} from 'angular2/src/facade/async';
3735

3836
class PrintLogger {
3937
log = print;
@@ -76,20 +74,9 @@ function _exceptionHandler(): ExceptionHandler {
7674
*/
7775
export function genericWorkerAppProviders(bus: MessageBus,
7876
zone: NgZone): Promise<Array<Type | Provider | any[]>> {
79-
var bootstrapProcess: PromiseCompleter<any> = PromiseWrapper.completer();
8077
bus.attachToZone(zone);
81-
bus.initChannel(SETUP_CHANNEL, false);
82-
83-
var subscription: any;
84-
var emitter = bus.from(SETUP_CHANNEL);
85-
subscription = ObservableWrapper.subscribe(emitter, (initData: {[key: string]: any}) => {
86-
var bindings = ListWrapper.concat(WORKER_APP_COMMON_PROVIDERS, [
87-
new Provider(MessageBus, {useValue: bus}),
88-
]);
89-
bootstrapProcess.resolve(bindings);
90-
ObservableWrapper.dispose(subscription);
91-
});
92-
93-
ObservableWrapper.callNext(bus.to(SETUP_CHANNEL), "ready");
94-
return bootstrapProcess.promise;
78+
var bindings = ListWrapper.concat(WORKER_APP_COMMON_PROVIDERS, [
79+
new Provider(MessageBus, {useValue: bus}),
80+
]);
81+
return PromiseWrapper.resolve(bindings);
9582
}

modules/angular2/src/platform/worker_render.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import {
66
import {MessageBus} from 'angular2/src/web_workers/shared/message_bus';
77
import {APP_INITIALIZER} from 'angular2/core';
88
import {Injector, Injectable, Provider} from 'angular2/src/core/di';
9-
import {WebWorkerSetup} from 'angular2/src/web_workers/ui/setup';
109
import {MessageBasedRenderer} from 'angular2/src/web_workers/ui/renderer';
1110
import {MessageBasedXHRImpl} from 'angular2/src/web_workers/ui/xhr_impl';
1211
import {

modules/angular2/src/platform/worker_render_common.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import {CONST_EXPR, IS_DART} from 'angular2/src/facade/lang';
22
import {MessageBus} from 'angular2/src/web_workers/shared/message_bus';
33
import {NgZone} from 'angular2/src/core/zone/ng_zone';
4-
import {AnchorBasedAppRootUrl} from 'angular2/src/compiler/anchor_based_app_root_url';
54
import {
65
PLATFORM_DIRECTIVES,
76
PLATFORM_PIPES,
@@ -35,7 +34,6 @@ import {Testability} from 'angular2/src/core/testability/testability';
3534
import {BrowserGetTestability} from 'angular2/src/platform/browser/testability';
3635
import {BrowserDomAdapter} from './browser/browser_adapter';
3736
import {wtfInit} from 'angular2/src/core/profile/wtf_init';
38-
import {WebWorkerSetup} from 'angular2/src/web_workers/ui/setup';
3937
import {MessageBasedRenderer} from 'angular2/src/web_workers/ui/renderer';
4038
import {MessageBasedXHRImpl} from 'angular2/src/web_workers/ui/xhr_impl';
4139
import {
@@ -57,7 +55,7 @@ export const WORKER_SCRIPT: OpaqueToken = CONST_EXPR(new OpaqueToken("WebWorkerS
5755

5856
// Message based Worker classes that listen on the MessageBus
5957
export const WORKER_RENDER_MESSAGING_PROVIDERS: Array<any /*Type | Provider | any[]*/> =
60-
CONST_EXPR([MessageBasedRenderer, MessageBasedXHRImpl, WebWorkerSetup]);
58+
CONST_EXPR([MessageBasedRenderer, MessageBasedXHRImpl]);
6159

6260
export const WORKER_RENDER_PLATFORM: Array<any /*Type | Provider | any[]*/> = CONST_EXPR([
6361
PLATFORM_COMMON_PROVIDERS,
@@ -81,7 +79,6 @@ export const WORKER_RENDER_APP_COMMON: Array<any /*Type | Provider | any[]*/> =
8179
MessageBasedXHRImpl,
8280
new Provider(ServiceMessageBrokerFactory, {useClass: ServiceMessageBrokerFactory_}),
8381
new Provider(ClientMessageBrokerFactory, {useClass: ClientMessageBrokerFactory_}),
84-
AnchorBasedAppRootUrl,
8582
Serializer,
8683
new Provider(ON_WEB_WORKER, {useValue: false}),
8784
RenderViewWithFragmentsStore,

modules/angular2/src/web_workers/shared/messaging_api.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
* All channels used by angular's WebWorker components are listed here.
33
* You should not use these channels in your application code.
44
*/
5-
export const SETUP_CHANNEL = "ng-WebWorkerSetup";
65
export const RENDERER_CHANNEL = "ng-Renderer";
76
export const XHR_CHANNEL = "ng-XHR";
87
export const EVENT_CHANNEL = "ng-events";

modules/angular2/src/web_workers/ui/setup.ts

Lines changed: 0 additions & 27 deletions
This file was deleted.

modules/angular2/test/public_api_spec.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -614,9 +614,6 @@ var NG_COMPILER = [
614614
"VariableAst.sourceSpan=",
615615
"VariableAst.value",
616616
"VariableAst.value=",
617-
"AppRootUrl",
618-
"AppRootUrl.value",
619-
"AppRootUrl.value=",
620617
"DEFAULT_PACKAGE_URL_PROVIDER",
621618
"UrlResolver",
622619
"UrlResolver.resolve()",

0 commit comments

Comments
 (0)
X Tutup