Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(571)

Unified Diff: lib/runtime/dart/_isolate_helper.js

Issue 1355893003: Rewire DDC to use the analyzer task model (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: Fix for identifiers Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: lib/runtime/dart/_isolate_helper.js
diff --git a/lib/runtime/dart/_isolate_helper.js b/lib/runtime/dart/_isolate_helper.js
index e677b60bc6db91c5790f20cea3336f92f8a61ed4..ba26ef41067c4bddf91908d9197bc49f76e1ff06 100644
--- a/lib/runtime/dart/_isolate_helper.js
+++ b/lib/runtime/dart/_isolate_helper.js
@@ -14,17 +14,17 @@ dart_library.library('dart/_isolate_helper', null, /* Imports */[
'use strict';
let dartx = dart.dartx;
function _serializeMessage(message) {
- return new _Serializer().serialize(message);
+ return dart.dcall(new _Serializer().serialize, message);
}
dart.fn(_serializeMessage);
function _deserializeMessage(message) {
- return new _Deserializer().deserialize(message);
+ return dart.dcall(new _Deserializer().deserialize, message);
}
dart.fn(_deserializeMessage);
function _clone(message) {
let serializer = new _Serializer({serializeSendPorts: false});
let deserializer = new _Deserializer();
- return deserializer.deserialize(serializer.serialize(message));
+ return dart.dcall(deserializer.deserialize, dart.dcall(serializer.serialize, message));
}
dart.fn(_clone);
let _serializeSendPorts = Symbol('_serializeSendPorts');
@@ -40,35 +40,35 @@ dart_library.library('dart/_isolate_helper', null, /* Imports */[
this[_serializeSendPorts] = dart.as(serializeSendPorts, core.bool);
}
serialize(x) {
- if (dart.notNull(this.isPrimitive(x)))
- return this.serializePrimitive(x);
+ if (dart.notNull(dart.dcall(this.isPrimitive, x)))
+ return dart.dcall(this.serializePrimitive, x);
let serializationId = this.serializedObjectIds.get(x);
if (serializationId != null)
- return this.makeRef(serializationId);
+ return dart.dcall(this.makeRef, serializationId);
serializationId = this.serializedObjectIds.length;
this.serializedObjectIds.set(x, serializationId);
if (dart.is(x, _native_typed_data.NativeByteBuffer))
- return this.serializeByteBuffer(dart.as(x, _native_typed_data.NativeByteBuffer));
+ return dart.dcall(this.serializeByteBuffer, x);
if (dart.is(x, _native_typed_data.NativeTypedData))
- return this.serializeTypedData(dart.as(x, _native_typed_data.NativeTypedData));
+ return dart.dcall(this.serializeTypedData, x);
if (dart.is(x, _interceptors.JSIndexable))
- return this.serializeJSIndexable(dart.as(x, _interceptors.JSIndexable));
+ return dart.dcall(this.serializeJSIndexable, x);
if (dart.is(x, _js_helper.InternalMap))
- return this.serializeMap(dart.as(x, core.Map));
+ return dart.dcall(this.serializeMap, x);
if (dart.is(x, _interceptors.JSObject))
- return this.serializeJSObject(dart.as(x, _interceptors.JSObject));
+ return dart.dcall(this.serializeJSObject, x);
if (dart.is(x, _interceptors.Interceptor))
- this.unsupported(x);
+ dart.dcall(this.unsupported, x);
if (dart.is(x, isolate.RawReceivePort)) {
- this.unsupported(x, "RawReceivePorts can't be transmitted:");
+ dart.dcall(this.unsupported, x, "RawReceivePorts can't be transmitted:");
}
if (dart.is(x, _NativeJsSendPort))
- return this.serializeJsSendPort(dart.as(x, _NativeJsSendPort));
+ return dart.dcall(this.serializeJsSendPort, x);
if (dart.is(x, _WorkerSendPort))
- return this.serializeWorkerSendPort(dart.as(x, _WorkerSendPort));
+ return dart.dcall(this.serializeWorkerSendPort, x);
if (dart.is(x, core.Function))
- return this.serializeClosure(dart.as(x, core.Function));
- return this.serializeDartObject(x);
+ return dart.dcall(this.serializeClosure, x);
+ return dart.dcall(this.serializeDartObject, x);
}
unsupported(x, message) {
if (message === void 0)
@@ -94,7 +94,7 @@ dart_library.library('dart/_isolate_helper', null, /* Imports */[
}
serializeJSIndexable(indexable) {
dart.assert(!(typeof indexable == 'string'));
- let serialized = dart.as(this.serializeArray(dart.as(indexable, _interceptors.JSArray)), core.List);
+ let serialized = dart.as(dart.dcall(this.serializeArray, indexable), core.List);
if (dart.is(indexable, _interceptors.JSFixedArray))
return ["fixed", serialized];
if (dart.is(indexable, _interceptors.JSExtendableArray))
@@ -103,36 +103,36 @@ dart_library.library('dart/_isolate_helper', null, /* Imports */[
return ["mutable", serialized];
if (dart.is(indexable, _interceptors.JSArray))
return ["const", serialized];
- this.unsupported(indexable, "Can't serialize indexable: ");
+ dart.dcall(this.unsupported, indexable, "Can't serialize indexable: ");
return null;
}
serializeArray(x) {
let serialized = [];
serialized[dartx.length] = x[dartx.length];
for (let i = 0; dart.notNull(i) < dart.notNull(x[dartx.length]); i = dart.notNull(i) + 1) {
- serialized[dartx.set](i, this.serialize(x[dartx.get](i)));
+ serialized[dartx.set](i, dart.dcall(this.serialize, x[dartx.get](i)));
}
return serialized;
}
serializeArrayInPlace(x) {
for (let i = 0; dart.notNull(i) < dart.notNull(x[dartx.length]); i = dart.notNull(i) + 1) {
- x[dartx.set](i, this.serialize(x[dartx.get](i)));
+ x[dartx.set](i, dart.dcall(this.serialize, x[dartx.get](i)));
}
return x;
}
serializeMap(x) {
let serializeTearOff = dart.bind(this, 'serialize');
- return ['map', x.keys[dartx.map](dart.as(serializeTearOff, __CastType0))[dartx.toList](), x.values[dartx.map](dart.as(serializeTearOff, dart.functionType(dart.dynamic, [dart.dynamic])))[dartx.toList]()];
+ return ['map', dart.dcall(dart.dcall(x.keys[dartx.map], serializeTearOff)[dartx.toList]), dart.dcall(dart.dcall(x.values[dartx.map], serializeTearOff)[dartx.toList])];
}
serializeJSObject(x) {
- if (!!x.constructor && x.constructor !== Object) {
- this.unsupported(x, "Only plain JS Objects are supported:");
+ if (dart.notNull(dart.as(!!x.constructor, core.bool)) && dart.notNull(dart.as(x.constructor !== Object, core.bool))) {
+ dart.dcall(this.unsupported, x, "Only plain JS Objects are supported:");
}
let keys = dart.as(Object.keys(x), core.List);
let values = [];
values[dartx.length] = keys[dartx.length];
for (let i = 0; dart.notNull(i) < dart.notNull(keys[dartx.length]); i = dart.notNull(i) + 1) {
- values[dartx.set](i, this.serialize(x[keys[dartx.get](i)]));
+ values[dartx.set](i, dart.dcall(this.serialize, x[keys[dartx.get](i)]));
}
return ['js-object', keys, values];
}
@@ -153,18 +153,18 @@ dart_library.library('dart/_isolate_helper', null, /* Imports */[
return ['capability', x[_id]];
}
serializeClosure(x) {
- let name = IsolateNatives._getJSFunctionName(x);
+ let name = dart.dcall(IsolateNatives._getJSFunctionName, x);
if (name == null) {
- this.unsupported(x, "Closures can't be transmitted:");
+ dart.dcall(this.unsupported, x, "Closures can't be transmitted:");
}
return ['function', name];
}
serializeDartObject(x) {
- let classExtractor = _foreign_helper.JS_EMBEDDED_GLOBAL('', _js_embedded_names.CLASS_ID_EXTRACTOR);
- let fieldsExtractor = _foreign_helper.JS_EMBEDDED_GLOBAL('', _js_embedded_names.CLASS_FIELDS_EXTRACTOR);
- let classId = classExtractor(x);
+ let classExtractor = dart.dcall(_foreign_helper.JS_EMBEDDED_GLOBAL, '', _js_embedded_names.CLASS_ID_EXTRACTOR);
+ let fieldsExtractor = dart.dcall(_foreign_helper.JS_EMBEDDED_GLOBAL, '', _js_embedded_names.CLASS_FIELDS_EXTRACTOR);
+ let classId = dart.as(classExtractor(x), core.String);
let fields = dart.as(fieldsExtractor(x), core.List);
- return ['dart', classId, this.serializeArrayInPlace(dart.as(fields, _interceptors.JSArray))];
+ return ['dart', classId, dart.dcall(this.serializeArrayInPlace, fields)];
}
}
dart.setSignature(_Serializer, {
@@ -197,62 +197,62 @@ dart_library.library('dart/_isolate_helper', null, /* Imports */[
this[_adjustSendPorts] = dart.as(adjustSendPorts, core.bool);
}
deserialize(x) {
- if (dart.notNull(this.isPrimitive(x)))
- return this.deserializePrimitive(x);
+ if (dart.notNull(dart.dcall(this.isPrimitive, x)))
+ return dart.dcall(this.deserializePrimitive, x);
if (!dart.is(x, _interceptors.JSArray))
dart.throw(new core.ArgumentError(`Bad serialized message: ${x}`));
switch (dart.dload(x, 'first')) {
case "ref":
{
- return this.deserializeRef(x);
+ return dart.dcall(this.deserializeRef, x);
}
case "buffer":
{
- return this.deserializeByteBuffer(x);
+ return dart.dcall(this.deserializeByteBuffer, x);
}
case "typed":
{
- return this.deserializeTypedData(x);
+ return dart.dcall(this.deserializeTypedData, x);
}
case "fixed":
{
- return this.deserializeFixed(x);
+ return dart.dcall(this.deserializeFixed, x);
}
case "extendable":
{
- return this.deserializeExtendable(x);
+ return dart.dcall(this.deserializeExtendable, x);
}
case "mutable":
{
- return this.deserializeMutable(x);
+ return dart.dcall(this.deserializeMutable, x);
}
case "const":
{
- return this.deserializeConst(x);
+ return dart.dcall(this.deserializeConst, x);
}
case "map":
{
- return this.deserializeMap(x);
+ return dart.dcall(this.deserializeMap, x);
}
case "sendport":
{
- return this.deserializeSendPort(x);
+ return dart.dcall(this.deserializeSendPort, x);
}
case "raw sendport":
{
- return this.deserializeRawSendPort(x);
+ return dart.dcall(this.deserializeRawSendPort, x);
}
case "js-object":
{
- return this.deserializeJSObject(x);
+ return dart.dcall(this.deserializeJSObject, x);
}
case "function":
{
- return this.deserializeClosure(x);
+ return dart.dcall(this.deserializeClosure, x);
}
case "dart":
{
- return this.deserializeDartObject(x);
+ return dart.dcall(this.deserializeDartObject, x);
}
default:
{
@@ -274,54 +274,54 @@ dart_library.library('dart/_isolate_helper', null, /* Imports */[
deserializeByteBuffer(x) {
dart.assert(dart.equals(dart.dindex(x, 0), 'buffer'));
let result = dart.as(dart.dindex(x, 1), _native_typed_data.NativeByteBuffer);
- this.deserializedObjects[dartx.add](result);
+ dart.dcall(this.deserializedObjects[dartx.add], result);
return result;
}
deserializeTypedData(x) {
dart.assert(dart.equals(dart.dindex(x, 0), 'typed'));
let result = dart.as(dart.dindex(x, 1), _native_typed_data.NativeTypedData);
- this.deserializedObjects[dartx.add](result);
+ dart.dcall(this.deserializedObjects[dartx.add], result);
return result;
}
deserializeArrayInPlace(x) {
for (let i = 0; dart.notNull(i) < dart.notNull(x[dartx.length]); i = dart.notNull(i) + 1) {
- x[dartx.set](i, this.deserialize(x[dartx.get](i)));
+ x[dartx.set](i, dart.dcall(this.deserialize, x[dartx.get](i)));
}
return x;
}
deserializeFixed(x) {
dart.assert(dart.equals(dart.dindex(x, 0), 'fixed'));
let result = dart.as(dart.dindex(x, 1), core.List);
- this.deserializedObjects[dartx.add](result);
- return _interceptors.JSArray.markFixed(this.deserializeArrayInPlace(dart.as(result, _interceptors.JSArray)));
+ dart.dcall(this.deserializedObjects[dartx.add], result);
+ return _interceptors.JSArray.markFixed(dart.dcall(this.deserializeArrayInPlace, result));
}
deserializeExtendable(x) {
dart.assert(dart.equals(dart.dindex(x, 0), 'extendable'));
let result = dart.as(dart.dindex(x, 1), core.List);
- this.deserializedObjects[dartx.add](result);
- return _interceptors.JSArray.markGrowable(this.deserializeArrayInPlace(dart.as(result, _interceptors.JSArray)));
+ dart.dcall(this.deserializedObjects[dartx.add], result);
+ return _interceptors.JSArray.markGrowable(dart.dcall(this.deserializeArrayInPlace, result));
}
deserializeMutable(x) {
dart.assert(dart.equals(dart.dindex(x, 0), 'mutable'));
let result = dart.as(dart.dindex(x, 1), core.List);
- this.deserializedObjects[dartx.add](result);
- return this.deserializeArrayInPlace(dart.as(result, _interceptors.JSArray));
+ dart.dcall(this.deserializedObjects[dartx.add], result);
+ return dart.dcall(this.deserializeArrayInPlace, result);
}
deserializeConst(x) {
dart.assert(dart.equals(dart.dindex(x, 0), 'const'));
let result = dart.as(dart.dindex(x, 1), core.List);
- this.deserializedObjects[dartx.add](result);
- return _interceptors.JSArray.markFixed(this.deserializeArrayInPlace(dart.as(result, _interceptors.JSArray)));
+ dart.dcall(this.deserializedObjects[dartx.add], result);
+ return _interceptors.JSArray.markFixed(dart.dcall(this.deserializeArrayInPlace, result));
}
deserializeMap(x) {
dart.assert(dart.equals(dart.dindex(x, 0), 'map'));
let keys = dart.as(dart.dindex(x, 1), core.List);
let values = dart.as(dart.dindex(x, 2), core.List);
let result = dart.map();
- this.deserializedObjects[dartx.add](result);
- keys = keys[dartx.map](dart.bind(this, 'deserialize'))[dartx.toList]();
+ dart.dcall(this.deserializedObjects[dartx.add], result);
+ keys = dart.dcall(dart.dcall(keys[dartx.map], dart.bind(this, 'deserialize'))[dartx.toList]);
for (let i = 0; dart.notNull(i) < dart.notNull(keys[dartx.length]); i = dart.notNull(i) + 1) {
- result.set(keys[dartx.get](i), this.deserialize(values[dartx.get](i)));
+ result.set(keys[dartx.get](i), dart.dcall(this.deserialize, values[dartx.get](i)));
}
return result;
}
@@ -335,20 +335,20 @@ dart_library.library('dart/_isolate_helper', null, /* Imports */[
let isolate = exports._globalState.isolates.get(isolateId);
if (isolate == null)
return null;
- let receivePort = isolate.lookup(receivePortId);
+ let receivePort = dart.dsend(isolate, 'lookup', receivePortId);
if (receivePort == null)
return null;
- result = new _NativeJsSendPort(receivePort, isolateId);
+ result = new _NativeJsSendPort(dart.as(receivePort, RawReceivePortImpl), isolateId);
} else {
result = new _WorkerSendPort(managerId, isolateId, receivePortId);
}
- this.deserializedObjects[dartx.add](result);
+ dart.dcall(this.deserializedObjects[dartx.add], result);
return result;
}
deserializeRawSendPort(x) {
dart.assert(dart.equals(dart.dindex(x, 0), 'raw sendport'));
let result = dart.as(dart.dindex(x, 1), isolate.SendPort);
- this.deserializedObjects[dartx.add](result);
+ dart.dcall(this.deserializedObjects[dartx.add], result);
return result;
}
deserializeJSObject(x) {
@@ -356,28 +356,28 @@ dart_library.library('dart/_isolate_helper', null, /* Imports */[
let keys = dart.as(dart.dindex(x, 1), core.List);
let values = dart.as(dart.dindex(x, 2), core.List);
let o = {};
- this.deserializedObjects[dartx.add](o);
+ dart.dcall(this.deserializedObjects[dartx.add], o);
for (let i = 0; dart.notNull(i) < dart.notNull(keys[dartx.length]); i = dart.notNull(i) + 1) {
- o[keys[dartx.get](i)] = this.deserialize(values[dartx.get](i));
+ o[keys[dartx.get](i)] = dart.dcall(this.deserialize, values[dartx.get](i));
}
return o;
}
deserializeClosure(x) {
dart.assert(dart.equals(dart.dindex(x, 0), 'function'));
let name = dart.as(dart.dindex(x, 1), core.String);
- let result = dart.as(IsolateNatives._getJSFunctionFromName(name), core.Function);
- this.deserializedObjects[dartx.add](result);
+ let result = dart.as(dart.dcall(IsolateNatives._getJSFunctionFromName, name), core.Function);
+ dart.dcall(this.deserializedObjects[dartx.add], result);
return result;
}
deserializeDartObject(x) {
dart.assert(dart.equals(dart.dindex(x, 0), 'dart'));
let classId = dart.as(dart.dindex(x, 1), core.String);
let fields = dart.as(dart.dindex(x, 2), core.List);
- let instanceFromClassId = _foreign_helper.JS_EMBEDDED_GLOBAL('', _js_embedded_names.INSTANCE_FROM_CLASS_ID);
- let initializeObject = _foreign_helper.JS_EMBEDDED_GLOBAL('', _js_embedded_names.INITIALIZE_EMPTY_INSTANCE);
+ let instanceFromClassId = dart.dcall(_foreign_helper.JS_EMBEDDED_GLOBAL, '', _js_embedded_names.INSTANCE_FROM_CLASS_ID);
+ let initializeObject = dart.dcall(_foreign_helper.JS_EMBEDDED_GLOBAL, '', _js_embedded_names.INITIALIZE_EMPTY_INSTANCE);
let emptyInstance = instanceFromClassId(classId);
- this.deserializedObjects[dartx.add](emptyInstance);
- this.deserializeArrayInPlace(dart.as(fields, _interceptors.JSArray));
+ dart.dcall(this.deserializedObjects[dartx.add], emptyInstance);
+ dart.dcall(this.deserializeArrayInPlace, fields);
return initializeObject(classId, emptyInstance, fields);
}
}
@@ -403,10 +403,9 @@ dart_library.library('dart/_isolate_helper', null, /* Imports */[
deserializeDartObject: [dart.dynamic, [dart.dynamic]]
})
});
- let __CastType0 = dart.typedef('__CastType0', () => dart.functionType(dart.dynamic, [dart.dynamic]));
function _callInIsolate(isolate, func) {
- let result = isolate.eval(func);
- exports._globalState.topEventLoop.run();
+ let result = dart.dcall(isolate.eval, func);
+ dart.dcall(exports._globalState.topEventLoop.run);
return result;
}
dart.fn(_callInIsolate, () => dart.definiteFunctionType(dart.dynamic, [_IsolateContext, core.Function]));
@@ -441,20 +440,20 @@ dart_library.library('dart/_isolate_helper', null, /* Imports */[
if (dart.notNull(exports._globalState.isWorker))
return;
let rootContext = new _IsolateContext();
- exports._globalState.rootContext = rootContext;
- exports._globalState.currentContext = rootContext;
+ exports._globalState.rootContext = dart.as(rootContext, _IsolateContext);
+ exports._globalState.currentContext = dart.as(rootContext, _IsolateContext);
if (dart.is(entry, _MainFunctionArgs)) {
- rootContext.eval(dart.fn(() => {
+ dart.dsend(rootContext, 'eval', dart.fn(() => {
dart.dcall(entry, args);
}));
} else if (dart.is(entry, _MainFunctionArgsMessage)) {
- rootContext.eval(dart.fn(() => {
+ dart.dsend(rootContext, 'eval', dart.fn(() => {
dart.dcall(entry, args, null);
}));
} else {
- rootContext.eval(dart.as(entry, core.Function));
+ dart.dsend(rootContext, 'eval', entry);
}
- exports._globalState.topEventLoop.run();
+ dart.dcall(exports._globalState.topEventLoop.run);
}
dart.fn(startRootIsolate, dart.void, [dart.dynamic, dart.dynamic]);
dart.copyProperties(exports, {
@@ -485,13 +484,13 @@ dart_library.library('dart/_isolate_helper', null, /* Imports */[
this.isolates = null;
this.mainManager = null;
this.managers = null;
- this[_nativeDetectEnvironment]();
+ dart.dcall(this[_nativeDetectEnvironment]);
this.topEventLoop = new _EventLoop();
this.isolates = core.Map$(core.int, _IsolateContext).new();
this.managers = core.Map$(core.int, dart.dynamic).new();
if (dart.notNull(this.isWorker)) {
this.mainManager = new _MainManagerStub();
- this[_nativeInitWorkerMessageHandler]();
+ dart.dcall(this[_nativeInitWorkerMessageHandler]);
}
}
[_nativeDetectEnvironment]() {
@@ -519,11 +518,11 @@ dart_library.library('dart/_isolate_helper', null, /* Imports */[
})(_Manager._serializePrintMessage);
}
static _serializePrintMessage(object) {
- return _serializeMessage(dart.map({command: "print", msg: object}));
+ return dart.dcall(_serializeMessage, dart.map({command: "print", msg: object}));
}
maybeCloseWorker() {
if (dart.notNull(this.isWorker) && dart.notNull(this.isolates.isEmpty) && this.topEventLoop[_activeJsAsyncCount] == 0) {
- this.mainManager.postMessage(_serializeMessage(dart.map({command: 'close'})));
+ dart.dcall(this.mainManager.postMessage, dart.dcall(_serializeMessage, dart.map({command: 'close'})));
}
}
}
@@ -552,7 +551,7 @@ dart_library.library('dart/_isolate_helper', null, /* Imports */[
})();
this.ports = core.Map$(core.int, RawReceivePortImpl).new();
this.weakPorts = core.Set$(core.int).new();
- this.isolateStatics = _foreign_helper.JS_CREATE_ISOLATE();
+ this.isolateStatics = dart.dcall(_foreign_helper.JS_CREATE_ISOLATE);
this.controlPort = new RawReceivePortImpl._controlPort();
this.pauseCapability = isolate.Capability.new();
this.terminateCapability = isolate.Capability.new();
@@ -565,28 +564,28 @@ dart_library.library('dart/_isolate_helper', null, /* Imports */[
this[_scheduledControlEvents] = null;
this[_isExecutingEvent] = false;
this.errorsAreFatal = true;
- this.registerWeak(this.controlPort[_id], this.controlPort);
+ dart.dcall(this.registerWeak, this.controlPort[_id], this.controlPort);
}
addPause(authentification, resume) {
if (!dart.equals(this.pauseCapability, authentification))
return;
- if (dart.notNull(this.pauseTokens.add(resume)) && !dart.notNull(this.isPaused)) {
+ if (dart.notNull(dart.dcall(this.pauseTokens.add, resume)) && !dart.notNull(this.isPaused)) {
this.isPaused = true;
}
- this[_updateGlobalState]();
+ dart.dcall(this[_updateGlobalState]);
}
removePause(resume) {
if (!dart.notNull(this.isPaused))
return;
- this.pauseTokens.remove(resume);
+ dart.dcall(this.pauseTokens.remove, resume);
if (dart.notNull(this.pauseTokens.isEmpty)) {
while (dart.notNull(this.delayedEvents[dartx.isNotEmpty])) {
- let event = this.delayedEvents[dartx.removeLast]();
- exports._globalState.topEventLoop.prequeue(event);
+ let event = dart.dcall(this.delayedEvents[dartx.removeLast]);
+ dart.dcall(exports._globalState.topEventLoop.prequeue, event);
}
this.isPaused = false;
}
- this[_updateGlobalState]();
+ dart.dcall(this[_updateGlobalState]);
}
addDoneListener(responsePort) {
if (this.doneHandlers == null) {
@@ -608,15 +607,15 @@ dart_library.library('dart/_isolate_helper', null, /* Imports */[
}
handlePing(responsePort, pingType) {
if (pingType == isolate.Isolate.IMMEDIATE || pingType == isolate.Isolate.BEFORE_NEXT_EVENT && !dart.notNull(this[_isExecutingEvent])) {
- responsePort.send(null);
+ dart.dcall(responsePort.send, null);
return;
}
function respond() {
- responsePort.send(null);
+ dart.dcall(responsePort.send, null);
}
dart.fn(respond, dart.void, []);
if (pingType == isolate.Isolate.AS_EVENT) {
- exports._globalState.topEventLoop.enqueue(this, respond, "ping");
+ dart.dcall(exports._globalState.topEventLoop.enqueue, this, respond, "ping");
return;
}
dart.assert(pingType == isolate.Isolate.BEFORE_NEXT_EVENT);
@@ -629,11 +628,11 @@ dart_library.library('dart/_isolate_helper', null, /* Imports */[
if (!dart.equals(this.terminateCapability, authentification))
return;
if (priority == isolate.Isolate.IMMEDIATE || priority == isolate.Isolate.BEFORE_NEXT_EVENT && !dart.notNull(this[_isExecutingEvent])) {
- this.kill();
+ dart.dcall(this.kill);
return;
}
if (priority == isolate.Isolate.AS_EVENT) {
- exports._globalState.topEventLoop.enqueue(this, dart.bind(this, 'kill'), "kill");
+ dart.dcall(exports._globalState.topEventLoop.enqueue, this, dart.bind(this, 'kill'), "kill");
return;
}
dart.assert(priority == isolate.Isolate.BEFORE_NEXT_EVENT);
@@ -643,54 +642,54 @@ dart_library.library('dart/_isolate_helper', null, /* Imports */[
dart.dsend(this[_scheduledControlEvents], 'addLast', dart.bind(this, 'kill'));
}
addErrorListener(port) {
- this.errorPorts.add(port);
+ dart.dcall(this.errorPorts.add, port);
}
removeErrorListener(port) {
- this.errorPorts.remove(port);
+ dart.dcall(this.errorPorts.remove, port);
}
handleUncaughtError(error, stackTrace) {
if (dart.notNull(this.errorPorts.isEmpty)) {
- if (dart.notNull(this.errorsAreFatal) && dart.notNull(core.identical(this, exports._globalState.rootContext))) {
+ if (dart.notNull(this.errorsAreFatal) && dart.notNull(dart.dcall(core.identical, this, exports._globalState.rootContext))) {
return;
}
- if (self.console && self.console.error) {
+ if (dart.notNull(dart.as(self.console && self.console.error, core.bool))) {
self.console.error(error, stackTrace);
} else {
- core.print(error);
+ dart.dcall(core.print, error);
if (stackTrace != null)
- core.print(stackTrace);
+ dart.dcall(core.print, stackTrace);
}
return;
}
let message = core.List.new(2);
- message[dartx.set](0, dart.toString(error));
- message[dartx.set](1, stackTrace == null ? null : dart.toString(stackTrace));
+ message[dartx.set](0, dart.dsend(error, 'toString'));
+ message[dartx.set](1, stackTrace == null ? null : dart.dcall(stackTrace.toString));
for (let port of this.errorPorts)
- port.send(message);
+ dart.dcall(port.send, message);
}
eval(code) {
let old = exports._globalState.currentContext;
exports._globalState.currentContext = this;
- this[_setGlobals]();
+ dart.dcall(this[_setGlobals]);
let result = null;
this[_isExecutingEvent] = true;
try {
result = dart.dcall(code);
} catch (e) {
let s = dart.stackTrace(e);
- this.handleUncaughtError(e, s);
+ dart.dcall(this.handleUncaughtError, e, s);
if (dart.notNull(this.errorsAreFatal)) {
- this.kill();
- if (dart.notNull(core.identical(this, exports._globalState.rootContext))) {
+ dart.dcall(this.kill);
+ if (dart.notNull(dart.dcall(core.identical, this, exports._globalState.rootContext))) {
throw e;
}
}
}
finally {
this[_isExecutingEvent] = false;
- exports._globalState.currentContext = old;
+ exports._globalState.currentContext = dart.as(old, _IsolateContext);
if (old != null)
- old[_setGlobals]();
+ dart.dsend(old, _setGlobals);
if (this[_scheduledControlEvents] != null) {
while (dart.notNull(dart.as(dart.dload(this[_scheduledControlEvents], 'isNotEmpty'), core.bool))) {
dart.dcall(dart.dsend(this[_scheduledControlEvents], 'removeFirst'));
@@ -700,53 +699,53 @@ dart_library.library('dart/_isolate_helper', null, /* Imports */[
return result;
}
[_setGlobals]() {
- _foreign_helper.JS_SET_CURRENT_ISOLATE(this.isolateStatics);
+ dart.dcall(_foreign_helper.JS_SET_CURRENT_ISOLATE, this.isolateStatics);
}
handleControlMessage(message) {
switch (dart.dindex(message, 0)) {
case "pause":
{
- this.addPause(dart.as(dart.dindex(message, 1), isolate.Capability), dart.as(dart.dindex(message, 2), isolate.Capability));
+ dart.dcall(this.addPause, dart.dindex(message, 1), dart.dindex(message, 2));
break;
}
case "resume":
{
- this.removePause(dart.as(dart.dindex(message, 1), isolate.Capability));
+ dart.dcall(this.removePause, dart.dindex(message, 1));
break;
}
case 'add-ondone':
{
- this.addDoneListener(dart.as(dart.dindex(message, 1), isolate.SendPort));
+ dart.dcall(this.addDoneListener, dart.dindex(message, 1));
break;
}
case 'remove-ondone':
{
- this.removeDoneListener(dart.as(dart.dindex(message, 1), isolate.SendPort));
+ dart.dcall(this.removeDoneListener, dart.dindex(message, 1));
break;
}
case 'set-errors-fatal':
{
- this.setErrorsFatal(dart.as(dart.dindex(message, 1), isolate.Capability), dart.as(dart.dindex(message, 2), core.bool));
+ dart.dcall(this.setErrorsFatal, dart.dindex(message, 1), dart.dindex(message, 2));
break;
}
case "ping":
{
- this.handlePing(dart.as(dart.dindex(message, 1), isolate.SendPort), dart.as(dart.dindex(message, 2), core.int));
+ dart.dcall(this.handlePing, dart.dindex(message, 1), dart.dindex(message, 2));
break;
}
case "kill":
{
- this.handleKill(dart.as(dart.dindex(message, 1), isolate.Capability), dart.as(dart.dindex(message, 2), core.int));
+ dart.dcall(this.handleKill, dart.dindex(message, 1), dart.dindex(message, 2));
break;
}
case "getErrors":
{
- this.addErrorListener(dart.as(dart.dindex(message, 1), isolate.SendPort));
+ dart.dcall(this.addErrorListener, dart.dindex(message, 1));
break;
}
case "stopErrors":
{
- this.removeErrorListener(dart.as(dart.dindex(message, 1), isolate.SendPort));
+ dart.dcall(this.removeErrorListener, dart.dindex(message, 1));
break;
}
default:
@@ -756,24 +755,24 @@ dart_library.library('dart/_isolate_helper', null, /* Imports */[
return this.ports.get(portId);
}
[_addRegistration](portId, port) {
- if (dart.notNull(this.ports.containsKey(portId))) {
+ if (dart.notNull(dart.dcall(this.ports.containsKey, portId))) {
dart.throw(core.Exception.new("Registry: ports must be registered only once."));
}
this.ports.set(portId, port);
}
register(portId, port) {
- this[_addRegistration](portId, port);
- this[_updateGlobalState]();
+ dart.dcall(this[_addRegistration], portId, port);
+ dart.dcall(this[_updateGlobalState]);
}
registerWeak(portId, port) {
- this.weakPorts.add(portId);
- this[_addRegistration](portId, port);
+ dart.dcall(this.weakPorts.add, portId);
+ dart.dcall(this[_addRegistration], portId, port);
}
[_updateGlobalState]() {
if (dart.notNull(this.ports.length) - dart.notNull(this.weakPorts.length) > 0 || dart.notNull(this.isPaused) || !dart.notNull(this.initialized)) {
exports._globalState.isolates.set(this.id, this);
} else {
- this.kill();
+ dart.dcall(this.kill);
}
}
kill() {
@@ -781,23 +780,23 @@ dart_library.library('dart/_isolate_helper', null, /* Imports */[
dart.dsend(this[_scheduledControlEvents], 'clear');
}
for (let port of this.ports.values) {
- port[_close]();
+ dart.dsend(port, _close);
}
- this.ports.clear();
- this.weakPorts.clear();
- exports._globalState.isolates.remove(this.id);
- this.errorPorts.clear();
+ dart.dcall(this.ports.clear);
+ dart.dcall(this.weakPorts.clear);
+ dart.dcall(exports._globalState.isolates.remove, this.id);
+ dart.dcall(this.errorPorts.clear);
if (this.doneHandlers != null) {
for (let port of dart.as(this.doneHandlers, core.Iterable$(isolate.SendPort))) {
- port.send(null);
+ dart.dcall(port.send, null);
}
this.doneHandlers = null;
}
}
unregister(portId) {
- this.ports.remove(portId);
- this.weakPorts.remove(portId);
- this[_updateGlobalState]();
+ dart.dcall(this.ports.remove, portId);
+ dart.dcall(this.weakPorts.remove, portId);
+ dart.dcall(this[_updateGlobalState]);
}
}
_IsolateContext[dart.implements] = () => [_foreign_helper.IsolateContext];
@@ -833,54 +832,54 @@ dart_library.library('dart/_isolate_helper', null, /* Imports */[
this[_activeJsAsyncCount] = 0;
}
enqueue(isolate, fn, msg) {
- this.events.addLast(new _IsolateEvent(dart.as(isolate, _IsolateContext), dart.as(fn, core.Function), dart.as(msg, core.String)));
+ dart.dcall(this.events.addLast, new _IsolateEvent(dart.as(isolate, _IsolateContext), dart.as(fn, core.Function), dart.as(msg, core.String)));
}
prequeue(event) {
- this.events.addFirst(event);
+ dart.dcall(this.events.addFirst, event);
}
dequeue() {
if (dart.notNull(this.events.isEmpty))
return null;
- return this.events.removeFirst();
+ return dart.dcall(this.events.removeFirst);
}
checkOpenReceivePortsFromCommandLine() {
- if (exports._globalState.rootContext != null && dart.notNull(exports._globalState.isolates.containsKey(exports._globalState.rootContext.id)) && dart.notNull(exports._globalState.fromCommandLine) && dart.notNull(exports._globalState.rootContext.ports.isEmpty)) {
+ if (exports._globalState.rootContext != null && dart.notNull(dart.dcall(exports._globalState.isolates.containsKey, exports._globalState.rootContext.id)) && dart.notNull(exports._globalState.fromCommandLine) && dart.notNull(exports._globalState.rootContext.ports.isEmpty)) {
dart.throw(core.Exception.new("Program exited with open ReceivePorts."));
}
}
runIteration() {
- let event = this.dequeue();
+ let event = dart.dcall(this.dequeue);
if (event == null) {
- this.checkOpenReceivePortsFromCommandLine();
- exports._globalState.maybeCloseWorker();
+ dart.dcall(this.checkOpenReceivePortsFromCommandLine);
+ dart.dcall(exports._globalState.maybeCloseWorker);
return false;
}
- event.process();
+ dart.dsend(event, 'process');
return true;
}
[_runHelper]() {
if (exports.globalWindow != null) {
let next = (function() {
- if (!dart.notNull(this.runIteration()))
+ if (!dart.notNull(dart.dcall(this.runIteration)))
return;
- async.Timer.run(next);
+ dart.dcall(async.Timer.run, next);
}).bind(this);
dart.fn(next);
- next();
+ dart.dcall(next);
} else {
- while (dart.notNull(this.runIteration())) {
+ while (dart.notNull(dart.dcall(this.runIteration))) {
}
}
}
run() {
if (!dart.notNull(exports._globalState.isWorker)) {
- this[_runHelper]();
+ dart.dcall(this[_runHelper]);
} else {
try {
- this[_runHelper]();
+ dart.dcall(this[_runHelper]);
} catch (e) {
let trace = dart.stackTrace(e);
- exports._globalState.mainManager.postMessage(_serializeMessage(dart.map({command: 'error', msg: `${e}\n${trace}`})));
+ dart.dcall(exports._globalState.mainManager.postMessage, dart.dcall(_serializeMessage, dart.map({command: 'error', msg: `${e}\n${trace}`})));
}
}
@@ -906,10 +905,10 @@ dart_library.library('dart/_isolate_helper', null, /* Imports */[
}
process() {
if (dart.notNull(this.isolate.isPaused)) {
- this.isolate.delayedEvents[dartx.add](this);
+ dart.dcall(this.isolate.delayedEvents[dartx.add], this);
return;
}
- this.isolate.eval(this.fn);
+ dart.dcall(this.isolate.eval, this.fn);
}
}
dart.setSignature(_IsolateEvent, {
@@ -939,7 +938,7 @@ dart_library.library('dart/_isolate_helper', null, /* Imports */[
return exports._global.Worker;
},
get globalPostMessageDefined() {
- return !!exports._global.postMessage;
+ return dart.as(!!exports._global.postMessage, core.bool);
}
});
let _MainFunction = dart.typedef('_MainFunction', () => dart.functionType(dart.dynamic, []));
@@ -949,14 +948,14 @@ dart_library.library('dart/_isolate_helper', null, /* Imports */[
static computeThisScript() {
let currentScript = document.currentScript;
if (currentScript != null) {
- return String(currentScript.src);
+ return dart.as(String(currentScript.src), core.String);
}
if (dart.notNull(_js_helper.Primitives.isD8))
- return IsolateNatives.computeThisScriptD8();
+ return dart.dcall(IsolateNatives.computeThisScriptD8);
if (dart.notNull(_js_helper.Primitives.isJsshell))
- return IsolateNatives.computeThisScriptJsshell();
+ return dart.dcall(IsolateNatives.computeThisScriptJsshell);
if (exports._globalState != null && dart.notNull(exports._globalState.isWorker)) {
- return IsolateNatives.computeThisScriptFromTrace();
+ return dart.dcall(IsolateNatives.computeThisScriptFromTrace);
}
return null;
}
@@ -964,7 +963,7 @@ dart_library.library('dart/_isolate_helper', null, /* Imports */[
return dart.as(thisFilename(), core.String);
}
static computeThisScriptD8() {
- return IsolateNatives.computeThisScriptFromTrace();
+ return dart.dcall(IsolateNatives.computeThisScriptFromTrace);
}
static computeThisScriptFromTrace() {
let stack = new Error().stack;
@@ -984,41 +983,41 @@ dart_library.library('dart/_isolate_helper', null, /* Imports */[
pattern = new RegExp("^ *at [^(]*\\((.*):[0-9]*:[0-9]*\\)$", "m");
matches = stack.match(pattern);
if (matches != null)
- return matches[1];
+ return dart.as(matches[1], core.String);
pattern = new RegExp("^[^@]*@(.*):[0-9]*$", "m");
matches = stack.match(pattern);
if (matches != null)
- return matches[1];
+ return dart.as(matches[1], core.String);
dart.throw(new core.UnsupportedError(`Cannot extract URI from "${stack}"`));
}
static _getEventData(e) {
return e.data;
}
static _processWorkerMessage(sender, e) {
- let msg = _deserializeMessage(IsolateNatives._getEventData(e));
+ let msg = dart.dcall(_deserializeMessage, dart.dcall(IsolateNatives._getEventData, e));
switch (dart.dindex(msg, 'command')) {
case 'start':
{
exports._globalState.currentManagerId = dart.as(dart.dindex(msg, 'id'), core.int);
let functionName = dart.as(dart.dindex(msg, 'functionName'), core.String);
- let entryPoint = functionName == null ? exports._globalState.entry : dart.as(IsolateNatives._getJSFunctionFromName(functionName), core.Function);
+ let entryPoint = functionName == null ? exports._globalState.entry : dart.as(dart.dcall(IsolateNatives._getJSFunctionFromName, functionName), core.Function);
let args = dart.dindex(msg, 'args');
- let message = _deserializeMessage(dart.dindex(msg, 'msg'));
+ let message = dart.dcall(_deserializeMessage, dart.dindex(msg, 'msg'));
let isSpawnUri = dart.dindex(msg, 'isSpawnUri');
let startPaused = dart.dindex(msg, 'startPaused');
- let replyTo = _deserializeMessage(dart.dindex(msg, 'replyTo'));
+ let replyTo = dart.dcall(_deserializeMessage, dart.dindex(msg, 'replyTo'));
let context = new _IsolateContext();
- exports._globalState.topEventLoop.enqueue(context, dart.fn(() => {
- IsolateNatives._startIsolate(entryPoint, dart.as(args, core.List$(core.String)), message, dart.as(isSpawnUri, core.bool), dart.as(startPaused, core.bool), dart.as(replyTo, isolate.SendPort));
+ dart.dcall(exports._globalState.topEventLoop.enqueue, context, dart.fn(() => {
+ dart.dcall(IsolateNatives._startIsolate, entryPoint, args, message, isSpawnUri, startPaused, replyTo);
}), 'worker-start');
- exports._globalState.currentContext = context;
- exports._globalState.topEventLoop.run();
+ exports._globalState.currentContext = dart.as(context, _IsolateContext);
+ dart.dcall(exports._globalState.topEventLoop.run);
break;
}
case 'spawn-worker':
{
if (IsolateNatives.enableSpawnWorker != null)
- IsolateNatives.handleSpawnWorkerRequest(msg);
+ dart.dcall(IsolateNatives.handleSpawnWorkerRequest, msg);
break;
}
case 'message':
@@ -1027,27 +1026,27 @@ dart_library.library('dart/_isolate_helper', null, /* Imports */[
if (port != null) {
dart.dsend(dart.dindex(msg, 'port'), 'send', dart.dindex(msg, 'msg'));
}
- exports._globalState.topEventLoop.run();
+ dart.dcall(exports._globalState.topEventLoop.run);
break;
}
case 'close':
{
- exports._globalState.managers.remove(IsolateNatives.workerIds.get(sender));
+ dart.dcall(exports._globalState.managers.remove, IsolateNatives.workerIds.get(sender));
sender.terminate();
- exports._globalState.topEventLoop.run();
+ dart.dcall(exports._globalState.topEventLoop.run);
break;
}
case 'log':
{
- IsolateNatives._log(dart.dindex(msg, 'msg'));
+ dart.dcall(IsolateNatives._log, dart.dindex(msg, 'msg'));
break;
}
case 'print':
{
if (dart.notNull(exports._globalState.isWorker)) {
- exports._globalState.mainManager.postMessage(_serializeMessage(dart.map({command: 'print', msg: msg})));
+ dart.dcall(exports._globalState.mainManager.postMessage, dart.dcall(_serializeMessage, dart.map({command: 'print', msg: msg})));
} else {
- core.print(dart.dindex(msg, 'msg'));
+ dart.dcall(core.print, dart.dindex(msg, 'msg'));
}
break;
}
@@ -1059,7 +1058,7 @@ dart_library.library('dart/_isolate_helper', null, /* Imports */[
}
static handleSpawnWorkerRequest(msg) {
let replyPort = dart.dindex(msg, 'replyPort');
- IsolateNatives.spawn(dart.as(dart.dindex(msg, 'functionName'), core.String), dart.as(dart.dindex(msg, 'uri'), core.String), dart.as(dart.dindex(msg, 'args'), core.List$(core.String)), dart.dindex(msg, 'msg'), false, dart.as(dart.dindex(msg, 'isSpawnUri'), core.bool), dart.as(dart.dindex(msg, 'startPaused'), core.bool)).then(dart.fn(msg => {
+ dart.dcall(dart.dcall(IsolateNatives.spawn, dart.dindex(msg, 'functionName'), dart.dindex(msg, 'uri'), dart.dindex(msg, 'args'), dart.dindex(msg, 'msg'), false, dart.dindex(msg, 'isSpawnUri'), dart.dindex(msg, 'startPaused')).then, dart.fn(msg => {
dart.dsend(replyPort, 'send', msg);
}), {onError: dart.fn(errorMessage => {
dart.dsend(replyPort, 'send', [_SPAWN_FAILED_SIGNAL, errorMessage]);
@@ -1067,10 +1066,10 @@ dart_library.library('dart/_isolate_helper', null, /* Imports */[
}
static _log(msg) {
if (dart.notNull(exports._globalState.isWorker)) {
- exports._globalState.mainManager.postMessage(_serializeMessage(dart.map({command: 'log', msg: msg})));
+ dart.dcall(exports._globalState.mainManager.postMessage, dart.dcall(_serializeMessage, dart.map({command: 'log', msg: msg})));
} else {
try {
- IsolateNatives._consoleLog(msg);
+ dart.dcall(IsolateNatives._consoleLog, msg);
} catch (e) {
let trace = dart.stackTrace(e);
dart.throw(core.Exception.new(trace));
@@ -1082,7 +1081,7 @@ dart_library.library('dart/_isolate_helper', null, /* Imports */[
self.console.log(msg);
}
static _getJSFunctionFromName(functionName) {
- let globalFunctionsContainer = _foreign_helper.JS_EMBEDDED_GLOBAL("", _js_embedded_names.GLOBAL_FUNCTIONS);
+ let globalFunctionsContainer = dart.dcall(_foreign_helper.JS_EMBEDDED_GLOBAL, "", _js_embedded_names.GLOBAL_FUNCTIONS);
return globalFunctionsContainer[functionName]();
}
static _getJSFunctionName(f) {
@@ -1093,39 +1092,39 @@ dart_library.library('dart/_isolate_helper', null, /* Imports */[
}
static spawnFunction(topLevelFunction, message, startPaused) {
IsolateNatives.enableSpawnWorker = true;
- let name = IsolateNatives._getJSFunctionName(topLevelFunction);
+ let name = dart.dcall(IsolateNatives._getJSFunctionName, topLevelFunction);
if (name == null) {
dart.throw(new core.UnsupportedError("only top-level functions can be spawned."));
}
let isLight = false;
let isSpawnUri = false;
- return IsolateNatives.spawn(name, null, null, message, isLight, isSpawnUri, startPaused);
+ return dart.dcall(IsolateNatives.spawn, name, null, null, message, isLight, isSpawnUri, startPaused);
}
static spawnUri(uri, args, message, startPaused) {
IsolateNatives.enableSpawnWorker = true;
let isLight = false;
let isSpawnUri = true;
- return IsolateNatives.spawn(null, dart.toString(uri), args, message, isLight, isSpawnUri, startPaused);
+ return dart.dcall(IsolateNatives.spawn, null, dart.dcall(uri.toString), args, message, isLight, isSpawnUri, startPaused);
}
static spawn(functionName, uri, args, message, isLight, isSpawnUri, startPaused) {
- if (uri != null && dart.notNull(uri[dartx.endsWith](".dart"))) {
+ if (uri != null && dart.notNull(dart.dcall(uri[dartx.endsWith], ".dart"))) {
uri = dart.notNull(uri) + ".js";
}
let port = isolate.ReceivePort.new();
let completer = async.Completer$(core.List).new();
- port.first.then(dart.fn(msg => {
+ dart.dcall(port.first.then, dart.fn(msg => {
if (dart.equals(dart.dindex(msg, 0), _SPAWNED_SIGNAL)) {
- completer.complete(msg);
+ dart.dcall(completer.complete, msg);
} else {
dart.assert(dart.equals(dart.dindex(msg, 0), _SPAWN_FAILED_SIGNAL));
- completer.completeError(dart.dindex(msg, 1));
+ dart.dcall(completer.completeError, dart.dindex(msg, 1));
}
}));
let signalReply = port.sendPort;
if (dart.notNull(exports._globalState.useWorkers) && !dart.notNull(isLight)) {
- IsolateNatives._startWorker(functionName, uri, args, message, isSpawnUri, startPaused, signalReply, dart.fn(message => completer.completeError(message), dart.void, [core.String]));
+ dart.dcall(IsolateNatives._startWorker, functionName, uri, args, message, isSpawnUri, startPaused, signalReply, dart.fn(message => dart.dcall(completer.completeError, message), dart.void, [core.String]));
} else {
- IsolateNatives._startNonWorker(functionName, uri, args, message, isSpawnUri, startPaused, signalReply);
+ dart.dcall(IsolateNatives._startNonWorker, functionName, uri, args, message, isSpawnUri, startPaused, signalReply);
}
return completer.future;
}
@@ -1133,31 +1132,31 @@ dart_library.library('dart/_isolate_helper', null, /* Imports */[
if (args != null)
args = core.List$(core.String).from(args);
if (dart.notNull(exports._globalState.isWorker)) {
- exports._globalState.mainManager.postMessage(_serializeMessage(dart.map({command: 'spawn-worker', functionName: functionName, args: args, msg: message, uri: uri, isSpawnUri: isSpawnUri, startPaused: startPaused, replyPort: replyPort})));
+ dart.dcall(exports._globalState.mainManager.postMessage, dart.dcall(_serializeMessage, dart.map({command: 'spawn-worker', functionName: functionName, args: args, msg: message, uri: uri, isSpawnUri: isSpawnUri, startPaused: startPaused, replyPort: replyPort})));
} else {
- IsolateNatives._spawnWorker(functionName, uri, args, message, isSpawnUri, startPaused, replyPort, onError);
+ dart.dcall(IsolateNatives._spawnWorker, functionName, uri, args, message, isSpawnUri, startPaused, replyPort, onError);
}
}
static _startNonWorker(functionName, uri, args, message, isSpawnUri, startPaused, replyPort) {
if (uri != null) {
dart.throw(new core.UnsupportedError("Currently spawnUri is not supported without web workers."));
}
- message = _clone(message);
+ message = dart.dcall(_clone, message);
if (args != null)
args = core.List$(core.String).from(args);
- exports._globalState.topEventLoop.enqueue(new _IsolateContext(), dart.fn(() => {
- let func = IsolateNatives._getJSFunctionFromName(functionName);
- IsolateNatives._startIsolate(dart.as(func, core.Function), args, message, isSpawnUri, startPaused, replyPort);
+ dart.dcall(exports._globalState.topEventLoop.enqueue, new _IsolateContext(), dart.fn(() => {
+ let func = dart.dcall(IsolateNatives._getJSFunctionFromName, functionName);
+ dart.dcall(IsolateNatives._startIsolate, func, args, message, isSpawnUri, startPaused, replyPort);
}), 'nonworker start');
}
static get currentIsolate() {
- let context = dart.as(_foreign_helper.JS_CURRENT_ISOLATE_CONTEXT(), _IsolateContext);
+ let context = dart.as(dart.dcall(_foreign_helper.JS_CURRENT_ISOLATE_CONTEXT), _IsolateContext);
return new isolate.Isolate(context.controlPort.sendPort, {pauseCapability: context.pauseCapability, terminateCapability: context.terminateCapability});
}
static _startIsolate(topLevel, args, message, isSpawnUri, startPaused, replyTo) {
- let context = dart.as(_foreign_helper.JS_CURRENT_ISOLATE_CONTEXT(), _IsolateContext);
- _js_helper.Primitives.initializeStatics(context.id);
- replyTo.send([_SPAWNED_SIGNAL, context.controlPort.sendPort, context.pauseCapability, context.terminateCapability]);
+ let context = dart.as(dart.dcall(_foreign_helper.JS_CURRENT_ISOLATE_CONTEXT), _IsolateContext);
+ dart.dcall(_js_helper.Primitives.initializeStatics, context.id);
+ dart.dcall(replyTo.send, [_SPAWNED_SIGNAL, context.controlPort.sendPort, context.pauseCapability, context.terminateCapability]);
function runStartFunction() {
context.initialized = true;
if (!dart.notNull(isSpawnUri)) {
@@ -1172,10 +1171,10 @@ dart_library.library('dart/_isolate_helper', null, /* Imports */[
}
dart.fn(runStartFunction, dart.void, []);
if (dart.notNull(startPaused)) {
- context.addPause(context.pauseCapability, context.pauseCapability);
- exports._globalState.topEventLoop.enqueue(context, runStartFunction, 'start isolate');
+ dart.dcall(context.addPause, context.pauseCapability, context.pauseCapability);
+ dart.dcall(exports._globalState.topEventLoop.enqueue, context, runStartFunction, 'start isolate');
} else {
- runStartFunction();
+ dart.dcall(runStartFunction);
}
}
static _spawnWorker(functionName, uri, args, message, isSpawnUri, startPaused, replyPort, onError) {
@@ -1198,9 +1197,9 @@ dart_library.library('dart/_isolate_helper', null, /* Imports */[
let o = exports._globalState;
let workerId = o.nextManagerId;
o.nextManagerId = dart.notNull(workerId) + 1;
- IsolateNatives.workerIds.set(worker, workerId);
- exports._globalState.managers.set(workerId, worker);
- worker.postMessage(_serializeMessage(dart.map({command: 'start', id: workerId, replyTo: _serializeMessage(replyPort), args: args, msg: _serializeMessage(message), isSpawnUri: isSpawnUri, startPaused: startPaused, functionName: functionName})));
+ IsolateNatives.workerIds.set(worker, dart.as(workerId, core.int));
+ exports._globalState.managers.set(dart.as(workerId, core.int), worker);
+ worker.postMessage(dart.dcall(_serializeMessage, dart.map({command: 'start', id: workerId, replyTo: dart.dcall(_serializeMessage, replyPort), args: args, msg: dart.dcall(_serializeMessage, message), isSpawnUri: isSpawnUri, startPaused: startPaused, functionName: functionName})));
}
static workerOnError(event, uri, onError) {
event.preventDefault();
@@ -1242,7 +1241,7 @@ dart_library.library('dart/_isolate_helper', null, /* Imports */[
IsolateNatives.enableSpawnWorker = null;
dart.defineLazyProperties(IsolateNatives, {
get thisScript() {
- return IsolateNatives.computeThisScript();
+ return dart.dcall(IsolateNatives.computeThisScript);
},
set thisScript(_) {},
get workerIds() {
@@ -1278,14 +1277,14 @@ dart_library.library('dart/_isolate_helper', null, /* Imports */[
return;
if (dart.notNull(this[_receivePort][_isClosed]))
return;
- let msg = _clone(message);
- if (dart.equals(isolate.controlPort, this[_receivePort])) {
- isolate.handleControlMessage(msg);
+ let msg = dart.dcall(_clone, message);
+ if (dart.equals(dart.dload(isolate, 'controlPort'), this[_receivePort])) {
+ dart.dsend(isolate, 'handleControlMessage', msg);
return;
}
- exports._globalState.topEventLoop.enqueue(isolate, dart.fn((() => {
+ dart.dcall(exports._globalState.topEventLoop.enqueue, isolate, dart.fn((() => {
if (!dart.notNull(this[_receivePort][_isClosed])) {
- this[_receivePort][_add](msg);
+ dart.dcall(this[_receivePort][_add], msg);
}
}).bind(this)), `receive ${message}`);
}
@@ -1308,9 +1307,9 @@ dart_library.library('dart/_isolate_helper', null, /* Imports */[
super._BaseSendPort(isolateId);
}
send(message) {
- let workerMessage = _serializeMessage(dart.map({command: 'message', port: this, msg: message}));
+ let workerMessage = dart.dcall(_serializeMessage, dart.map({command: 'message', port: this, msg: message}));
if (dart.notNull(exports._globalState.isWorker)) {
- exports._globalState.mainManager.postMessage(workerMessage);
+ dart.dcall(exports._globalState.mainManager.postMessage, workerMessage);
} else {
let manager = exports._globalState.managers.get(this[_workerId]);
if (manager != null) {
@@ -1340,7 +1339,7 @@ dart_library.library('dart/_isolate_helper', null, /* Imports */[
return x;
})();
this[_isClosed] = false;
- exports._globalState.currentContext.register(this[_id], this);
+ dart.dcall(exports._globalState.currentContext.register, this[_id], this);
}
weak(handler) {
this[_handler] = handler;
@@ -1350,7 +1349,7 @@ dart_library.library('dart/_isolate_helper', null, /* Imports */[
return x;
})();
this[_isClosed] = false;
- exports._globalState.currentContext.registerWeak(this[_id], this);
+ dart.dcall(exports._globalState.currentContext.registerWeak, this[_id], this);
}
_controlPort() {
this[_handler] = null;
@@ -1369,7 +1368,7 @@ dart_library.library('dart/_isolate_helper', null, /* Imports */[
return;
this[_isClosed] = true;
this[_handler] = null;
- exports._globalState.currentContext.unregister(this[_id]);
+ dart.dcall(exports._globalState.currentContext.unregister, this[_id]);
}
[_add](dataEvent) {
if (dart.notNull(this[_isClosed]))
@@ -1416,11 +1415,11 @@ dart_library.library('dart/_isolate_helper', null, /* Imports */[
let onError = opts && 'onError' in opts ? opts.onError : null;
let onDone = opts && 'onDone' in opts ? opts.onDone : null;
let cancelOnError = opts && 'cancelOnError' in opts ? opts.cancelOnError : null;
- return this[_controller].stream.listen(onData, {onError: onError, onDone: onDone, cancelOnError: cancelOnError});
+ return dart.dcall(this[_controller].stream.listen, onData, {onError: onError, onDone: onDone, cancelOnError: cancelOnError});
}
close() {
- this[_rawPort].close();
- this[_controller].close();
+ dart.dcall(this[_rawPort].close);
+ dart.dcall(this[_controller].close);
}
get sendPort() {
return this[_rawPort].sendPort;
@@ -1448,24 +1447,24 @@ dart_library.library('dart/_isolate_helper', null, /* Imports */[
this[_once] = true;
this[_inEventLoop] = false;
this[_handle] = null;
- if (milliseconds == 0 && (!dart.notNull(hasTimer()) || dart.notNull(exports._globalState.isWorker))) {
+ if (milliseconds == 0 && (!dart.notNull(dart.dcall(hasTimer)) || dart.notNull(exports._globalState.isWorker))) {
let internalCallback = (function() {
this[_handle] = null;
callback();
}).bind(this);
dart.fn(internalCallback, dart.void, []);
this[_handle] = 1;
- exports._globalState.topEventLoop.enqueue(exports._globalState.currentContext, internalCallback, 'timer');
+ dart.dcall(exports._globalState.topEventLoop.enqueue, exports._globalState.currentContext, internalCallback, 'timer');
this[_inEventLoop] = true;
- } else if (dart.notNull(hasTimer())) {
+ } else if (dart.notNull(dart.dcall(hasTimer))) {
let internalCallback = (function() {
this[_handle] = null;
- leaveJsAsync();
+ dart.dcall(leaveJsAsync);
callback();
}).bind(this);
dart.fn(internalCallback, dart.void, []);
- enterJsAsync();
- this[_handle] = self.setTimeout(internalCallback, milliseconds);
+ dart.dcall(enterJsAsync);
+ this[_handle] = dart.as(self.setTimeout(internalCallback, milliseconds), core.int);
} else {
dart.assert(dart.notNull(milliseconds) > 0);
dart.throw(new core.UnsupportedError("Timer greater than 0."));
@@ -1475,23 +1474,23 @@ dart_library.library('dart/_isolate_helper', null, /* Imports */[
this[_once] = false;
this[_inEventLoop] = false;
this[_handle] = null;
- if (dart.notNull(hasTimer())) {
- enterJsAsync();
- this[_handle] = self.setInterval(dart.fn((() => {
+ if (dart.notNull(dart.dcall(hasTimer))) {
+ dart.dcall(enterJsAsync);
+ this[_handle] = dart.as(self.setInterval(dart.fn((() => {
callback(this);
- }).bind(this)), milliseconds);
+ }).bind(this)), milliseconds), core.int);
} else {
dart.throw(new core.UnsupportedError("Periodic timer."));
}
}
cancel() {
- if (dart.notNull(hasTimer())) {
+ if (dart.notNull(dart.dcall(hasTimer))) {
if (dart.notNull(this[_inEventLoop])) {
dart.throw(new core.UnsupportedError("Timer in event loop cannot be canceled."));
}
if (this[_handle] == null)
return;
- leaveJsAsync();
+ dart.dcall(leaveJsAsync);
if (dart.notNull(this[_once])) {
self.clearTimeout(this[_handle]);
} else {
@@ -1521,7 +1520,7 @@ dart_library.library('dart/_isolate_helper', null, /* Imports */[
dart.fn(hasTimer, core.bool, []);
class CapabilityImpl extends core.Object {
CapabilityImpl() {
- this._internal(_js_helper.random64());
+ this._internal(dart.dcall(_js_helper.random64));
}
_internal(id) {
this[_id] = id;
@@ -1538,10 +1537,10 @@ dart_library.library('dart/_isolate_helper', null, /* Imports */[
return hash;
}
['=='](other) {
- if (dart.notNull(core.identical(other, this)))
+ if (dart.notNull(dart.dcall(core.identical, other, this)))
return true;
if (dart.is(other, CapabilityImpl)) {
- return core.identical(this[_id], other[_id]);
+ return dart.dcall(core.identical, this[_id], other[_id]);
}
return false;
}

Powered by Google App Engine
This is Rietveld 408576698