Remove dart:_isolate_helper.
The rest of the code was used in a single place, so I've moved the code to the appropriate library. Change-Id: Idd0416bf7365e3de05f20ab1184428ae7ae614b2 Reviewed-on: https://dart-review.googlesource.com/54745 Commit-Queue: Sigmund Cherem <sigmund@google.com> Reviewed-by: Johnni Winther <johnniwinther@google.com>
This commit is contained in:
committed by
commit-bot@chromium.org
parent
b3649427bd
commit
a06f7c9241
@@ -229,10 +229,6 @@ class Uris {
|
||||
static final Uri dart__js_embedded_names =
|
||||
new Uri(scheme: 'dart', path: '_js_embedded_names');
|
||||
|
||||
/// The URI for 'dart:_isolate_helper'.
|
||||
static final Uri dart__isolate_helper =
|
||||
new Uri(scheme: 'dart', path: '_isolate_helper');
|
||||
|
||||
/// The URI for 'package:js'.
|
||||
static final Uri package_js = new Uri(scheme: 'package', path: 'js/js.dart');
|
||||
}
|
||||
|
||||
@@ -137,10 +137,6 @@ class CommonElements {
|
||||
LibraryEntity get foreignLibrary =>
|
||||
_foreignLibrary ??= _env.lookupLibrary(Uris.dart__foreign_helper);
|
||||
|
||||
LibraryEntity _isolateHelperLibrary;
|
||||
LibraryEntity get isolateHelperLibrary =>
|
||||
_isolateHelperLibrary ??= _env.lookupLibrary(Uris.dart__isolate_helper);
|
||||
|
||||
/// Reference to the internal library to lookup functions to always inline.
|
||||
LibraryEntity _internalLibrary;
|
||||
LibraryEntity get internalLibrary => _internalLibrary ??=
|
||||
|
||||
@@ -154,8 +154,7 @@ class BackendUsageBuilderImpl implements BackendUsageBuilder {
|
||||
element.sourcePosition.uri.path
|
||||
.contains('_internal/js_runtime/lib/')) ||
|
||||
element.library == _commonElements.jsHelperLibrary ||
|
||||
element.library == _commonElements.interceptorsLibrary ||
|
||||
element.library == _commonElements.isolateHelperLibrary) {
|
||||
element.library == _commonElements.interceptorsLibrary) {
|
||||
// TODO(johnniwinther): We should be more precise about these.
|
||||
return true;
|
||||
} else {
|
||||
|
||||
@@ -80,7 +80,6 @@ const _requiredLibraries = const <String, List<String>>{
|
||||
'dart:_foreign_helper',
|
||||
'dart:_interceptors',
|
||||
'dart:_internal',
|
||||
'dart:_isolate_helper',
|
||||
'dart:_js_embedded_names',
|
||||
'dart:_js_helper',
|
||||
'dart:_js_names',
|
||||
@@ -103,7 +102,6 @@ const _requiredLibraries = const <String, List<String>>{
|
||||
'dart:_foreign_helper',
|
||||
'dart:_interceptors',
|
||||
'dart:_internal',
|
||||
'dart:_isolate_helper',
|
||||
'dart:_js_embedded_names',
|
||||
'dart:_js_helper',
|
||||
'dart:_js_names',
|
||||
|
||||
@@ -158,7 +158,6 @@ abstract class KernelToElementMapBaseMixin implements KernelToElementMap {
|
||||
type ??= findIn(Uris.dart_core);
|
||||
type ??= findIn(Uris.dart__js_helper);
|
||||
type ??= findIn(Uris.dart__interceptors);
|
||||
type ??= findIn(Uris.dart__isolate_helper);
|
||||
type ??= findIn(Uris.dart__native_typed_data);
|
||||
type ??= findIn(Uris.dart_collection);
|
||||
type ??= findIn(Uris.dart_math);
|
||||
|
||||
@@ -103,8 +103,8 @@ class KernelFrontEndStrategy extends FrontendStrategyBase {
|
||||
|
||||
@override
|
||||
NativeClassFinder createNativeClassFinder(NativeBasicData nativeBasicData) {
|
||||
return new BaseNativeClassFinder(_elementMap.elementEnvironment,
|
||||
elementMap.commonElements, nativeBasicData);
|
||||
return new BaseNativeClassFinder(
|
||||
_elementMap.elementEnvironment, nativeBasicData);
|
||||
}
|
||||
|
||||
NoSuchMethodResolver createNoSuchMethodResolver() {
|
||||
|
||||
@@ -388,22 +388,16 @@ abstract class NativeClassFinder {
|
||||
|
||||
class BaseNativeClassFinder implements NativeClassFinder {
|
||||
final ElementEnvironment _elementEnvironment;
|
||||
final CommonElements _commonElements;
|
||||
final NativeBasicData _nativeBasicData;
|
||||
|
||||
Map<String, ClassEntity> _tagOwner = new Map<String, ClassEntity>();
|
||||
|
||||
BaseNativeClassFinder(
|
||||
this._elementEnvironment, this._commonElements, this._nativeBasicData);
|
||||
BaseNativeClassFinder(this._elementEnvironment, this._nativeBasicData);
|
||||
|
||||
Iterable<ClassEntity> computeNativeClasses(
|
||||
Iterable<LibraryEntity> libraries) {
|
||||
Set<ClassEntity> nativeClasses = new Set<ClassEntity>();
|
||||
libraries.forEach((l) => _processNativeClassesInLibrary(l, nativeClasses));
|
||||
if (_commonElements.isolateHelperLibrary != null) {
|
||||
_processNativeClassesInLibrary(
|
||||
_commonElements.isolateHelperLibrary, nativeClasses);
|
||||
}
|
||||
_processSubclassesOfNativeClasses(libraries, nativeClasses);
|
||||
return nativeClasses;
|
||||
}
|
||||
@@ -512,7 +506,7 @@ class ResolutionNativeClassFinder extends BaseNativeClassFinder {
|
||||
ElementEnvironment elementEnvironment,
|
||||
CommonElements commonElements,
|
||||
NativeBasicData nativeBasicData)
|
||||
: super(elementEnvironment, commonElements, nativeBasicData);
|
||||
: super(elementEnvironment, nativeBasicData);
|
||||
|
||||
void _processNativeClass(
|
||||
ClassElement classElement, Set<ClassEntity> nativeClasses) {
|
||||
|
||||
@@ -14,8 +14,6 @@ import 'dart:_js_helper'
|
||||
wrapException,
|
||||
unwrapException;
|
||||
|
||||
import 'dart:_isolate_helper' show TimerImpl;
|
||||
|
||||
import 'dart:_foreign_helper' show JS, JS_GET_FLAG;
|
||||
|
||||
import 'dart:_async_await_error_codes' as async_error_codes;
|
||||
@@ -111,7 +109,7 @@ class Timer {
|
||||
static Timer _createTimer(Duration duration, void callback()) {
|
||||
int milliseconds = duration.inMilliseconds;
|
||||
if (milliseconds < 0) milliseconds = 0;
|
||||
return new TimerImpl(milliseconds, callback);
|
||||
return new _TimerImpl(milliseconds, callback);
|
||||
}
|
||||
|
||||
@patch
|
||||
@@ -119,10 +117,81 @@ class Timer {
|
||||
Duration duration, void callback(Timer timer)) {
|
||||
int milliseconds = duration.inMilliseconds;
|
||||
if (milliseconds < 0) milliseconds = 0;
|
||||
return new TimerImpl.periodic(milliseconds, callback);
|
||||
return new _TimerImpl.periodic(milliseconds, callback);
|
||||
}
|
||||
}
|
||||
|
||||
class _TimerImpl implements Timer {
|
||||
final bool _once;
|
||||
int _handle;
|
||||
int _tick = 0;
|
||||
|
||||
_TimerImpl(int milliseconds, void callback()) : _once = true {
|
||||
if (_hasTimer()) {
|
||||
void internalCallback() {
|
||||
_handle = null;
|
||||
this._tick = 1;
|
||||
callback();
|
||||
}
|
||||
|
||||
_handle = JS('int', 'self.setTimeout(#, #)',
|
||||
convertDartClosureToJS(internalCallback, 0), milliseconds);
|
||||
} else {
|
||||
throw new UnsupportedError('`setTimeout()` not found.');
|
||||
}
|
||||
}
|
||||
|
||||
_TimerImpl.periodic(int milliseconds, void callback(Timer timer))
|
||||
: _once = false {
|
||||
if (_hasTimer()) {
|
||||
int start = JS('int', 'Date.now()');
|
||||
_handle = JS(
|
||||
'int',
|
||||
'self.setInterval(#, #)',
|
||||
convertDartClosureToJS(() {
|
||||
int tick = this._tick + 1;
|
||||
if (milliseconds > 0) {
|
||||
int duration = JS('int', 'Date.now()') - start;
|
||||
if (duration > (tick + 1) * milliseconds) {
|
||||
tick = duration ~/ milliseconds;
|
||||
}
|
||||
}
|
||||
this._tick = tick;
|
||||
callback(this);
|
||||
}, 0),
|
||||
milliseconds);
|
||||
} else {
|
||||
throw new UnsupportedError('Periodic timer.');
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
bool get isActive => _handle != null;
|
||||
|
||||
@override
|
||||
int get tick => _tick;
|
||||
|
||||
@override
|
||||
void cancel() {
|
||||
if (_hasTimer()) {
|
||||
if (_handle == null) return;
|
||||
if (_once) {
|
||||
JS('void', 'self.clearTimeout(#)', _handle);
|
||||
} else {
|
||||
JS('void', 'self.clearInterval(#)', _handle);
|
||||
}
|
||||
_handle = null;
|
||||
} else {
|
||||
throw new UnsupportedError('Canceling a timer.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool _hasTimer() {
|
||||
requiresPreamble();
|
||||
return JS('', 'self.setTimeout') != null;
|
||||
}
|
||||
|
||||
class _AsyncAwaitCompleter<T> implements Completer<T> {
|
||||
final _completer = new Completer<T>.sync();
|
||||
bool isSync;
|
||||
|
||||
@@ -1,159 +0,0 @@
|
||||
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
|
||||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
library _isolate_helper;
|
||||
|
||||
import 'dart:async';
|
||||
import 'dart:isolate';
|
||||
|
||||
import 'dart:_js_embedded_names' show CURRENT_SCRIPT;
|
||||
|
||||
import 'dart:_js_helper'
|
||||
show convertDartClosureToJS, random64, requiresPreamble;
|
||||
|
||||
import 'dart:_foreign_helper' show JS, JS_EMBEDDED_GLOBAL;
|
||||
|
||||
import 'dart:_interceptors' show JSExtendableArray;
|
||||
|
||||
/// Returns true if we are currently in a worker context.
|
||||
bool isWorker() {
|
||||
requiresPreamble();
|
||||
return JS('', '!self.window && !!self.postMessage');
|
||||
}
|
||||
|
||||
/// The src url for the script tag that loaded this code.
|
||||
String thisScript = computeThisScript();
|
||||
|
||||
/// The src url for the script tag that loaded this function.
|
||||
///
|
||||
/// Used to create JavaScript workers and load deferred libraries.
|
||||
String computeThisScript() {
|
||||
var currentScript = JS_EMBEDDED_GLOBAL('', CURRENT_SCRIPT);
|
||||
if (currentScript != null) {
|
||||
return JS('String', 'String(#.src)', currentScript);
|
||||
}
|
||||
// A worker has no script tag - so get an url from a stack-trace.
|
||||
if (isWorker()) return _computeThisScriptFromTrace();
|
||||
// An isolate that doesn't support workers, but doesn't have a
|
||||
// currentScript either. This is most likely a Chrome extension.
|
||||
return null;
|
||||
}
|
||||
|
||||
String _computeThisScriptFromTrace() {
|
||||
var stack = JS('String|Null', 'new Error().stack');
|
||||
if (stack == null) {
|
||||
// According to Internet Explorer documentation, the stack
|
||||
// property is not set until the exception is thrown. The stack
|
||||
// property was not provided until IE10.
|
||||
stack = JS(
|
||||
'String|Null',
|
||||
'(function() {'
|
||||
'try { throw new Error() } catch(e) { return e.stack }'
|
||||
'})()');
|
||||
if (stack == null) throw new UnsupportedError('No stack trace');
|
||||
}
|
||||
var pattern, matches;
|
||||
|
||||
// This pattern matches V8, Chrome, and Internet Explorer stack
|
||||
// traces that look like this:
|
||||
// Error
|
||||
// at methodName (URI:LINE:COLUMN)
|
||||
pattern = JS('', r'new RegExp("^ *at [^(]*\\((.*):[0-9]*:[0-9]*\\)$", "m")');
|
||||
|
||||
matches = JS('JSExtendableArray|Null', '#.match(#)', stack, pattern);
|
||||
if (matches != null) return JS('String', '#[1]', matches);
|
||||
|
||||
// This pattern matches Firefox stack traces that look like this:
|
||||
// methodName@URI:LINE
|
||||
pattern = JS('', r'new RegExp("^[^@]*@(.*):[0-9]*$", "m")');
|
||||
|
||||
matches = JS('JSExtendableArray|Null', '#.match(#)', stack, pattern);
|
||||
if (matches != null) return JS('String', '#[1]', matches);
|
||||
|
||||
throw new UnsupportedError('Cannot extract URI from "$stack"');
|
||||
}
|
||||
|
||||
class ReceivePortImpl extends Stream implements ReceivePort {
|
||||
ReceivePortImpl();
|
||||
|
||||
StreamSubscription listen(void onData(var event),
|
||||
{Function onError, void onDone(), bool cancelOnError}) {
|
||||
throw new UnsupportedError("ReceivePort.listen");
|
||||
}
|
||||
|
||||
void close() {}
|
||||
|
||||
SendPort get sendPort => throw new UnsupportedError("ReceivePort.sendPort");
|
||||
}
|
||||
|
||||
class TimerImpl implements Timer {
|
||||
final bool _once;
|
||||
int _handle;
|
||||
int _tick = 0;
|
||||
|
||||
TimerImpl(int milliseconds, void callback()) : _once = true {
|
||||
if (_hasTimer()) {
|
||||
void internalCallback() {
|
||||
_handle = null;
|
||||
this._tick = 1;
|
||||
callback();
|
||||
}
|
||||
|
||||
_handle = JS('int', 'self.setTimeout(#, #)',
|
||||
convertDartClosureToJS(internalCallback, 0), milliseconds);
|
||||
} else {
|
||||
throw new UnsupportedError('`setTimeout()` not found.');
|
||||
}
|
||||
}
|
||||
|
||||
TimerImpl.periodic(int milliseconds, void callback(Timer timer))
|
||||
: _once = false {
|
||||
if (_hasTimer()) {
|
||||
int start = JS('int', 'Date.now()');
|
||||
_handle = JS(
|
||||
'int',
|
||||
'self.setInterval(#, #)',
|
||||
convertDartClosureToJS(() {
|
||||
int tick = this._tick + 1;
|
||||
if (milliseconds > 0) {
|
||||
int duration = JS('int', 'Date.now()') - start;
|
||||
if (duration > (tick + 1) * milliseconds) {
|
||||
tick = duration ~/ milliseconds;
|
||||
}
|
||||
}
|
||||
this._tick = tick;
|
||||
callback(this);
|
||||
}, 0),
|
||||
milliseconds);
|
||||
} else {
|
||||
throw new UnsupportedError('Periodic timer.');
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
bool get isActive => _handle != null;
|
||||
|
||||
@override
|
||||
int get tick => _tick;
|
||||
|
||||
@override
|
||||
void cancel() {
|
||||
if (_hasTimer()) {
|
||||
if (_handle == null) return;
|
||||
if (_once) {
|
||||
JS('void', 'self.clearTimeout(#)', _handle);
|
||||
} else {
|
||||
JS('void', 'self.clearInterval(#)', _handle);
|
||||
}
|
||||
_handle = null;
|
||||
} else {
|
||||
throw new UnsupportedError('Canceling a timer.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool _hasTimer() {
|
||||
requiresPreamble();
|
||||
return JS('', 'self.setTimeout') != null;
|
||||
}
|
||||
@@ -7,7 +7,6 @@
|
||||
import "dart:async";
|
||||
import 'dart:_foreign_helper' show JS;
|
||||
import 'dart:_js_helper' show patch;
|
||||
import 'dart:_isolate_helper' show ReceivePortImpl;
|
||||
|
||||
@patch
|
||||
class Isolate {
|
||||
@@ -107,7 +106,7 @@ class Isolate {
|
||||
@patch
|
||||
class ReceivePort {
|
||||
@patch
|
||||
factory ReceivePort() = ReceivePortImpl;
|
||||
factory ReceivePort() = _ReceivePortImpl;
|
||||
|
||||
@patch
|
||||
factory ReceivePort.fromRawReceivePort(RawReceivePort rawPort) {
|
||||
@@ -115,6 +114,17 @@ class ReceivePort {
|
||||
}
|
||||
}
|
||||
|
||||
class _ReceivePortImpl extends Stream implements ReceivePort {
|
||||
StreamSubscription listen(void onData(var event),
|
||||
{Function onError, void onDone(), bool cancelOnError}) {
|
||||
throw new UnsupportedError("ReceivePort.listen");
|
||||
}
|
||||
|
||||
void close() {}
|
||||
|
||||
SendPort get sendPort => throw new UnsupportedError("ReceivePort.sendPort");
|
||||
}
|
||||
|
||||
@patch
|
||||
class RawReceivePort {
|
||||
@patch
|
||||
|
||||
@@ -25,8 +25,6 @@ import 'dart:_js_embedded_names'
|
||||
|
||||
import 'dart:collection';
|
||||
|
||||
import 'dart:_isolate_helper' show thisScript, isWorker;
|
||||
|
||||
import 'dart:async' show Completer, DeferredLoadException, Future;
|
||||
|
||||
import 'dart:_foreign_helper'
|
||||
@@ -3778,6 +3776,64 @@ String _computeCspNonce() {
|
||||
return JS('String', 'String(#.nonce)', currentScript);
|
||||
}
|
||||
|
||||
/// Returns true if we are currently in a worker context.
|
||||
bool _isWorker() {
|
||||
requiresPreamble();
|
||||
return JS('', '!self.window && !!self.postMessage');
|
||||
}
|
||||
|
||||
/// The src url for the script tag that loaded this code.
|
||||
String thisScript = _computeThisScript();
|
||||
|
||||
/// The src url for the script tag that loaded this function.
|
||||
///
|
||||
/// Used to create JavaScript workers and load deferred libraries.
|
||||
String _computeThisScript() {
|
||||
var currentScript = JS_EMBEDDED_GLOBAL('', CURRENT_SCRIPT);
|
||||
if (currentScript != null) {
|
||||
return JS('String', 'String(#.src)', currentScript);
|
||||
}
|
||||
// A worker has no script tag - so get an url from a stack-trace.
|
||||
if (_isWorker()) return _computeThisScriptFromTrace();
|
||||
// An isolate that doesn't support workers, but doesn't have a
|
||||
// currentScript either. This is most likely a Chrome extension.
|
||||
return null;
|
||||
}
|
||||
|
||||
String _computeThisScriptFromTrace() {
|
||||
var stack = JS('String|Null', 'new Error().stack');
|
||||
if (stack == null) {
|
||||
// According to Internet Explorer documentation, the stack
|
||||
// property is not set until the exception is thrown. The stack
|
||||
// property was not provided until IE10.
|
||||
stack = JS(
|
||||
'String|Null',
|
||||
'(function() {'
|
||||
'try { throw new Error() } catch(e) { return e.stack }'
|
||||
'})()');
|
||||
if (stack == null) throw new UnsupportedError('No stack trace');
|
||||
}
|
||||
var pattern, matches;
|
||||
|
||||
// This pattern matches V8, Chrome, and Internet Explorer stack
|
||||
// traces that look like this:
|
||||
// Error
|
||||
// at methodName (URI:LINE:COLUMN)
|
||||
pattern = JS('', r'new RegExp("^ *at [^(]*\\((.*):[0-9]*:[0-9]*\\)$", "m")');
|
||||
|
||||
matches = JS('JSExtendableArray|Null', '#.match(#)', stack, pattern);
|
||||
if (matches != null) return JS('String', '#[1]', matches);
|
||||
|
||||
// This pattern matches Firefox stack traces that look like this:
|
||||
// methodName@URI:LINE
|
||||
pattern = JS('', r'new RegExp("^[^@]*@(.*):[0-9]*$", "m")');
|
||||
|
||||
matches = JS('JSExtendableArray|Null', '#.match(#)', stack, pattern);
|
||||
if (matches != null) return JS('String', '#[1]', matches);
|
||||
|
||||
throw new UnsupportedError('Cannot extract URI from "$stack"');
|
||||
}
|
||||
|
||||
Future<Null> _loadHunk(String hunkName) {
|
||||
Future<Null> future = _loadingLibraries[hunkName];
|
||||
_eventLog.add(' - _loadHunk: $hunkName');
|
||||
@@ -3823,7 +3879,7 @@ Future<Null> _loadHunk(String hunkName) {
|
||||
} catch (error, stackTrace) {
|
||||
failure(error, "invoking dartDeferredLibraryLoader hook", stackTrace);
|
||||
}
|
||||
} else if (isWorker()) {
|
||||
} else if (_isWorker()) {
|
||||
// We are in a web worker. Load the code with an XMLHttpRequest.
|
||||
int index = uri.lastIndexOf('/');
|
||||
uri = '${uri.substring(0, index + 1)}$hunkName';
|
||||
|
||||
@@ -157,11 +157,6 @@ const Map<String, LibraryInfo> libraries = const {
|
||||
categories: "",
|
||||
documented: false,
|
||||
platforms: DART2JS_PLATFORM),
|
||||
"_isolate_helper": const LibraryInfo(
|
||||
"_internal/js_runtime/lib/isolate_helper.dart",
|
||||
categories: "",
|
||||
documented: false,
|
||||
platforms: DART2JS_PLATFORM),
|
||||
"_js_names": const LibraryInfo("_internal/js_runtime/lib/js_names.dart",
|
||||
categories: "", documented: false, platforms: DART2JS_PLATFORM),
|
||||
"_js_primitives": const LibraryInfo(
|
||||
|
||||
@@ -47,7 +47,6 @@ _internal: internal/internal.dart
|
||||
_js_helper: _internal/js_runtime/lib/js_helper.dart
|
||||
_interceptors: _internal/js_runtime/lib/interceptors.dart
|
||||
_foreign_helper: _internal/js_runtime/lib/foreign_helper.dart
|
||||
_isolate_helper: _internal/js_runtime/lib/isolate_helper.dart
|
||||
_js_names: _internal/js_runtime/lib/js_names.dart
|
||||
_js_primitives: _internal/js_runtime/lib/js_primitives.dart
|
||||
_js_embedded_names: _internal/js_runtime/lib/shared/embedded_names.dart
|
||||
|
||||
@@ -44,7 +44,6 @@ _internal: internal/internal.dart
|
||||
_js_helper: _internal/js_runtime/lib/js_helper.dart
|
||||
_interceptors: _internal/js_runtime/lib/interceptors.dart
|
||||
_foreign_helper: _internal/js_runtime/lib/foreign_helper.dart
|
||||
_isolate_helper: _internal/js_runtime/lib/isolate_helper.dart
|
||||
_js_names: _internal/js_runtime/lib/js_names.dart
|
||||
_js_primitives: _internal/js_runtime/lib/js_primitives.dart
|
||||
_js_embedded_names: _internal/js_runtime/lib/shared/embedded_names.dart
|
||||
|
||||
@@ -41,7 +41,6 @@ _internal: internal/internal.dart
|
||||
_js_helper: _internal/js_runtime/lib/js_helper.dart
|
||||
_interceptors: _internal/js_runtime/lib/interceptors.dart
|
||||
_foreign_helper: _internal/js_runtime/lib/foreign_helper.dart
|
||||
_isolate_helper: _internal/js_runtime/lib/isolate_helper.dart
|
||||
_js_names: _internal/js_runtime/lib/js_names.dart
|
||||
_js_primitives: _internal/js_runtime/lib/js_primitives.dart
|
||||
_js_embedded_names: _internal/js_runtime/lib/shared/embedded_names.dart
|
||||
|
||||
@@ -245,9 +245,6 @@
|
||||
"patches": "_internal/js_runtime/lib/convert_patch.dart",
|
||||
"uri": "convert/convert.dart"
|
||||
},
|
||||
"_isolate_helper": {
|
||||
"uri": "_internal/js_runtime/lib/isolate_helper.dart"
|
||||
},
|
||||
"math": {
|
||||
"patches": "_internal/js_runtime/lib/math_patch.dart",
|
||||
"uri": "math/math.dart"
|
||||
@@ -342,9 +339,6 @@
|
||||
"patches": "_internal/js_runtime/lib/convert_patch.dart",
|
||||
"uri": "convert/convert.dart"
|
||||
},
|
||||
"_isolate_helper": {
|
||||
"uri": "_internal/js_runtime/lib/isolate_helper.dart"
|
||||
},
|
||||
"math": {
|
||||
"patches": "_internal/js_runtime/lib/math_patch.dart",
|
||||
"uri": "math/math.dart"
|
||||
|
||||
@@ -242,9 +242,6 @@ dart2js:
|
||||
_foreign_helper:
|
||||
uri: "_internal/js_runtime/lib/foreign_helper.dart"
|
||||
|
||||
_isolate_helper:
|
||||
uri: "_internal/js_runtime/lib/isolate_helper.dart"
|
||||
|
||||
_js_names:
|
||||
uri: "_internal/js_runtime/lib/js_names.dart"
|
||||
|
||||
@@ -334,9 +331,6 @@ dart2js_server:
|
||||
_foreign_helper:
|
||||
uri: "_internal/js_runtime/lib/foreign_helper.dart"
|
||||
|
||||
_isolate_helper:
|
||||
uri: "_internal/js_runtime/lib/isolate_helper.dart"
|
||||
|
||||
_js_names:
|
||||
uri: "_internal/js_runtime/lib/js_names.dart"
|
||||
|
||||
|
||||
@@ -27,8 +27,6 @@ String libProvider(Uri uri) {
|
||||
return buildLibrarySource(DEFAULT_INTERCEPTORS_LIBRARY);
|
||||
} else if (uri.path.endsWith('js_helper.dart')) {
|
||||
return buildLibrarySource(DEFAULT_JS_HELPER_LIBRARY);
|
||||
} else if (uri.path.endsWith('isolate_helper.dart')) {
|
||||
return buildLibrarySource(DEFAULT_ISOLATE_HELPER_LIBRARY);
|
||||
} else if (uri.path.endsWith('/async.dart')) {
|
||||
return buildLibrarySource(DEFAULT_ASYNC_LIBRARY);
|
||||
} else {
|
||||
|
||||
@@ -13,7 +13,6 @@ async:async/async.dart
|
||||
_js_helper:_internal/js_runtime/lib/js_helper.dart
|
||||
_interceptors:_internal/js_runtime/lib/interceptors.dart
|
||||
_internal:internal/internal.dart
|
||||
_isolate_helper:_internal/js_runtime/lib/isolate_helper.dart
|
||||
""";
|
||||
|
||||
String buildLibrarySource(Map<String, String> elementMap,
|
||||
@@ -130,7 +129,6 @@ class Symbol implements core.Symbol {
|
||||
const String DEFAULT_PATCH_CORE_SOURCE = r'''
|
||||
import 'dart:_js_helper';
|
||||
import 'dart:_interceptors';
|
||||
import 'dart:_isolate_helper';
|
||||
import 'dart:async';
|
||||
|
||||
@patch
|
||||
@@ -436,14 +434,6 @@ const Map<String, String> DEFAULT_INTERCEPTORS_LIBRARY = const <String, String>{
|
||||
'JavaScriptFunction': 'class JavaScriptFunction {}',
|
||||
};
|
||||
|
||||
const Map<String, String> DEFAULT_ISOLATE_HELPER_LIBRARY =
|
||||
const <String, String>{
|
||||
'startRootIsolate': 'void startRootIsolate(entry, args) {}',
|
||||
'_currentIsolate': 'var _currentIsolate;',
|
||||
'_callInIsolate': 'var _callInIsolate;',
|
||||
'_WorkerBase': 'class _WorkerBase {}',
|
||||
};
|
||||
|
||||
const Map<String, String> DEFAULT_ASYNC_LIBRARY = const <String, String>{
|
||||
'DeferredLibrary': 'class DeferredLibrary {}',
|
||||
'Future': '''
|
||||
|
||||
@@ -2,17 +2,15 @@
|
||||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
// Test of IsolateNatives.computeThisScript().
|
||||
// Test of _computeThisScript().
|
||||
|
||||
import 'dart:_isolate_helper';
|
||||
import 'dart:_js_helper' show thisScript;
|
||||
|
||||
main() {
|
||||
String script = computeThisScript();
|
||||
|
||||
// This is somewhat brittle and relies on an implementation detail
|
||||
// of our test runner, but I can think of no other way to test this.
|
||||
// -- ahe
|
||||
if (!script.endsWith('/out.js')) {
|
||||
throw 'Unexpected script: "$script"';
|
||||
if (!thisScript.endsWith('/out.js')) {
|
||||
throw 'Unexpected script: "$thiscript"';
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user