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
This commit is contained in:
Jeff Cross
2015-12-10 16:24:46 -08:00
parent ed2c25eb2f
commit a885f37dfa
8 changed files with 6 additions and 72 deletions

View File

@ -31,9 +31,7 @@ import {
} from 'angular2/src/web_workers/shared/render_view_with_fragments_store';
import {WebWorkerEventDispatcher} from 'angular2/src/web_workers/worker/event_dispatcher';
import {NgZone} from 'angular2/src/core/zone/ng_zone';
import {Promise, PromiseWrapper, PromiseCompleter} from 'angular2/src/facade/async';
import {SETUP_CHANNEL} from 'angular2/src/web_workers/shared/messaging_api';
import {ObservableWrapper} from 'angular2/src/facade/async';
import {Promise, PromiseWrapper} from 'angular2/src/facade/async';
class PrintLogger {
log = print;
@ -76,20 +74,9 @@ function _exceptionHandler(): ExceptionHandler {
*/
export function genericWorkerAppProviders(bus: MessageBus,
zone: NgZone): Promise<Array<Type | Provider | any[]>> {
var bootstrapProcess: PromiseCompleter<any> = PromiseWrapper.completer();
bus.attachToZone(zone);
bus.initChannel(SETUP_CHANNEL, false);
var subscription: any;
var emitter = bus.from(SETUP_CHANNEL);
subscription = ObservableWrapper.subscribe(emitter, (initData: {[key: string]: any}) => {
var bindings = ListWrapper.concat(WORKER_APP_COMMON_PROVIDERS, [
new Provider(MessageBus, {useValue: bus}),
]);
bootstrapProcess.resolve(bindings);
ObservableWrapper.dispose(subscription);
});
ObservableWrapper.callNext(bus.to(SETUP_CHANNEL), "ready");
return bootstrapProcess.promise;
var bindings = ListWrapper.concat(WORKER_APP_COMMON_PROVIDERS, [
new Provider(MessageBus, {useValue: bus}),
]);
return PromiseWrapper.resolve(bindings);
}

View File

@ -6,7 +6,6 @@ import {
import {MessageBus} from 'angular2/src/web_workers/shared/message_bus';
import {APP_INITIALIZER} from 'angular2/core';
import {Injector, Injectable, Provider} from 'angular2/src/core/di';
import {WebWorkerSetup} from 'angular2/src/web_workers/ui/setup';
import {MessageBasedRenderer} from 'angular2/src/web_workers/ui/renderer';
import {MessageBasedXHRImpl} from 'angular2/src/web_workers/ui/xhr_impl';
import {

View File

@ -1,7 +1,6 @@
import {CONST_EXPR, IS_DART} from 'angular2/src/facade/lang';
import {MessageBus} from 'angular2/src/web_workers/shared/message_bus';
import {NgZone} from 'angular2/src/core/zone/ng_zone';
import {AnchorBasedAppRootUrl} from 'angular2/src/compiler/anchor_based_app_root_url';
import {
PLATFORM_DIRECTIVES,
PLATFORM_PIPES,
@ -35,7 +34,6 @@ import {Testability} from 'angular2/src/core/testability/testability';
import {BrowserGetTestability} from 'angular2/src/platform/browser/testability';
import {BrowserDomAdapter} from './browser/browser_adapter';
import {wtfInit} from 'angular2/src/core/profile/wtf_init';
import {WebWorkerSetup} from 'angular2/src/web_workers/ui/setup';
import {MessageBasedRenderer} from 'angular2/src/web_workers/ui/renderer';
import {MessageBasedXHRImpl} from 'angular2/src/web_workers/ui/xhr_impl';
import {
@ -57,7 +55,7 @@ export const WORKER_SCRIPT: OpaqueToken = CONST_EXPR(new OpaqueToken("WebWorkerS
// Message based Worker classes that listen on the MessageBus
export const WORKER_RENDER_MESSAGING_PROVIDERS: Array<any /*Type | Provider | any[]*/> =
CONST_EXPR([MessageBasedRenderer, MessageBasedXHRImpl, WebWorkerSetup]);
CONST_EXPR([MessageBasedRenderer, MessageBasedXHRImpl]);
export const WORKER_RENDER_PLATFORM: Array<any /*Type | Provider | any[]*/> = CONST_EXPR([
PLATFORM_COMMON_PROVIDERS,
@ -81,7 +79,6 @@ export const WORKER_RENDER_APP_COMMON: Array<any /*Type | Provider | any[]*/> =
MessageBasedXHRImpl,
new Provider(ServiceMessageBrokerFactory, {useClass: ServiceMessageBrokerFactory_}),
new Provider(ClientMessageBrokerFactory, {useClass: ClientMessageBrokerFactory_}),
AnchorBasedAppRootUrl,
Serializer,
new Provider(ON_WEB_WORKER, {useValue: false}),
RenderViewWithFragmentsStore,