Make the dart:developer library available in DDC so debugger statement works

BUG=
R=vsm@google.com

Review URL: https://codereview.chromium.org/2534263002 .
This commit is contained in:
Alan Knight 2016-11-29 16:13:45 -08:00
parent d406779dd8
commit 667fc8dbe9
13 changed files with 4068 additions and 57 deletions

View file

@ -17,6 +17,7 @@ define([], function() {
const collection = Object.create(null);
const convert = Object.create(null);
const core = Object.create(null);
const developer = Object.create(null);
const isolate = Object.create(null);
const js = Object.create(null);
const js_util = Object.create(null);
@ -376,6 +377,12 @@ define([], function() {
let MapOfString$String = () => (MapOfString$String = dart.constFn(core.Map$(core.String, core.String)))();
let IterableOfString = () => (IterableOfString = dart.constFn(core.Iterable$(core.String)))();
let MapOfString$dynamic = () => (MapOfString$dynamic = dart.constFn(core.Map$(core.String, dart.dynamic)))();
let MapOfString$ServiceExtensionHandler = () => (MapOfString$ServiceExtensionHandler = dart.constFn(core.Map$(core.String, developer.ServiceExtensionHandler)))();
let MapOfString$Metric = () => (MapOfString$Metric = dart.constFn(core.Map$(core.String, developer.Metric)))();
let ListOf_SyncBlock = () => (ListOf_SyncBlock = dart.constFn(core.List$(developer._SyncBlock)))();
let JSArrayOf_AsyncBlock = () => (JSArrayOf_AsyncBlock = dart.constFn(_interceptors.JSArray$(developer._AsyncBlock)))();
let ListOf_AsyncBlock = () => (ListOf_AsyncBlock = dart.constFn(core.List$(developer._AsyncBlock)))();
let CompleterOfUri = () => (CompleterOfUri = dart.constFn(async.Completer$(core.Uri)))();
let FutureOfIsolate = () => (FutureOfIsolate = dart.constFn(async.Future$(isolate.Isolate)))();
let JsArray = () => (JsArray = dart.constFn(js.JsArray$()))();
let ExpandoOfFunction = () => (ExpandoOfFunction = dart.constFn(core.Expando$(core.Function)))();
@ -683,6 +690,20 @@ define([], function() {
let MapOfString$StringAndStringToMapOfString$String = () => (MapOfString$StringAndStringToMapOfString$String = dart.constFn(dart.definiteFunctionType(MapOfString$String(), [MapOfString$String(), core.String])))();
let intAndintAndintTovoid = () => (intAndintAndintTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.int, core.int, core.int])))();
let String__Tovoid = () => (String__Tovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.String], [dart.dynamic])))();
let __Tobool = () => (__Tobool = dart.constFn(dart.definiteFunctionType(core.bool, [], {when: core.bool, message: core.String})))();
let String__Tovoid$ = () => (String__Tovoid$ = dart.constFn(dart.definiteFunctionType(dart.void, [core.String], {time: core.DateTime, sequenceNumber: core.int, level: core.int, name: core.String, zone: async.Zone, error: core.Object, stackTrace: core.StackTrace})))();
let StringAndServiceExtensionHandlerTovoid = () => (StringAndServiceExtensionHandlerTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.String, developer.ServiceExtensionHandler])))();
let StringAndMapTovoid = () => (StringAndMapTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.String, core.Map])))();
let StringToServiceExtensionHandler = () => (StringToServiceExtensionHandler = dart.constFn(dart.definiteFunctionType(developer.ServiceExtensionHandler, [core.String])))();
let StringAndServiceExtensionHandlerTodynamic = () => (StringAndServiceExtensionHandlerTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [core.String, developer.ServiceExtensionHandler])))();
let VoidToUserTag = () => (VoidToUserTag = dart.constFn(dart.definiteFunctionType(developer.UserTag, [])))();
let MapToString = () => (MapToString = dart.constFn(dart.definiteFunctionType(core.String, [core.Map])))();
let intAndintAndString__Tovoid = () => (intAndintAndString__Tovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.int, core.int, core.String, core.String, core.String, core.String])))();
let intAndintAndString__Tovoid$ = () => (intAndintAndString__Tovoid$ = dart.constFn(dart.definiteFunctionType(dart.void, [core.int, core.int, core.String, core.String, core.String])))();
let intAndStringAndString__Tovoid = () => (intAndStringAndString__Tovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.int, core.String, core.String, core.String])))();
let UriTovoid = () => (UriTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.Uri])))();
let SendPortTovoid = () => (SendPortTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [isolate.SendPort])))();
let SendPortAndboolTovoid = () => (SendPortAndboolTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [isolate.SendPort, core.bool])))();
let ListToIsolate = () => (ListToIsolate = dart.constFn(dart.definiteFunctionType(isolate.Isolate, [core.List])))();
let dynamicTo_DartObject = () => (dynamicTo_DartObject = dart.constFn(dart.definiteFunctionType(js._DartObject, [dart.dynamic])))();
let dynamicToJsObject = () => (dynamicToJsObject = dart.constFn(dart.definiteFunctionType(js.JsObject, [dart.dynamic])))();
@ -36446,6 +36467,741 @@ define([], function() {
core.UriData._noScheme = -1;
core.UriData._tokenCharTable = dart.constList([0, 0, 27858, 1023, 65534, 51199, 65535, 32767], core.int);
core.UriData._uricTable = core.Uri._queryCharTable;
developer.debugger = function(opts) {
let when = opts && 'when' in opts ? opts.when : true;
let message = opts && 'message' in opts ? opts.message : null;
if (dart.test(when)) {
debugger;
}
return when;
};
dart.fn(developer.debugger, __Tobool());
developer.inspect = function(object) {
return object;
};
dart.fn(developer.inspect, ObjectToObject());
developer.log = function(message, opts) {
let time = opts && 'time' in opts ? opts.time : null;
let sequenceNumber = opts && 'sequenceNumber' in opts ? opts.sequenceNumber : null;
let level = opts && 'level' in opts ? opts.level : 0;
let name = opts && 'name' in opts ? opts.name : '';
let zone = opts && 'zone' in opts ? opts.zone : null;
let error = opts && 'error' in opts ? opts.error : null;
let stackTrace = opts && 'stackTrace' in opts ? opts.stackTrace : null;
};
dart.fn(developer.log, String__Tovoid$());
dart.defineLazy(developer, {
get _extensions() {
return MapOfString$ServiceExtensionHandler().new();
}
});
developer._clockValue = 0;
const _result = Symbol('_result');
const _errorCode = Symbol('_errorCode');
const _errorDetail = Symbol('_errorDetail');
const _isError = Symbol('_isError');
const _toString = Symbol('_toString');
developer.ServiceExtensionResponse = class ServiceExtensionResponse extends core.Object {
result(result) {
this[_result] = result;
this[_errorCode] = null;
this[_errorDetail] = null;
if (!(typeof this[_result] == 'string')) {
dart.throw(new core.ArgumentError.value(this[_result], "result", "Must be a String"));
}
}
error(errorCode, errorDetail) {
this[_result] = null;
this[_errorCode] = errorCode;
this[_errorDetail] = errorDetail;
developer.ServiceExtensionResponse._validateErrorCode(this[_errorCode]);
if (!(typeof this[_errorDetail] == 'string')) {
dart.throw(new core.ArgumentError.value(this[_errorDetail], "errorDetail", "Must be a String"));
}
}
static _errorCodeMessage(errorCode) {
developer.ServiceExtensionResponse._validateErrorCode(errorCode);
if (errorCode == developer.ServiceExtensionResponse.kInvalidParams) {
return "Invalid params";
}
return "Server error";
}
static _validateErrorCode(errorCode) {
if (!(typeof errorCode == 'number')) {
dart.throw(new core.ArgumentError.value(errorCode, "errorCode", "Must be an int"));
}
if (errorCode == developer.ServiceExtensionResponse.invalidParams) {
return;
}
if (dart.notNull(errorCode) >= developer.ServiceExtensionResponse.extensionErrorMin && dart.notNull(errorCode) <= developer.ServiceExtensionResponse.extensionErrorMax) {
return;
}
dart.throw(new core.ArgumentError.value(errorCode, "errorCode", "Out of range"));
}
[_isError]() {
return this[_errorCode] != null && this[_errorDetail] != null;
}
[_toString]() {
if (this[_result] != null) {
return this[_result];
} else {
dart.assert(this[_errorCode] != null);
dart.assert(this[_errorDetail] != null);
return convert.JSON.encode(dart.map({code: this[_errorCode], message: developer.ServiceExtensionResponse._errorCodeMessage(this[_errorCode]), data: dart.map({details: this[_errorDetail]}, core.String, core.String)}, core.String, core.Object));
}
}
};
dart.defineNamedConstructor(developer.ServiceExtensionResponse, 'result');
dart.defineNamedConstructor(developer.ServiceExtensionResponse, 'error');
dart.setSignature(developer.ServiceExtensionResponse, {
constructors: () => ({
result: dart.definiteFunctionType(developer.ServiceExtensionResponse, [core.String]),
error: dart.definiteFunctionType(developer.ServiceExtensionResponse, [core.int, core.String])
}),
fields: () => ({
[_result]: core.String,
[_errorCode]: core.int,
[_errorDetail]: core.String
}),
methods: () => ({
[_isError]: dart.definiteFunctionType(core.bool, []),
[_toString]: dart.definiteFunctionType(core.String, [])
}),
sfields: () => ({
kInvalidParams: core.int,
kExtensionError: core.int,
kExtensionErrorMax: core.int,
kExtensionErrorMin: core.int,
invalidParams: core.int,
extensionError: core.int,
extensionErrorMax: core.int,
extensionErrorMin: core.int
}),
statics: () => ({
_errorCodeMessage: dart.definiteFunctionType(core.String, [core.int]),
_validateErrorCode: dart.definiteFunctionType(dart.dynamic, [core.int])
}),
names: ['_errorCodeMessage', '_validateErrorCode']
});
developer.ServiceExtensionResponse.invalidParams = -32602;
developer.ServiceExtensionResponse.extensionError = -32000;
developer.ServiceExtensionResponse.extensionErrorMax = -32000;
developer.ServiceExtensionResponse.extensionErrorMin = -32016;
dart.defineLazy(developer.ServiceExtensionResponse, {
get kInvalidParams() {
return developer.ServiceExtensionResponse.invalidParams;
},
get kExtensionError() {
return developer.ServiceExtensionResponse.extensionError;
},
get kExtensionErrorMax() {
return developer.ServiceExtensionResponse.extensionErrorMax;
},
get kExtensionErrorMin() {
return developer.ServiceExtensionResponse.extensionErrorMin;
}
});
developer.ServiceExtensionHandler = dart.typedef('ServiceExtensionHandler', () => dart.functionType(async.Future$(developer.ServiceExtensionResponse), [core.String, MapOfString$String()]));
developer.registerExtension = function(method, handler) {
if (!(typeof method == 'string')) {
dart.throw(new core.ArgumentError.value(method, 'method', 'Must be a String'));
}
if (!dart.test(method[dartx.startsWith]('ext.'))) {
dart.throw(new core.ArgumentError.value(method, 'method', 'Must begin with ext.'));
}
if (developer._lookupExtension(method) != null) {
dart.throw(new core.ArgumentError(dart.str`Extension already registered: ${method}`));
}
if (!developer.ServiceExtensionHandler.is(handler)) {
dart.throw(new core.ArgumentError.value(handler, 'handler', 'Must be a ServiceExtensionHandler'));
}
developer._registerExtension(method, handler);
};
dart.fn(developer.registerExtension, StringAndServiceExtensionHandlerTovoid());
developer.postEvent = function(eventKind, eventData) {
if (!(typeof eventKind == 'string')) {
dart.throw(new core.ArgumentError.value(eventKind, 'eventKind', 'Must be a String'));
}
if (!core.Map.is(eventData)) {
dart.throw(new core.ArgumentError.value(eventData, 'eventData', 'Must be a Map'));
}
let eventDataAsString = convert.JSON.encode(eventData);
developer._postEvent(eventKind, eventDataAsString);
};
dart.fn(developer.postEvent, StringAndMapTovoid());
developer._postEvent = function(eventKind, eventData) {
};
dart.fn(developer._postEvent, StringAndStringTodynamic());
developer._lookupExtension = function(method) {
return developer._extensions[dartx._get](method);
};
dart.fn(developer._lookupExtension, StringToServiceExtensionHandler());
developer._registerExtension = function(method, handler) {
developer._extensions[dartx._set](method, handler);
};
dart.fn(developer._registerExtension, StringAndServiceExtensionHandlerTodynamic());
developer.UserTag = class UserTag extends core.Object {
static new(label) {
return developer._FakeUserTag.new(label);
}
static get defaultTag() {
return developer._FakeUserTag._defaultTag;
}
};
dart.setSignature(developer.UserTag, {
constructors: () => ({new: dart.definiteFunctionType(developer.UserTag, [core.String])}),
sfields: () => ({MAX_USER_TAGS: core.int}),
sgetters: () => ({defaultTag: dart.definiteFunctionType(developer.UserTag, [])})
});
developer.UserTag.MAX_USER_TAGS = 64;
developer._FakeUserTag = class _FakeUserTag extends core.Object {
real(label) {
this.label = label;
}
static new(label) {
let existingTag = developer._FakeUserTag._instances[dartx._get](label);
if (existingTag != null) {
return developer._FakeUserTag._check(existingTag);
}
if (developer._FakeUserTag._instances[dartx.length] == developer.UserTag.MAX_USER_TAGS) {
dart.throw(new core.UnsupportedError(dart.str`UserTag instance limit (${developer.UserTag.MAX_USER_TAGS}) reached.`));
}
let instance = new developer._FakeUserTag.real(label);
developer._FakeUserTag._instances[dartx._set](label, instance);
return instance;
}
makeCurrent() {
let old = developer._currentTag;
developer._currentTag = this;
return old;
}
};
dart.defineNamedConstructor(developer._FakeUserTag, 'real');
developer._FakeUserTag[dart.implements] = () => [developer.UserTag];
dart.setSignature(developer._FakeUserTag, {
constructors: () => ({
real: dart.definiteFunctionType(developer._FakeUserTag, [core.String]),
new: dart.definiteFunctionType(developer._FakeUserTag, [core.String])
}),
fields: () => ({label: core.String}),
methods: () => ({makeCurrent: dart.definiteFunctionType(developer.UserTag, [])}),
sfields: () => ({
_instances: core.Map,
_defaultTag: developer.UserTag
})
});
dart.defineLazy(developer._FakeUserTag, {
get _instances() {
return dart.map();
},
set _instances(_) {},
get _defaultTag() {
return developer._FakeUserTag.new('Default');
}
});
dart.defineLazy(developer, {
get _currentTag() {
return developer._FakeUserTag._defaultTag;
},
set _currentTag(_) {}
});
developer.getCurrentTag = function() {
return developer._currentTag;
};
dart.fn(developer.getCurrentTag, VoidToUserTag());
developer.Metric = class Metric extends core.Object {
new(name, description) {
this.name = name;
this.description = description;
if (this.name == 'vm' || dart.test(this.name[dartx.contains]('/'))) {
dart.throw(new core.ArgumentError('Invalid Metric name.'));
}
}
};
dart.setSignature(developer.Metric, {
constructors: () => ({new: dart.definiteFunctionType(developer.Metric, [core.String, core.String])}),
fields: () => ({
name: core.String,
description: core.String
})
});
const _value$0 = Symbol('_value');
const _toJSON = Symbol('_toJSON');
developer.Gauge = class Gauge extends developer.Metric {
get value() {
return this[_value$0];
}
set value(v) {
if (dart.notNull(v) < dart.notNull(this.min)) {
v = this.min;
} else if (dart.notNull(v) > dart.notNull(this.max)) {
v = this.max;
}
this[_value$0] = v;
}
new(name, description, min, max) {
this.min = min;
this.max = max;
this[_value$0] = null;
super.new(name, description);
if (!(typeof this.min == 'number')) {
dart.throw(new core.ArgumentError('min must be a double'));
}
if (!(typeof this.max == 'number')) {
dart.throw(new core.ArgumentError('max must be a double'));
}
if (!(dart.notNull(this.min) < dart.notNull(this.max))) {
dart.throw(new core.ArgumentError('min must be less than max'));
}
this[_value$0] = this.min;
}
[_toJSON]() {
let map = dart.map({type: 'Gauge', id: dart.str`metrics/${this.name}`, name: this.name, description: this.description, value: this.value, min: this.min, max: this.max}, core.String, core.Object);
return map;
}
};
dart.setSignature(developer.Gauge, {
constructors: () => ({new: dart.definiteFunctionType(developer.Gauge, [core.String, core.String, core.double, core.double])}),
fields: () => ({
min: core.double,
max: core.double,
[_value$0]: core.double
}),
getters: () => ({value: dart.definiteFunctionType(core.double, [])}),
setters: () => ({value: dart.definiteFunctionType(dart.void, [core.double])}),
methods: () => ({[_toJSON]: dart.definiteFunctionType(core.Map, [])})
});
developer.Counter = class Counter extends developer.Metric {
new(name, description) {
this[_value$0] = 0.0;
super.new(name, description);
}
get value() {
return this[_value$0];
}
set value(v) {
this[_value$0] = v;
}
[_toJSON]() {
let map = dart.map({type: 'Counter', id: dart.str`metrics/${this.name}`, name: this.name, description: this.description, value: this.value}, core.String, core.Object);
return map;
}
};
dart.setSignature(developer.Counter, {
constructors: () => ({new: dart.definiteFunctionType(developer.Counter, [core.String, core.String])}),
fields: () => ({[_value$0]: core.double}),
getters: () => ({value: dart.definiteFunctionType(core.double, [])}),
setters: () => ({value: dart.definiteFunctionType(dart.void, [core.double])}),
methods: () => ({[_toJSON]: dart.definiteFunctionType(core.Map, [])})
});
developer.Metrics = class Metrics extends core.Object {
static register(metric) {
if (!developer.Metric.is(metric)) {
dart.throw(new core.ArgumentError('metric must be a Metric'));
}
if (developer.Metrics._metrics[dartx._get](metric.name) != null) {
dart.throw(new core.ArgumentError('Registered metrics have unique names'));
}
developer.Metrics._metrics[dartx._set](metric.name, metric);
}
static deregister(metric) {
if (!developer.Metric.is(metric)) {
dart.throw(new core.ArgumentError('metric must be a Metric'));
}
developer.Metrics._metrics[dartx.remove](metric.name);
}
static _printMetric(id) {
let metric = developer.Metrics._metrics[dartx._get](id);
if (metric == null) {
return null;
}
return convert.JSON.encode(metric[_toJSON]());
}
static _printMetrics() {
let metrics = [];
for (let metric of developer.Metrics._metrics[dartx.values]) {
metrics[dartx.add](metric[_toJSON]());
}
let map = dart.map({type: 'MetricList', metrics: metrics}, core.String, core.Object);
return convert.JSON.encode(map);
}
};
dart.setSignature(developer.Metrics, {
sfields: () => ({_metrics: MapOfString$Metric()}),
statics: () => ({
register: dart.definiteFunctionType(dart.void, [developer.Metric]),
deregister: dart.definiteFunctionType(dart.void, [developer.Metric]),
_printMetric: dart.definiteFunctionType(core.String, [core.String]),
_printMetrics: dart.definiteFunctionType(core.String, [])
}),
names: ['register', 'deregister', '_printMetric', '_printMetrics']
});
dart.defineLazy(developer.Metrics, {
get _metrics() {
return MapOfString$Metric().new();
}
});
developer._isProduct = false;
developer.TimelineSyncFunction = dart.typedef('TimelineSyncFunction', () => dart.functionType(dart.dynamic, []));
developer.TimelineAsyncFunction = dart.typedef('TimelineAsyncFunction', () => dart.functionType(async.Future, []));
const _appendArguments = Symbol('_appendArguments');
developer.Timeline = class Timeline extends core.Object {
static startSync(name, opts) {
let arguments$ = opts && 'arguments' in opts ? opts.arguments : null;
if (developer._isProduct) {
return;
}
if (!(typeof name == 'string')) {
dart.throw(new core.ArgumentError.value(name, 'name', 'Must be a String'));
}
if (!dart.test(developer._isDartStreamEnabled())) {
developer.Timeline._stack[dartx.add](null);
return;
}
let block = new developer._SyncBlock._(name, developer._getTraceClock(), developer._getThreadCpuClock());
if (core.Map.is(arguments$)) {
block[_appendArguments](arguments$);
}
developer.Timeline._stack[dartx.add](block);
}
static finishSync() {
if (developer._isProduct) {
return;
}
if (developer.Timeline._stack[dartx.length] == 0) {
dart.throw(new core.StateError('Uneven calls to startSync and finishSync'));
}
let block = developer.Timeline._stack[dartx.removeLast]();
if (block == null) {
return;
}
block.finish();
}
static instantSync(name, opts) {
let arguments$ = opts && 'arguments' in opts ? opts.arguments : null;
if (developer._isProduct) {
return;
}
if (!(typeof name == 'string')) {
dart.throw(new core.ArgumentError.value(name, 'name', 'Must be a String'));
}
if (!dart.test(developer._isDartStreamEnabled())) {
return;
}
let instantArguments = null;
if (core.Map.is(arguments$)) {
instantArguments = core.Map.from(arguments$);
}
developer._reportInstantEvent(developer._getTraceClock(), 'Dart', name, developer._argumentsAsJson(instantArguments));
}
static timeSync(name, func, opts) {
let arguments$ = opts && 'arguments' in opts ? opts.arguments : null;
developer.Timeline.startSync(name, {arguments: arguments$});
try {
return func();
} finally {
developer.Timeline.finishSync();
}
}
static get now() {
return developer._getTraceClock();
}
};
dart.setSignature(developer.Timeline, {
sfields: () => ({
_stack: ListOf_SyncBlock(),
_isolateId: core.int,
_isolateIdString: core.String
}),
sgetters: () => ({now: dart.definiteFunctionType(core.int, [])}),
statics: () => ({
startSync: dart.definiteFunctionType(dart.void, [core.String], {arguments: core.Map}),
finishSync: dart.definiteFunctionType(dart.void, []),
instantSync: dart.definiteFunctionType(dart.void, [core.String], {arguments: core.Map}),
timeSync: dart.definiteFunctionType(dart.dynamic, [core.String, developer.TimelineSyncFunction], {arguments: core.Map})
}),
names: ['startSync', 'finishSync', 'instantSync', 'timeSync']
});
dart.defineLazy(developer.Timeline, {
get _stack() {
return ListOf_SyncBlock().new();
},
get _isolateId() {
return developer._getIsolateNum();
},
get _isolateIdString() {
return dart.toString(developer.Timeline._isolateId);
}
});
const _stack = Symbol('_stack');
const _taskId = Symbol('_taskId');
const _start$1 = Symbol('_start');
const _finish = Symbol('_finish');
developer.TimelineTask = class TimelineTask extends core.Object {
new() {
this[_stack] = JSArrayOf_AsyncBlock().of([]);
this[_taskId] = developer._getNextAsyncId();
}
withTaskId(taskId) {
this[_stack] = JSArrayOf_AsyncBlock().of([]);
this[_taskId] = taskId;
if (!(typeof taskId == 'number')) {
dart.throw(new core.ArgumentError.value(taskId, 'taskId', 'Must be an int'));
}
}
start(name, opts) {
let arguments$ = opts && 'arguments' in opts ? opts.arguments : null;
if (developer._isProduct) {
return;
}
if (!(typeof name == 'string')) {
dart.throw(new core.ArgumentError.value(name, 'name', 'Must be a String'));
}
let block = new developer._AsyncBlock._(name, this[_taskId]);
if (core.Map.is(arguments$)) {
block[_appendArguments](arguments$);
}
this[_stack][dartx.add](block);
block[_start$1]();
}
instant(name, opts) {
let arguments$ = opts && 'arguments' in opts ? opts.arguments : null;
if (developer._isProduct) {
return;
}
if (!(typeof name == 'string')) {
dart.throw(new core.ArgumentError.value(name, 'name', 'Must be a String'));
}
let instantArguments = null;
if (core.Map.is(arguments$)) {
instantArguments = core.Map.from(arguments$);
}
developer._reportTaskEvent(developer._getTraceClock(), this[_taskId], 'n', 'Dart', name, developer._argumentsAsJson(instantArguments));
}
finish() {
if (developer._isProduct) {
return;
}
if (this[_stack][dartx.length] == 0) {
dart.throw(new core.StateError('Uneven calls to start and finish'));
}
let block = this[_stack][dartx.removeLast]();
block[_finish]();
}
pass() {
if (dart.notNull(this[_stack][dartx.length]) > 0) {
dart.throw(new core.StateError('You cannot pass a TimelineTask without finishing all started ' + 'operations'));
}
let r = this[_taskId];
return r;
}
};
dart.defineNamedConstructor(developer.TimelineTask, 'withTaskId');
dart.setSignature(developer.TimelineTask, {
constructors: () => ({
new: dart.definiteFunctionType(developer.TimelineTask, []),
withTaskId: dart.definiteFunctionType(developer.TimelineTask, [core.int])
}),
fields: () => ({
[_taskId]: core.int,
[_stack]: ListOf_AsyncBlock()
}),
methods: () => ({
start: dart.definiteFunctionType(dart.void, [core.String], {arguments: core.Map}),
instant: dart.definiteFunctionType(dart.void, [core.String], {arguments: core.Map}),
finish: dart.definiteFunctionType(dart.void, []),
pass: dart.definiteFunctionType(core.int, [])
})
});
const _arguments$ = Symbol('_arguments');
developer._AsyncBlock = class _AsyncBlock extends core.Object {
_(name, taskId) {
this.name = name;
this[_taskId] = taskId;
this.category = 'Dart';
this[_arguments$] = null;
}
[_start$1]() {
developer._reportTaskEvent(developer._getTraceClock(), this[_taskId], 'b', this.category, this.name, developer._argumentsAsJson(this[_arguments$]));
}
[_finish]() {
developer._reportTaskEvent(developer._getTraceClock(), this[_taskId], 'e', this.category, this.name, developer._argumentsAsJson(null));
}
[_appendArguments](arguments$) {
if (this[_arguments$] == null) {
this[_arguments$] = dart.map();
}
this[_arguments$][dartx.addAll](arguments$);
}
};
dart.defineNamedConstructor(developer._AsyncBlock, '_');
dart.setSignature(developer._AsyncBlock, {
constructors: () => ({_: dart.definiteFunctionType(developer._AsyncBlock, [core.String, core.int])}),
fields: () => ({
category: core.String,
name: core.String,
[_taskId]: core.int,
[_arguments$]: core.Map
}),
methods: () => ({
[_start$1]: dart.definiteFunctionType(dart.void, []),
[_finish]: dart.definiteFunctionType(dart.void, []),
[_appendArguments]: dart.definiteFunctionType(dart.void, [core.Map])
})
});
const _startCpu = Symbol('_startCpu');
developer._SyncBlock = class _SyncBlock extends core.Object {
_(name, start, startCpu) {
this.name = name;
this[_start$1] = start;
this[_startCpu] = startCpu;
this.category = 'Dart';
this[_arguments$] = null;
}
finish() {
developer._reportCompleteEvent(this[_start$1], this[_startCpu], this.category, this.name, developer._argumentsAsJson(this[_arguments$]));
}
[_appendArguments](arguments$) {
if (arguments$ == null) {
return;
}
if (this[_arguments$] == null) {
this[_arguments$] = dart.map();
}
this[_arguments$][dartx.addAll](arguments$);
}
};
dart.defineNamedConstructor(developer._SyncBlock, '_');
dart.setSignature(developer._SyncBlock, {
constructors: () => ({_: dart.definiteFunctionType(developer._SyncBlock, [core.String, core.int, core.int])}),
fields: () => ({
category: core.String,
name: core.String,
[_arguments$]: core.Map,
[_start$1]: core.int,
[_startCpu]: core.int
}),
methods: () => ({
finish: dart.definiteFunctionType(dart.void, []),
[_appendArguments]: dart.definiteFunctionType(dart.void, [core.Map])
})
});
developer._fastPathArguments = null;
developer._argumentsAsJson = function(arguments$) {
if (arguments$ == null || arguments$[dartx.length] == 0) {
if (developer._fastPathArguments == null) {
developer._fastPathArguments = dart.str`{"isolateNumber":"${developer.Timeline._isolateId}"}`;
}
return developer._fastPathArguments;
}
arguments$[dartx._set]('isolateNumber', developer.Timeline._isolateIdString);
return convert.JSON.encode(arguments$);
};
dart.fn(developer._argumentsAsJson, MapToString());
developer._isDartStreamEnabled = function() {
return false;
};
dart.fn(developer._isDartStreamEnabled, VoidTobool());
developer._getNextAsyncId = function() {
return 0;
};
dart.fn(developer._getNextAsyncId, VoidToint());
developer._getTraceClock = function() {
let x = developer._clockValue;
developer._clockValue = dart.notNull(x) + 1;
return x;
};
dart.fn(developer._getTraceClock, VoidToint());
developer._getThreadCpuClock = function() {
return -1;
};
dart.fn(developer._getThreadCpuClock, VoidToint());
developer._getIsolateNum = function() {
return 0;
};
dart.fn(developer._getIsolateNum, VoidToint());
developer._reportTaskEvent = function(start, taskId, phase, category, name, argumentsAsJson) {
};
dart.fn(developer._reportTaskEvent, intAndintAndString__Tovoid());
developer._reportCompleteEvent = function(start, startCpu, category, name, argumentsAsJson) {
};
dart.fn(developer._reportCompleteEvent, intAndintAndString__Tovoid$());
developer._reportInstantEvent = function(start, category, name, argumentsAsJson) {
};
dart.fn(developer._reportInstantEvent, intAndStringAndString__Tovoid());
developer.ServiceProtocolInfo = class ServiceProtocolInfo extends core.Object {
new(serverUri) {
this.majorVersion = developer._getServiceMajorVersion();
this.minorVersion = developer._getServiceMinorVersion();
this.serverUri = serverUri;
}
toString() {
if (this.serverUri != null) {
return dart.str`Dart VM Service Protocol v${this.majorVersion}.${this.minorVersion} ` + dart.str`listening on ${this.serverUri}`;
} else {
return dart.str`Dart VM Service Protocol v${this.majorVersion}.${this.minorVersion}`;
}
}
};
dart.setSignature(developer.ServiceProtocolInfo, {
constructors: () => ({new: dart.definiteFunctionType(developer.ServiceProtocolInfo, [core.Uri])}),
fields: () => ({
majorVersion: core.int,
minorVersion: core.int,
serverUri: core.Uri
})
});
developer.Service = class Service extends core.Object {
static getInfo() {
return dart.async(function*() {
let receivePort = isolate.RawReceivePort.new();
let uriCompleter = CompleterOfUri().new();
receivePort.handler = dart.fn(uri => uriCompleter.complete(uri), UriTovoid());
developer._getServerInfo(receivePort.sendPort);
let uri = (yield uriCompleter.future);
receivePort.close();
return new developer.ServiceProtocolInfo(uri);
}, developer.ServiceProtocolInfo);
}
static controlWebServer(opts) {
return dart.async(function*(opts) {
let enable = opts && 'enable' in opts ? opts.enable : false;
if (!(typeof enable == 'boolean')) {
dart.throw(new core.ArgumentError.value(enable, 'enable', 'Must be a bool'));
}
let receivePort = isolate.RawReceivePort.new();
let uriCompleter = CompleterOfUri().new();
receivePort.handler = dart.fn(uri => uriCompleter.complete(uri), UriTovoid());
developer._webServerControl(receivePort.sendPort, enable);
let uri = (yield uriCompleter.future);
receivePort.close();
return new developer.ServiceProtocolInfo(uri);
}, developer.ServiceProtocolInfo, opts);
}
};
dart.setSignature(developer.Service, {
statics: () => ({
getInfo: dart.definiteFunctionType(async.Future$(developer.ServiceProtocolInfo), []),
controlWebServer: dart.definiteFunctionType(async.Future$(developer.ServiceProtocolInfo), [], {enable: core.bool})
}),
names: ['getInfo', 'controlWebServer']
});
developer._getServerInfo = function(sp) {
sp.send(null);
};
dart.lazyFn(developer._getServerInfo, () => SendPortTovoid());
developer._webServerControl = function(sp, enable) {
sp.send(null);
};
dart.lazyFn(developer._webServerControl, () => SendPortAndboolTovoid());
developer._getServiceMajorVersion = function() {
return 0;
};
dart.fn(developer._getServiceMajorVersion, VoidToint());
developer._getServiceMinorVersion = function() {
return 0;
};
dart.fn(developer._getServiceMinorVersion, VoidToint());
isolate.IsolateSpawnException = class IsolateSpawnException extends core.Object {
new(message) {
this.message = message;
@ -56952,19 +57708,19 @@ define([], function() {
statics: () => ({createElement_tag: dart.definiteFunctionType(dart.dynamic, [core.String, core.String])}),
names: ['createElement_tag']
});
const _value$0 = Symbol('_value');
const _value$1 = Symbol('_value');
html$.ScrollAlignment = class ScrollAlignment extends core.Object {
_internal(value) {
this[_value$0] = value;
this[_value$1] = value;
}
toString() {
return dart.str`ScrollAlignment.${this[_value$0]}`;
return dart.str`ScrollAlignment.${this[_value$1]}`;
}
};
dart.defineNamedConstructor(html$.ScrollAlignment, '_internal');
dart.setSignature(html$.ScrollAlignment, {
constructors: () => ({_internal: dart.definiteFunctionType(html$.ScrollAlignment, [dart.dynamic])}),
fields: () => ({[_value$0]: dart.dynamic}),
fields: () => ({[_value$1]: dart.dynamic}),
sfields: () => ({
TOP: html$.ScrollAlignment,
CENTER: html$.ScrollAlignment,
@ -80225,43 +80981,43 @@ define([], function() {
const _unit = Symbol('_unit');
html$.Dimension = class Dimension extends core.Object {
percent(value) {
this[_value$0] = value;
this[_value$1] = value;
this[_unit] = '%';
}
px(value) {
this[_value$0] = value;
this[_value$1] = value;
this[_unit] = 'px';
}
pc(value) {
this[_value$0] = value;
this[_value$1] = value;
this[_unit] = 'pc';
}
pt(value) {
this[_value$0] = value;
this[_value$1] = value;
this[_unit] = 'pt';
}
inch(value) {
this[_value$0] = value;
this[_value$1] = value;
this[_unit] = 'in';
}
cm(value) {
this[_value$0] = value;
this[_value$1] = value;
this[_unit] = 'cm';
}
mm(value) {
this[_value$0] = value;
this[_value$1] = value;
this[_unit] = 'mm';
}
em(value) {
this[_value$0] = value;
this[_value$1] = value;
this[_unit] = 'em';
}
ex(value) {
this[_value$0] = value;
this[_value$1] = value;
this[_unit] = 'ex';
}
css(cssValue) {
this[_value$0] = null;
this[_value$1] = null;
this[_unit] = null;
if (cssValue == '') cssValue = '0px';
if (dart.test(cssValue[dartx.endsWith]('%'))) {
@ -80270,16 +81026,16 @@ define([], function() {
this[_unit] = cssValue[dartx.substring](dart.notNull(cssValue[dartx.length]) - 2);
}
if (dart.test(cssValue[dartx.contains]('.'))) {
this[_value$0] = core.double.parse(cssValue[dartx.substring](0, dart.notNull(cssValue[dartx.length]) - dart.notNull(this[_unit][dartx.length])));
this[_value$1] = core.double.parse(cssValue[dartx.substring](0, dart.notNull(cssValue[dartx.length]) - dart.notNull(this[_unit][dartx.length])));
} else {
this[_value$0] = core.int.parse(cssValue[dartx.substring](0, dart.notNull(cssValue[dartx.length]) - dart.notNull(this[_unit][dartx.length])));
this[_value$1] = core.int.parse(cssValue[dartx.substring](0, dart.notNull(cssValue[dartx.length]) - dart.notNull(this[_unit][dartx.length])));
}
}
toString() {
return dart.str`${this[_value$0]}${this[_unit]}`;
return dart.str`${this[_value$1]}${this[_unit]}`;
}
get value() {
return this[_value$0];
return this[_value$1];
}
};
dart.defineNamedConstructor(html$.Dimension, 'percent');
@ -80306,7 +81062,7 @@ define([], function() {
css: dart.definiteFunctionType(html$.Dimension, [core.String])
}),
fields: () => ({
[_value$0]: core.num,
[_value$1]: core.num,
[_unit]: core.String
}),
getters: () => ({value: dart.definiteFunctionType(core.num, [])})
@ -94921,6 +95677,7 @@ define([], function() {
collection: collection,
convert: convert,
core: core,
developer: developer,
isolate: isolate,
js: js,
js_util: js_util,

View file

@ -17,6 +17,7 @@
const collection = Object.create(null);
const convert = Object.create(null);
const core = Object.create(null);
const developer = Object.create(null);
const isolate = Object.create(null);
const js = Object.create(null);
const js_util = Object.create(null);
@ -376,6 +377,12 @@
let MapOfString$String = () => (MapOfString$String = dart.constFn(core.Map$(core.String, core.String)))();
let IterableOfString = () => (IterableOfString = dart.constFn(core.Iterable$(core.String)))();
let MapOfString$dynamic = () => (MapOfString$dynamic = dart.constFn(core.Map$(core.String, dart.dynamic)))();
let MapOfString$ServiceExtensionHandler = () => (MapOfString$ServiceExtensionHandler = dart.constFn(core.Map$(core.String, developer.ServiceExtensionHandler)))();
let MapOfString$Metric = () => (MapOfString$Metric = dart.constFn(core.Map$(core.String, developer.Metric)))();
let ListOf_SyncBlock = () => (ListOf_SyncBlock = dart.constFn(core.List$(developer._SyncBlock)))();
let JSArrayOf_AsyncBlock = () => (JSArrayOf_AsyncBlock = dart.constFn(_interceptors.JSArray$(developer._AsyncBlock)))();
let ListOf_AsyncBlock = () => (ListOf_AsyncBlock = dart.constFn(core.List$(developer._AsyncBlock)))();
let CompleterOfUri = () => (CompleterOfUri = dart.constFn(async.Completer$(core.Uri)))();
let FutureOfIsolate = () => (FutureOfIsolate = dart.constFn(async.Future$(isolate.Isolate)))();
let JsArray = () => (JsArray = dart.constFn(js.JsArray$()))();
let ExpandoOfFunction = () => (ExpandoOfFunction = dart.constFn(core.Expando$(core.Function)))();
@ -683,6 +690,20 @@
let MapOfString$StringAndStringToMapOfString$String = () => (MapOfString$StringAndStringToMapOfString$String = dart.constFn(dart.definiteFunctionType(MapOfString$String(), [MapOfString$String(), core.String])))();
let intAndintAndintTovoid = () => (intAndintAndintTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.int, core.int, core.int])))();
let String__Tovoid = () => (String__Tovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.String], [dart.dynamic])))();
let __Tobool = () => (__Tobool = dart.constFn(dart.definiteFunctionType(core.bool, [], {when: core.bool, message: core.String})))();
let String__Tovoid$ = () => (String__Tovoid$ = dart.constFn(dart.definiteFunctionType(dart.void, [core.String], {time: core.DateTime, sequenceNumber: core.int, level: core.int, name: core.String, zone: async.Zone, error: core.Object, stackTrace: core.StackTrace})))();
let StringAndServiceExtensionHandlerTovoid = () => (StringAndServiceExtensionHandlerTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.String, developer.ServiceExtensionHandler])))();
let StringAndMapTovoid = () => (StringAndMapTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.String, core.Map])))();
let StringToServiceExtensionHandler = () => (StringToServiceExtensionHandler = dart.constFn(dart.definiteFunctionType(developer.ServiceExtensionHandler, [core.String])))();
let StringAndServiceExtensionHandlerTodynamic = () => (StringAndServiceExtensionHandlerTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [core.String, developer.ServiceExtensionHandler])))();
let VoidToUserTag = () => (VoidToUserTag = dart.constFn(dart.definiteFunctionType(developer.UserTag, [])))();
let MapToString = () => (MapToString = dart.constFn(dart.definiteFunctionType(core.String, [core.Map])))();
let intAndintAndString__Tovoid = () => (intAndintAndString__Tovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.int, core.int, core.String, core.String, core.String, core.String])))();
let intAndintAndString__Tovoid$ = () => (intAndintAndString__Tovoid$ = dart.constFn(dart.definiteFunctionType(dart.void, [core.int, core.int, core.String, core.String, core.String])))();
let intAndStringAndString__Tovoid = () => (intAndStringAndString__Tovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.int, core.String, core.String, core.String])))();
let UriTovoid = () => (UriTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.Uri])))();
let SendPortTovoid = () => (SendPortTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [isolate.SendPort])))();
let SendPortAndboolTovoid = () => (SendPortAndboolTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [isolate.SendPort, core.bool])))();
let ListToIsolate = () => (ListToIsolate = dart.constFn(dart.definiteFunctionType(isolate.Isolate, [core.List])))();
let dynamicTo_DartObject = () => (dynamicTo_DartObject = dart.constFn(dart.definiteFunctionType(js._DartObject, [dart.dynamic])))();
let dynamicToJsObject = () => (dynamicToJsObject = dart.constFn(dart.definiteFunctionType(js.JsObject, [dart.dynamic])))();
@ -36446,6 +36467,741 @@
core.UriData._noScheme = -1;
core.UriData._tokenCharTable = dart.constList([0, 0, 27858, 1023, 65534, 51199, 65535, 32767], core.int);
core.UriData._uricTable = core.Uri._queryCharTable;
developer.debugger = function(opts) {
let when = opts && 'when' in opts ? opts.when : true;
let message = opts && 'message' in opts ? opts.message : null;
if (dart.test(when)) {
debugger;
}
return when;
};
dart.fn(developer.debugger, __Tobool());
developer.inspect = function(object) {
return object;
};
dart.fn(developer.inspect, ObjectToObject());
developer.log = function(message, opts) {
let time = opts && 'time' in opts ? opts.time : null;
let sequenceNumber = opts && 'sequenceNumber' in opts ? opts.sequenceNumber : null;
let level = opts && 'level' in opts ? opts.level : 0;
let name = opts && 'name' in opts ? opts.name : '';
let zone = opts && 'zone' in opts ? opts.zone : null;
let error = opts && 'error' in opts ? opts.error : null;
let stackTrace = opts && 'stackTrace' in opts ? opts.stackTrace : null;
};
dart.fn(developer.log, String__Tovoid$());
dart.defineLazy(developer, {
get _extensions() {
return MapOfString$ServiceExtensionHandler().new();
}
});
developer._clockValue = 0;
const _result = Symbol('_result');
const _errorCode = Symbol('_errorCode');
const _errorDetail = Symbol('_errorDetail');
const _isError = Symbol('_isError');
const _toString = Symbol('_toString');
developer.ServiceExtensionResponse = class ServiceExtensionResponse extends core.Object {
result(result) {
this[_result] = result;
this[_errorCode] = null;
this[_errorDetail] = null;
if (!(typeof this[_result] == 'string')) {
dart.throw(new core.ArgumentError.value(this[_result], "result", "Must be a String"));
}
}
error(errorCode, errorDetail) {
this[_result] = null;
this[_errorCode] = errorCode;
this[_errorDetail] = errorDetail;
developer.ServiceExtensionResponse._validateErrorCode(this[_errorCode]);
if (!(typeof this[_errorDetail] == 'string')) {
dart.throw(new core.ArgumentError.value(this[_errorDetail], "errorDetail", "Must be a String"));
}
}
static _errorCodeMessage(errorCode) {
developer.ServiceExtensionResponse._validateErrorCode(errorCode);
if (errorCode == developer.ServiceExtensionResponse.kInvalidParams) {
return "Invalid params";
}
return "Server error";
}
static _validateErrorCode(errorCode) {
if (!(typeof errorCode == 'number')) {
dart.throw(new core.ArgumentError.value(errorCode, "errorCode", "Must be an int"));
}
if (errorCode == developer.ServiceExtensionResponse.invalidParams) {
return;
}
if (dart.notNull(errorCode) >= developer.ServiceExtensionResponse.extensionErrorMin && dart.notNull(errorCode) <= developer.ServiceExtensionResponse.extensionErrorMax) {
return;
}
dart.throw(new core.ArgumentError.value(errorCode, "errorCode", "Out of range"));
}
[_isError]() {
return this[_errorCode] != null && this[_errorDetail] != null;
}
[_toString]() {
if (this[_result] != null) {
return this[_result];
} else {
dart.assert(this[_errorCode] != null);
dart.assert(this[_errorDetail] != null);
return convert.JSON.encode(dart.map({code: this[_errorCode], message: developer.ServiceExtensionResponse._errorCodeMessage(this[_errorCode]), data: dart.map({details: this[_errorDetail]}, core.String, core.String)}, core.String, core.Object));
}
}
};
dart.defineNamedConstructor(developer.ServiceExtensionResponse, 'result');
dart.defineNamedConstructor(developer.ServiceExtensionResponse, 'error');
dart.setSignature(developer.ServiceExtensionResponse, {
constructors: () => ({
result: dart.definiteFunctionType(developer.ServiceExtensionResponse, [core.String]),
error: dart.definiteFunctionType(developer.ServiceExtensionResponse, [core.int, core.String])
}),
fields: () => ({
[_result]: core.String,
[_errorCode]: core.int,
[_errorDetail]: core.String
}),
methods: () => ({
[_isError]: dart.definiteFunctionType(core.bool, []),
[_toString]: dart.definiteFunctionType(core.String, [])
}),
sfields: () => ({
kInvalidParams: core.int,
kExtensionError: core.int,
kExtensionErrorMax: core.int,
kExtensionErrorMin: core.int,
invalidParams: core.int,
extensionError: core.int,
extensionErrorMax: core.int,
extensionErrorMin: core.int
}),
statics: () => ({
_errorCodeMessage: dart.definiteFunctionType(core.String, [core.int]),
_validateErrorCode: dart.definiteFunctionType(dart.dynamic, [core.int])
}),
names: ['_errorCodeMessage', '_validateErrorCode']
});
developer.ServiceExtensionResponse.invalidParams = -32602;
developer.ServiceExtensionResponse.extensionError = -32000;
developer.ServiceExtensionResponse.extensionErrorMax = -32000;
developer.ServiceExtensionResponse.extensionErrorMin = -32016;
dart.defineLazy(developer.ServiceExtensionResponse, {
get kInvalidParams() {
return developer.ServiceExtensionResponse.invalidParams;
},
get kExtensionError() {
return developer.ServiceExtensionResponse.extensionError;
},
get kExtensionErrorMax() {
return developer.ServiceExtensionResponse.extensionErrorMax;
},
get kExtensionErrorMin() {
return developer.ServiceExtensionResponse.extensionErrorMin;
}
});
developer.ServiceExtensionHandler = dart.typedef('ServiceExtensionHandler', () => dart.functionType(async.Future$(developer.ServiceExtensionResponse), [core.String, MapOfString$String()]));
developer.registerExtension = function(method, handler) {
if (!(typeof method == 'string')) {
dart.throw(new core.ArgumentError.value(method, 'method', 'Must be a String'));
}
if (!dart.test(method[dartx.startsWith]('ext.'))) {
dart.throw(new core.ArgumentError.value(method, 'method', 'Must begin with ext.'));
}
if (developer._lookupExtension(method) != null) {
dart.throw(new core.ArgumentError(dart.str`Extension already registered: ${method}`));
}
if (!developer.ServiceExtensionHandler.is(handler)) {
dart.throw(new core.ArgumentError.value(handler, 'handler', 'Must be a ServiceExtensionHandler'));
}
developer._registerExtension(method, handler);
};
dart.fn(developer.registerExtension, StringAndServiceExtensionHandlerTovoid());
developer.postEvent = function(eventKind, eventData) {
if (!(typeof eventKind == 'string')) {
dart.throw(new core.ArgumentError.value(eventKind, 'eventKind', 'Must be a String'));
}
if (!core.Map.is(eventData)) {
dart.throw(new core.ArgumentError.value(eventData, 'eventData', 'Must be a Map'));
}
let eventDataAsString = convert.JSON.encode(eventData);
developer._postEvent(eventKind, eventDataAsString);
};
dart.fn(developer.postEvent, StringAndMapTovoid());
developer._postEvent = function(eventKind, eventData) {
};
dart.fn(developer._postEvent, StringAndStringTodynamic());
developer._lookupExtension = function(method) {
return developer._extensions[dartx._get](method);
};
dart.fn(developer._lookupExtension, StringToServiceExtensionHandler());
developer._registerExtension = function(method, handler) {
developer._extensions[dartx._set](method, handler);
};
dart.fn(developer._registerExtension, StringAndServiceExtensionHandlerTodynamic());
developer.UserTag = class UserTag extends core.Object {
static new(label) {
return developer._FakeUserTag.new(label);
}
static get defaultTag() {
return developer._FakeUserTag._defaultTag;
}
};
dart.setSignature(developer.UserTag, {
constructors: () => ({new: dart.definiteFunctionType(developer.UserTag, [core.String])}),
sfields: () => ({MAX_USER_TAGS: core.int}),
sgetters: () => ({defaultTag: dart.definiteFunctionType(developer.UserTag, [])})
});
developer.UserTag.MAX_USER_TAGS = 64;
developer._FakeUserTag = class _FakeUserTag extends core.Object {
real(label) {
this.label = label;
}
static new(label) {
let existingTag = developer._FakeUserTag._instances[dartx._get](label);
if (existingTag != null) {
return developer._FakeUserTag._check(existingTag);
}
if (developer._FakeUserTag._instances[dartx.length] == developer.UserTag.MAX_USER_TAGS) {
dart.throw(new core.UnsupportedError(dart.str`UserTag instance limit (${developer.UserTag.MAX_USER_TAGS}) reached.`));
}
let instance = new developer._FakeUserTag.real(label);
developer._FakeUserTag._instances[dartx._set](label, instance);
return instance;
}
makeCurrent() {
let old = developer._currentTag;
developer._currentTag = this;
return old;
}
};
dart.defineNamedConstructor(developer._FakeUserTag, 'real');
developer._FakeUserTag[dart.implements] = () => [developer.UserTag];
dart.setSignature(developer._FakeUserTag, {
constructors: () => ({
real: dart.definiteFunctionType(developer._FakeUserTag, [core.String]),
new: dart.definiteFunctionType(developer._FakeUserTag, [core.String])
}),
fields: () => ({label: core.String}),
methods: () => ({makeCurrent: dart.definiteFunctionType(developer.UserTag, [])}),
sfields: () => ({
_instances: core.Map,
_defaultTag: developer.UserTag
})
});
dart.defineLazy(developer._FakeUserTag, {
get _instances() {
return dart.map();
},
set _instances(_) {},
get _defaultTag() {
return developer._FakeUserTag.new('Default');
}
});
dart.defineLazy(developer, {
get _currentTag() {
return developer._FakeUserTag._defaultTag;
},
set _currentTag(_) {}
});
developer.getCurrentTag = function() {
return developer._currentTag;
};
dart.fn(developer.getCurrentTag, VoidToUserTag());
developer.Metric = class Metric extends core.Object {
new(name, description) {
this.name = name;
this.description = description;
if (this.name == 'vm' || dart.test(this.name[dartx.contains]('/'))) {
dart.throw(new core.ArgumentError('Invalid Metric name.'));
}
}
};
dart.setSignature(developer.Metric, {
constructors: () => ({new: dart.definiteFunctionType(developer.Metric, [core.String, core.String])}),
fields: () => ({
name: core.String,
description: core.String
})
});
const _value$0 = Symbol('_value');
const _toJSON = Symbol('_toJSON');
developer.Gauge = class Gauge extends developer.Metric {
get value() {
return this[_value$0];
}
set value(v) {
if (dart.notNull(v) < dart.notNull(this.min)) {
v = this.min;
} else if (dart.notNull(v) > dart.notNull(this.max)) {
v = this.max;
}
this[_value$0] = v;
}
new(name, description, min, max) {
this.min = min;
this.max = max;
this[_value$0] = null;
super.new(name, description);
if (!(typeof this.min == 'number')) {
dart.throw(new core.ArgumentError('min must be a double'));
}
if (!(typeof this.max == 'number')) {
dart.throw(new core.ArgumentError('max must be a double'));
}
if (!(dart.notNull(this.min) < dart.notNull(this.max))) {
dart.throw(new core.ArgumentError('min must be less than max'));
}
this[_value$0] = this.min;
}
[_toJSON]() {
let map = dart.map({type: 'Gauge', id: dart.str`metrics/${this.name}`, name: this.name, description: this.description, value: this.value, min: this.min, max: this.max}, core.String, core.Object);
return map;
}
};
dart.setSignature(developer.Gauge, {
constructors: () => ({new: dart.definiteFunctionType(developer.Gauge, [core.String, core.String, core.double, core.double])}),
fields: () => ({
min: core.double,
max: core.double,
[_value$0]: core.double
}),
getters: () => ({value: dart.definiteFunctionType(core.double, [])}),
setters: () => ({value: dart.definiteFunctionType(dart.void, [core.double])}),
methods: () => ({[_toJSON]: dart.definiteFunctionType(core.Map, [])})
});
developer.Counter = class Counter extends developer.Metric {
new(name, description) {
this[_value$0] = 0.0;
super.new(name, description);
}
get value() {
return this[_value$0];
}
set value(v) {
this[_value$0] = v;
}
[_toJSON]() {
let map = dart.map({type: 'Counter', id: dart.str`metrics/${this.name}`, name: this.name, description: this.description, value: this.value}, core.String, core.Object);
return map;
}
};
dart.setSignature(developer.Counter, {
constructors: () => ({new: dart.definiteFunctionType(developer.Counter, [core.String, core.String])}),
fields: () => ({[_value$0]: core.double}),
getters: () => ({value: dart.definiteFunctionType(core.double, [])}),
setters: () => ({value: dart.definiteFunctionType(dart.void, [core.double])}),
methods: () => ({[_toJSON]: dart.definiteFunctionType(core.Map, [])})
});
developer.Metrics = class Metrics extends core.Object {
static register(metric) {
if (!developer.Metric.is(metric)) {
dart.throw(new core.ArgumentError('metric must be a Metric'));
}
if (developer.Metrics._metrics[dartx._get](metric.name) != null) {
dart.throw(new core.ArgumentError('Registered metrics have unique names'));
}
developer.Metrics._metrics[dartx._set](metric.name, metric);
}
static deregister(metric) {
if (!developer.Metric.is(metric)) {
dart.throw(new core.ArgumentError('metric must be a Metric'));
}
developer.Metrics._metrics[dartx.remove](metric.name);
}
static _printMetric(id) {
let metric = developer.Metrics._metrics[dartx._get](id);
if (metric == null) {
return null;
}
return convert.JSON.encode(metric[_toJSON]());
}
static _printMetrics() {
let metrics = [];
for (let metric of developer.Metrics._metrics[dartx.values]) {
metrics[dartx.add](metric[_toJSON]());
}
let map = dart.map({type: 'MetricList', metrics: metrics}, core.String, core.Object);
return convert.JSON.encode(map);
}
};
dart.setSignature(developer.Metrics, {
sfields: () => ({_metrics: MapOfString$Metric()}),
statics: () => ({
register: dart.definiteFunctionType(dart.void, [developer.Metric]),
deregister: dart.definiteFunctionType(dart.void, [developer.Metric]),
_printMetric: dart.definiteFunctionType(core.String, [core.String]),
_printMetrics: dart.definiteFunctionType(core.String, [])
}),
names: ['register', 'deregister', '_printMetric', '_printMetrics']
});
dart.defineLazy(developer.Metrics, {
get _metrics() {
return MapOfString$Metric().new();
}
});
developer._isProduct = false;
developer.TimelineSyncFunction = dart.typedef('TimelineSyncFunction', () => dart.functionType(dart.dynamic, []));
developer.TimelineAsyncFunction = dart.typedef('TimelineAsyncFunction', () => dart.functionType(async.Future, []));
const _appendArguments = Symbol('_appendArguments');
developer.Timeline = class Timeline extends core.Object {
static startSync(name, opts) {
let arguments$ = opts && 'arguments' in opts ? opts.arguments : null;
if (developer._isProduct) {
return;
}
if (!(typeof name == 'string')) {
dart.throw(new core.ArgumentError.value(name, 'name', 'Must be a String'));
}
if (!dart.test(developer._isDartStreamEnabled())) {
developer.Timeline._stack[dartx.add](null);
return;
}
let block = new developer._SyncBlock._(name, developer._getTraceClock(), developer._getThreadCpuClock());
if (core.Map.is(arguments$)) {
block[_appendArguments](arguments$);
}
developer.Timeline._stack[dartx.add](block);
}
static finishSync() {
if (developer._isProduct) {
return;
}
if (developer.Timeline._stack[dartx.length] == 0) {
dart.throw(new core.StateError('Uneven calls to startSync and finishSync'));
}
let block = developer.Timeline._stack[dartx.removeLast]();
if (block == null) {
return;
}
block.finish();
}
static instantSync(name, opts) {
let arguments$ = opts && 'arguments' in opts ? opts.arguments : null;
if (developer._isProduct) {
return;
}
if (!(typeof name == 'string')) {
dart.throw(new core.ArgumentError.value(name, 'name', 'Must be a String'));
}
if (!dart.test(developer._isDartStreamEnabled())) {
return;
}
let instantArguments = null;
if (core.Map.is(arguments$)) {
instantArguments = core.Map.from(arguments$);
}
developer._reportInstantEvent(developer._getTraceClock(), 'Dart', name, developer._argumentsAsJson(instantArguments));
}
static timeSync(name, func, opts) {
let arguments$ = opts && 'arguments' in opts ? opts.arguments : null;
developer.Timeline.startSync(name, {arguments: arguments$});
try {
return func();
} finally {
developer.Timeline.finishSync();
}
}
static get now() {
return developer._getTraceClock();
}
};
dart.setSignature(developer.Timeline, {
sfields: () => ({
_stack: ListOf_SyncBlock(),
_isolateId: core.int,
_isolateIdString: core.String
}),
sgetters: () => ({now: dart.definiteFunctionType(core.int, [])}),
statics: () => ({
startSync: dart.definiteFunctionType(dart.void, [core.String], {arguments: core.Map}),
finishSync: dart.definiteFunctionType(dart.void, []),
instantSync: dart.definiteFunctionType(dart.void, [core.String], {arguments: core.Map}),
timeSync: dart.definiteFunctionType(dart.dynamic, [core.String, developer.TimelineSyncFunction], {arguments: core.Map})
}),
names: ['startSync', 'finishSync', 'instantSync', 'timeSync']
});
dart.defineLazy(developer.Timeline, {
get _stack() {
return ListOf_SyncBlock().new();
},
get _isolateId() {
return developer._getIsolateNum();
},
get _isolateIdString() {
return dart.toString(developer.Timeline._isolateId);
}
});
const _stack = Symbol('_stack');
const _taskId = Symbol('_taskId');
const _start$1 = Symbol('_start');
const _finish = Symbol('_finish');
developer.TimelineTask = class TimelineTask extends core.Object {
new() {
this[_stack] = JSArrayOf_AsyncBlock().of([]);
this[_taskId] = developer._getNextAsyncId();
}
withTaskId(taskId) {
this[_stack] = JSArrayOf_AsyncBlock().of([]);
this[_taskId] = taskId;
if (!(typeof taskId == 'number')) {
dart.throw(new core.ArgumentError.value(taskId, 'taskId', 'Must be an int'));
}
}
start(name, opts) {
let arguments$ = opts && 'arguments' in opts ? opts.arguments : null;
if (developer._isProduct) {
return;
}
if (!(typeof name == 'string')) {
dart.throw(new core.ArgumentError.value(name, 'name', 'Must be a String'));
}
let block = new developer._AsyncBlock._(name, this[_taskId]);
if (core.Map.is(arguments$)) {
block[_appendArguments](arguments$);
}
this[_stack][dartx.add](block);
block[_start$1]();
}
instant(name, opts) {
let arguments$ = opts && 'arguments' in opts ? opts.arguments : null;
if (developer._isProduct) {
return;
}
if (!(typeof name == 'string')) {
dart.throw(new core.ArgumentError.value(name, 'name', 'Must be a String'));
}
let instantArguments = null;
if (core.Map.is(arguments$)) {
instantArguments = core.Map.from(arguments$);
}
developer._reportTaskEvent(developer._getTraceClock(), this[_taskId], 'n', 'Dart', name, developer._argumentsAsJson(instantArguments));
}
finish() {
if (developer._isProduct) {
return;
}
if (this[_stack][dartx.length] == 0) {
dart.throw(new core.StateError('Uneven calls to start and finish'));
}
let block = this[_stack][dartx.removeLast]();
block[_finish]();
}
pass() {
if (dart.notNull(this[_stack][dartx.length]) > 0) {
dart.throw(new core.StateError('You cannot pass a TimelineTask without finishing all started ' + 'operations'));
}
let r = this[_taskId];
return r;
}
};
dart.defineNamedConstructor(developer.TimelineTask, 'withTaskId');
dart.setSignature(developer.TimelineTask, {
constructors: () => ({
new: dart.definiteFunctionType(developer.TimelineTask, []),
withTaskId: dart.definiteFunctionType(developer.TimelineTask, [core.int])
}),
fields: () => ({
[_taskId]: core.int,
[_stack]: ListOf_AsyncBlock()
}),
methods: () => ({
start: dart.definiteFunctionType(dart.void, [core.String], {arguments: core.Map}),
instant: dart.definiteFunctionType(dart.void, [core.String], {arguments: core.Map}),
finish: dart.definiteFunctionType(dart.void, []),
pass: dart.definiteFunctionType(core.int, [])
})
});
const _arguments$ = Symbol('_arguments');
developer._AsyncBlock = class _AsyncBlock extends core.Object {
_(name, taskId) {
this.name = name;
this[_taskId] = taskId;
this.category = 'Dart';
this[_arguments$] = null;
}
[_start$1]() {
developer._reportTaskEvent(developer._getTraceClock(), this[_taskId], 'b', this.category, this.name, developer._argumentsAsJson(this[_arguments$]));
}
[_finish]() {
developer._reportTaskEvent(developer._getTraceClock(), this[_taskId], 'e', this.category, this.name, developer._argumentsAsJson(null));
}
[_appendArguments](arguments$) {
if (this[_arguments$] == null) {
this[_arguments$] = dart.map();
}
this[_arguments$][dartx.addAll](arguments$);
}
};
dart.defineNamedConstructor(developer._AsyncBlock, '_');
dart.setSignature(developer._AsyncBlock, {
constructors: () => ({_: dart.definiteFunctionType(developer._AsyncBlock, [core.String, core.int])}),
fields: () => ({
category: core.String,
name: core.String,
[_taskId]: core.int,
[_arguments$]: core.Map
}),
methods: () => ({
[_start$1]: dart.definiteFunctionType(dart.void, []),
[_finish]: dart.definiteFunctionType(dart.void, []),
[_appendArguments]: dart.definiteFunctionType(dart.void, [core.Map])
})
});
const _startCpu = Symbol('_startCpu');
developer._SyncBlock = class _SyncBlock extends core.Object {
_(name, start, startCpu) {
this.name = name;
this[_start$1] = start;
this[_startCpu] = startCpu;
this.category = 'Dart';
this[_arguments$] = null;
}
finish() {
developer._reportCompleteEvent(this[_start$1], this[_startCpu], this.category, this.name, developer._argumentsAsJson(this[_arguments$]));
}
[_appendArguments](arguments$) {
if (arguments$ == null) {
return;
}
if (this[_arguments$] == null) {
this[_arguments$] = dart.map();
}
this[_arguments$][dartx.addAll](arguments$);
}
};
dart.defineNamedConstructor(developer._SyncBlock, '_');
dart.setSignature(developer._SyncBlock, {
constructors: () => ({_: dart.definiteFunctionType(developer._SyncBlock, [core.String, core.int, core.int])}),
fields: () => ({
category: core.String,
name: core.String,
[_arguments$]: core.Map,
[_start$1]: core.int,
[_startCpu]: core.int
}),
methods: () => ({
finish: dart.definiteFunctionType(dart.void, []),
[_appendArguments]: dart.definiteFunctionType(dart.void, [core.Map])
})
});
developer._fastPathArguments = null;
developer._argumentsAsJson = function(arguments$) {
if (arguments$ == null || arguments$[dartx.length] == 0) {
if (developer._fastPathArguments == null) {
developer._fastPathArguments = dart.str`{"isolateNumber":"${developer.Timeline._isolateId}"}`;
}
return developer._fastPathArguments;
}
arguments$[dartx._set]('isolateNumber', developer.Timeline._isolateIdString);
return convert.JSON.encode(arguments$);
};
dart.fn(developer._argumentsAsJson, MapToString());
developer._isDartStreamEnabled = function() {
return false;
};
dart.fn(developer._isDartStreamEnabled, VoidTobool());
developer._getNextAsyncId = function() {
return 0;
};
dart.fn(developer._getNextAsyncId, VoidToint());
developer._getTraceClock = function() {
let x = developer._clockValue;
developer._clockValue = dart.notNull(x) + 1;
return x;
};
dart.fn(developer._getTraceClock, VoidToint());
developer._getThreadCpuClock = function() {
return -1;
};
dart.fn(developer._getThreadCpuClock, VoidToint());
developer._getIsolateNum = function() {
return 0;
};
dart.fn(developer._getIsolateNum, VoidToint());
developer._reportTaskEvent = function(start, taskId, phase, category, name, argumentsAsJson) {
};
dart.fn(developer._reportTaskEvent, intAndintAndString__Tovoid());
developer._reportCompleteEvent = function(start, startCpu, category, name, argumentsAsJson) {
};
dart.fn(developer._reportCompleteEvent, intAndintAndString__Tovoid$());
developer._reportInstantEvent = function(start, category, name, argumentsAsJson) {
};
dart.fn(developer._reportInstantEvent, intAndStringAndString__Tovoid());
developer.ServiceProtocolInfo = class ServiceProtocolInfo extends core.Object {
new(serverUri) {
this.majorVersion = developer._getServiceMajorVersion();
this.minorVersion = developer._getServiceMinorVersion();
this.serverUri = serverUri;
}
toString() {
if (this.serverUri != null) {
return dart.str`Dart VM Service Protocol v${this.majorVersion}.${this.minorVersion} ` + dart.str`listening on ${this.serverUri}`;
} else {
return dart.str`Dart VM Service Protocol v${this.majorVersion}.${this.minorVersion}`;
}
}
};
dart.setSignature(developer.ServiceProtocolInfo, {
constructors: () => ({new: dart.definiteFunctionType(developer.ServiceProtocolInfo, [core.Uri])}),
fields: () => ({
majorVersion: core.int,
minorVersion: core.int,
serverUri: core.Uri
})
});
developer.Service = class Service extends core.Object {
static getInfo() {
return dart.async(function*() {
let receivePort = isolate.RawReceivePort.new();
let uriCompleter = CompleterOfUri().new();
receivePort.handler = dart.fn(uri => uriCompleter.complete(uri), UriTovoid());
developer._getServerInfo(receivePort.sendPort);
let uri = (yield uriCompleter.future);
receivePort.close();
return new developer.ServiceProtocolInfo(uri);
}, developer.ServiceProtocolInfo);
}
static controlWebServer(opts) {
return dart.async(function*(opts) {
let enable = opts && 'enable' in opts ? opts.enable : false;
if (!(typeof enable == 'boolean')) {
dart.throw(new core.ArgumentError.value(enable, 'enable', 'Must be a bool'));
}
let receivePort = isolate.RawReceivePort.new();
let uriCompleter = CompleterOfUri().new();
receivePort.handler = dart.fn(uri => uriCompleter.complete(uri), UriTovoid());
developer._webServerControl(receivePort.sendPort, enable);
let uri = (yield uriCompleter.future);
receivePort.close();
return new developer.ServiceProtocolInfo(uri);
}, developer.ServiceProtocolInfo, opts);
}
};
dart.setSignature(developer.Service, {
statics: () => ({
getInfo: dart.definiteFunctionType(async.Future$(developer.ServiceProtocolInfo), []),
controlWebServer: dart.definiteFunctionType(async.Future$(developer.ServiceProtocolInfo), [], {enable: core.bool})
}),
names: ['getInfo', 'controlWebServer']
});
developer._getServerInfo = function(sp) {
sp.send(null);
};
dart.lazyFn(developer._getServerInfo, () => SendPortTovoid());
developer._webServerControl = function(sp, enable) {
sp.send(null);
};
dart.lazyFn(developer._webServerControl, () => SendPortAndboolTovoid());
developer._getServiceMajorVersion = function() {
return 0;
};
dart.fn(developer._getServiceMajorVersion, VoidToint());
developer._getServiceMinorVersion = function() {
return 0;
};
dart.fn(developer._getServiceMinorVersion, VoidToint());
isolate.IsolateSpawnException = class IsolateSpawnException extends core.Object {
new(message) {
this.message = message;
@ -56952,19 +57708,19 @@
statics: () => ({createElement_tag: dart.definiteFunctionType(dart.dynamic, [core.String, core.String])}),
names: ['createElement_tag']
});
const _value$0 = Symbol('_value');
const _value$1 = Symbol('_value');
html$.ScrollAlignment = class ScrollAlignment extends core.Object {
_internal(value) {
this[_value$0] = value;
this[_value$1] = value;
}
toString() {
return dart.str`ScrollAlignment.${this[_value$0]}`;
return dart.str`ScrollAlignment.${this[_value$1]}`;
}
};
dart.defineNamedConstructor(html$.ScrollAlignment, '_internal');
dart.setSignature(html$.ScrollAlignment, {
constructors: () => ({_internal: dart.definiteFunctionType(html$.ScrollAlignment, [dart.dynamic])}),
fields: () => ({[_value$0]: dart.dynamic}),
fields: () => ({[_value$1]: dart.dynamic}),
sfields: () => ({
TOP: html$.ScrollAlignment,
CENTER: html$.ScrollAlignment,
@ -80225,43 +80981,43 @@
const _unit = Symbol('_unit');
html$.Dimension = class Dimension extends core.Object {
percent(value) {
this[_value$0] = value;
this[_value$1] = value;
this[_unit] = '%';
}
px(value) {
this[_value$0] = value;
this[_value$1] = value;
this[_unit] = 'px';
}
pc(value) {
this[_value$0] = value;
this[_value$1] = value;
this[_unit] = 'pc';
}
pt(value) {
this[_value$0] = value;
this[_value$1] = value;
this[_unit] = 'pt';
}
inch(value) {
this[_value$0] = value;
this[_value$1] = value;
this[_unit] = 'in';
}
cm(value) {
this[_value$0] = value;
this[_value$1] = value;
this[_unit] = 'cm';
}
mm(value) {
this[_value$0] = value;
this[_value$1] = value;
this[_unit] = 'mm';
}
em(value) {
this[_value$0] = value;
this[_value$1] = value;
this[_unit] = 'em';
}
ex(value) {
this[_value$0] = value;
this[_value$1] = value;
this[_unit] = 'ex';
}
css(cssValue) {
this[_value$0] = null;
this[_value$1] = null;
this[_unit] = null;
if (cssValue == '') cssValue = '0px';
if (dart.test(cssValue[dartx.endsWith]('%'))) {
@ -80270,16 +81026,16 @@
this[_unit] = cssValue[dartx.substring](dart.notNull(cssValue[dartx.length]) - 2);
}
if (dart.test(cssValue[dartx.contains]('.'))) {
this[_value$0] = core.double.parse(cssValue[dartx.substring](0, dart.notNull(cssValue[dartx.length]) - dart.notNull(this[_unit][dartx.length])));
this[_value$1] = core.double.parse(cssValue[dartx.substring](0, dart.notNull(cssValue[dartx.length]) - dart.notNull(this[_unit][dartx.length])));
} else {
this[_value$0] = core.int.parse(cssValue[dartx.substring](0, dart.notNull(cssValue[dartx.length]) - dart.notNull(this[_unit][dartx.length])));
this[_value$1] = core.int.parse(cssValue[dartx.substring](0, dart.notNull(cssValue[dartx.length]) - dart.notNull(this[_unit][dartx.length])));
}
}
toString() {
return dart.str`${this[_value$0]}${this[_unit]}`;
return dart.str`${this[_value$1]}${this[_unit]}`;
}
get value() {
return this[_value$0];
return this[_value$1];
}
};
dart.defineNamedConstructor(html$.Dimension, 'percent');
@ -80306,7 +81062,7 @@
css: dart.definiteFunctionType(html$.Dimension, [core.String])
}),
fields: () => ({
[_value$0]: core.num,
[_value$1]: core.num,
[_unit]: core.String
}),
getters: () => ({value: dart.definiteFunctionType(core.num, [])})
@ -94920,6 +95676,7 @@
exports.collection = collection;
exports.convert = convert;
exports.core = core;
exports.developer = developer;
exports.isolate = isolate;
exports.js = js;
exports.js_util = js_util;

View file

@ -15,6 +15,7 @@ export const async = Object.create(null);
export const collection = Object.create(null);
export const convert = Object.create(null);
export const core = Object.create(null);
export const developer = Object.create(null);
export const isolate = Object.create(null);
export const js = Object.create(null);
export const js_util = Object.create(null);
@ -374,6 +375,12 @@ let MapOfString$ListOfString = () => (MapOfString$ListOfString = dart.constFn(co
let MapOfString$String = () => (MapOfString$String = dart.constFn(core.Map$(core.String, core.String)))();
let IterableOfString = () => (IterableOfString = dart.constFn(core.Iterable$(core.String)))();
let MapOfString$dynamic = () => (MapOfString$dynamic = dart.constFn(core.Map$(core.String, dart.dynamic)))();
let MapOfString$ServiceExtensionHandler = () => (MapOfString$ServiceExtensionHandler = dart.constFn(core.Map$(core.String, developer.ServiceExtensionHandler)))();
let MapOfString$Metric = () => (MapOfString$Metric = dart.constFn(core.Map$(core.String, developer.Metric)))();
let ListOf_SyncBlock = () => (ListOf_SyncBlock = dart.constFn(core.List$(developer._SyncBlock)))();
let JSArrayOf_AsyncBlock = () => (JSArrayOf_AsyncBlock = dart.constFn(_interceptors.JSArray$(developer._AsyncBlock)))();
let ListOf_AsyncBlock = () => (ListOf_AsyncBlock = dart.constFn(core.List$(developer._AsyncBlock)))();
let CompleterOfUri = () => (CompleterOfUri = dart.constFn(async.Completer$(core.Uri)))();
let FutureOfIsolate = () => (FutureOfIsolate = dart.constFn(async.Future$(isolate.Isolate)))();
let JsArray = () => (JsArray = dart.constFn(js.JsArray$()))();
let ExpandoOfFunction = () => (ExpandoOfFunction = dart.constFn(core.Expando$(core.Function)))();
@ -681,6 +688,20 @@ let StringAnddynamicTovoid = () => (StringAnddynamicTovoid = dart.constFn(dart.d
let MapOfString$StringAndStringToMapOfString$String = () => (MapOfString$StringAndStringToMapOfString$String = dart.constFn(dart.definiteFunctionType(MapOfString$String(), [MapOfString$String(), core.String])))();
let intAndintAndintTovoid = () => (intAndintAndintTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.int, core.int, core.int])))();
let String__Tovoid = () => (String__Tovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.String], [dart.dynamic])))();
let __Tobool = () => (__Tobool = dart.constFn(dart.definiteFunctionType(core.bool, [], {when: core.bool, message: core.String})))();
let String__Tovoid = () => (String__Tovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.String], {time: core.DateTime, sequenceNumber: core.int, level: core.int, name: core.String, zone: async.Zone, error: core.Object, stackTrace: core.StackTrace})))();
let StringAndServiceExtensionHandlerTovoid = () => (StringAndServiceExtensionHandlerTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.String, developer.ServiceExtensionHandler])))();
let StringAndMapTovoid = () => (StringAndMapTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.String, core.Map])))();
let StringToServiceExtensionHandler = () => (StringToServiceExtensionHandler = dart.constFn(dart.definiteFunctionType(developer.ServiceExtensionHandler, [core.String])))();
let StringAndServiceExtensionHandlerTodynamic = () => (StringAndServiceExtensionHandlerTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [core.String, developer.ServiceExtensionHandler])))();
let VoidToUserTag = () => (VoidToUserTag = dart.constFn(dart.definiteFunctionType(developer.UserTag, [])))();
let MapToString = () => (MapToString = dart.constFn(dart.definiteFunctionType(core.String, [core.Map])))();
let intAndintAndString__Tovoid = () => (intAndintAndString__Tovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.int, core.int, core.String, core.String, core.String, core.String])))();
let intAndintAndString__Tovoid = () => (intAndintAndString__Tovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.int, core.int, core.String, core.String, core.String])))();
let intAndStringAndString__Tovoid = () => (intAndStringAndString__Tovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.int, core.String, core.String, core.String])))();
let UriTovoid = () => (UriTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.Uri])))();
let SendPortTovoid = () => (SendPortTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [isolate.SendPort])))();
let SendPortAndboolTovoid = () => (SendPortAndboolTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [isolate.SendPort, core.bool])))();
let ListToIsolate = () => (ListToIsolate = dart.constFn(dart.definiteFunctionType(isolate.Isolate, [core.List])))();
let dynamicTo_DartObject = () => (dynamicTo_DartObject = dart.constFn(dart.definiteFunctionType(js._DartObject, [dart.dynamic])))();
let dynamicToJsObject = () => (dynamicToJsObject = dart.constFn(dart.definiteFunctionType(js.JsObject, [dart.dynamic])))();
@ -36444,6 +36465,741 @@ dart.setSignature(core.UriData, {
core.UriData._noScheme = -1;
core.UriData._tokenCharTable = dart.constList([0, 0, 27858, 1023, 65534, 51199, 65535, 32767], core.int);
core.UriData._uricTable = core.Uri._queryCharTable;
developer.debugger = function(opts) {
let when = opts && 'when' in opts ? opts.when : true;
let message = opts && 'message' in opts ? opts.message : null;
if (dart.test(when)) {
debugger;
}
return when;
};
dart.fn(developer.debugger, __Tobool());
developer.inspect = function(object) {
return object;
};
dart.fn(developer.inspect, ObjectToObject());
developer.log = function(message, opts) {
let time = opts && 'time' in opts ? opts.time : null;
let sequenceNumber = opts && 'sequenceNumber' in opts ? opts.sequenceNumber : null;
let level = opts && 'level' in opts ? opts.level : 0;
let name = opts && 'name' in opts ? opts.name : '';
let zone = opts && 'zone' in opts ? opts.zone : null;
let error = opts && 'error' in opts ? opts.error : null;
let stackTrace = opts && 'stackTrace' in opts ? opts.stackTrace : null;
};
dart.fn(developer.log, String__Tovoid());
dart.defineLazy(developer, {
get _extensions() {
return MapOfString$ServiceExtensionHandler().new();
}
});
developer._clockValue = 0;
const _result = Symbol('_result');
const _errorCode = Symbol('_errorCode');
const _errorDetail = Symbol('_errorDetail');
const _isError = Symbol('_isError');
const _toString = Symbol('_toString');
developer.ServiceExtensionResponse = class ServiceExtensionResponse extends core.Object {
result(result) {
this[_result] = result;
this[_errorCode] = null;
this[_errorDetail] = null;
if (!(typeof this[_result] == 'string')) {
dart.throw(new core.ArgumentError.value(this[_result], "result", "Must be a String"));
}
}
error(errorCode, errorDetail) {
this[_result] = null;
this[_errorCode] = errorCode;
this[_errorDetail] = errorDetail;
developer.ServiceExtensionResponse._validateErrorCode(this[_errorCode]);
if (!(typeof this[_errorDetail] == 'string')) {
dart.throw(new core.ArgumentError.value(this[_errorDetail], "errorDetail", "Must be a String"));
}
}
static _errorCodeMessage(errorCode) {
developer.ServiceExtensionResponse._validateErrorCode(errorCode);
if (errorCode == developer.ServiceExtensionResponse.kInvalidParams) {
return "Invalid params";
}
return "Server error";
}
static _validateErrorCode(errorCode) {
if (!(typeof errorCode == 'number')) {
dart.throw(new core.ArgumentError.value(errorCode, "errorCode", "Must be an int"));
}
if (errorCode == developer.ServiceExtensionResponse.invalidParams) {
return;
}
if (dart.notNull(errorCode) >= developer.ServiceExtensionResponse.extensionErrorMin && dart.notNull(errorCode) <= developer.ServiceExtensionResponse.extensionErrorMax) {
return;
}
dart.throw(new core.ArgumentError.value(errorCode, "errorCode", "Out of range"));
}
[_isError]() {
return this[_errorCode] != null && this[_errorDetail] != null;
}
[_toString]() {
if (this[_result] != null) {
return this[_result];
} else {
dart.assert(this[_errorCode] != null);
dart.assert(this[_errorDetail] != null);
return convert.JSON.encode(dart.map({code: this[_errorCode], message: developer.ServiceExtensionResponse._errorCodeMessage(this[_errorCode]), data: dart.map({details: this[_errorDetail]}, core.String, core.String)}, core.String, core.Object));
}
}
};
dart.defineNamedConstructor(developer.ServiceExtensionResponse, 'result');
dart.defineNamedConstructor(developer.ServiceExtensionResponse, 'error');
dart.setSignature(developer.ServiceExtensionResponse, {
constructors: () => ({
result: dart.definiteFunctionType(developer.ServiceExtensionResponse, [core.String]),
error: dart.definiteFunctionType(developer.ServiceExtensionResponse, [core.int, core.String])
}),
fields: () => ({
[_result]: core.String,
[_errorCode]: core.int,
[_errorDetail]: core.String
}),
methods: () => ({
[_isError]: dart.definiteFunctionType(core.bool, []),
[_toString]: dart.definiteFunctionType(core.String, [])
}),
sfields: () => ({
kInvalidParams: core.int,
kExtensionError: core.int,
kExtensionErrorMax: core.int,
kExtensionErrorMin: core.int,
invalidParams: core.int,
extensionError: core.int,
extensionErrorMax: core.int,
extensionErrorMin: core.int
}),
statics: () => ({
_errorCodeMessage: dart.definiteFunctionType(core.String, [core.int]),
_validateErrorCode: dart.definiteFunctionType(dart.dynamic, [core.int])
}),
names: ['_errorCodeMessage', '_validateErrorCode']
});
developer.ServiceExtensionResponse.invalidParams = -32602;
developer.ServiceExtensionResponse.extensionError = -32000;
developer.ServiceExtensionResponse.extensionErrorMax = -32000;
developer.ServiceExtensionResponse.extensionErrorMin = -32016;
dart.defineLazy(developer.ServiceExtensionResponse, {
get kInvalidParams() {
return developer.ServiceExtensionResponse.invalidParams;
},
get kExtensionError() {
return developer.ServiceExtensionResponse.extensionError;
},
get kExtensionErrorMax() {
return developer.ServiceExtensionResponse.extensionErrorMax;
},
get kExtensionErrorMin() {
return developer.ServiceExtensionResponse.extensionErrorMin;
}
});
developer.ServiceExtensionHandler = dart.typedef('ServiceExtensionHandler', () => dart.functionType(async.Future$(developer.ServiceExtensionResponse), [core.String, MapOfString$String()]));
developer.registerExtension = function(method, handler) {
if (!(typeof method == 'string')) {
dart.throw(new core.ArgumentError.value(method, 'method', 'Must be a String'));
}
if (!dart.test(method[dartx.startsWith]('ext.'))) {
dart.throw(new core.ArgumentError.value(method, 'method', 'Must begin with ext.'));
}
if (developer._lookupExtension(method) != null) {
dart.throw(new core.ArgumentError(dart.str`Extension already registered: ${method}`));
}
if (!developer.ServiceExtensionHandler.is(handler)) {
dart.throw(new core.ArgumentError.value(handler, 'handler', 'Must be a ServiceExtensionHandler'));
}
developer._registerExtension(method, handler);
};
dart.fn(developer.registerExtension, StringAndServiceExtensionHandlerTovoid());
developer.postEvent = function(eventKind, eventData) {
if (!(typeof eventKind == 'string')) {
dart.throw(new core.ArgumentError.value(eventKind, 'eventKind', 'Must be a String'));
}
if (!core.Map.is(eventData)) {
dart.throw(new core.ArgumentError.value(eventData, 'eventData', 'Must be a Map'));
}
let eventDataAsString = convert.JSON.encode(eventData);
developer._postEvent(eventKind, eventDataAsString);
};
dart.fn(developer.postEvent, StringAndMapTovoid());
developer._postEvent = function(eventKind, eventData) {
};
dart.fn(developer._postEvent, StringAndStringTodynamic());
developer._lookupExtension = function(method) {
return developer._extensions[dartx._get](method);
};
dart.fn(developer._lookupExtension, StringToServiceExtensionHandler());
developer._registerExtension = function(method, handler) {
developer._extensions[dartx._set](method, handler);
};
dart.fn(developer._registerExtension, StringAndServiceExtensionHandlerTodynamic());
developer.UserTag = class UserTag extends core.Object {
static new(label) {
return developer._FakeUserTag.new(label);
}
static get defaultTag() {
return developer._FakeUserTag._defaultTag;
}
};
dart.setSignature(developer.UserTag, {
constructors: () => ({new: dart.definiteFunctionType(developer.UserTag, [core.String])}),
sfields: () => ({MAX_USER_TAGS: core.int}),
sgetters: () => ({defaultTag: dart.definiteFunctionType(developer.UserTag, [])})
});
developer.UserTag.MAX_USER_TAGS = 64;
developer._FakeUserTag = class _FakeUserTag extends core.Object {
real(label) {
this.label = label;
}
static new(label) {
let existingTag = developer._FakeUserTag._instances[dartx._get](label);
if (existingTag != null) {
return developer._FakeUserTag._check(existingTag);
}
if (developer._FakeUserTag._instances[dartx.length] == developer.UserTag.MAX_USER_TAGS) {
dart.throw(new core.UnsupportedError(dart.str`UserTag instance limit (${developer.UserTag.MAX_USER_TAGS}) reached.`));
}
let instance = new developer._FakeUserTag.real(label);
developer._FakeUserTag._instances[dartx._set](label, instance);
return instance;
}
makeCurrent() {
let old = developer._currentTag;
developer._currentTag = this;
return old;
}
};
dart.defineNamedConstructor(developer._FakeUserTag, 'real');
developer._FakeUserTag[dart.implements] = () => [developer.UserTag];
dart.setSignature(developer._FakeUserTag, {
constructors: () => ({
real: dart.definiteFunctionType(developer._FakeUserTag, [core.String]),
new: dart.definiteFunctionType(developer._FakeUserTag, [core.String])
}),
fields: () => ({label: core.String}),
methods: () => ({makeCurrent: dart.definiteFunctionType(developer.UserTag, [])}),
sfields: () => ({
_instances: core.Map,
_defaultTag: developer.UserTag
})
});
dart.defineLazy(developer._FakeUserTag, {
get _instances() {
return dart.map();
},
set _instances(_) {},
get _defaultTag() {
return developer._FakeUserTag.new('Default');
}
});
dart.defineLazy(developer, {
get _currentTag() {
return developer._FakeUserTag._defaultTag;
},
set _currentTag(_) {}
});
developer.getCurrentTag = function() {
return developer._currentTag;
};
dart.fn(developer.getCurrentTag, VoidToUserTag());
developer.Metric = class Metric extends core.Object {
new(name, description) {
this.name = name;
this.description = description;
if (this.name == 'vm' || dart.test(this.name[dartx.contains]('/'))) {
dart.throw(new core.ArgumentError('Invalid Metric name.'));
}
}
};
dart.setSignature(developer.Metric, {
constructors: () => ({new: dart.definiteFunctionType(developer.Metric, [core.String, core.String])}),
fields: () => ({
name: core.String,
description: core.String
})
});
const _value = Symbol('_value');
const _toJSON = Symbol('_toJSON');
developer.Gauge = class Gauge extends developer.Metric {
get value() {
return this[_value];
}
set value(v) {
if (dart.notNull(v) < dart.notNull(this.min)) {
v = this.min;
} else if (dart.notNull(v) > dart.notNull(this.max)) {
v = this.max;
}
this[_value] = v;
}
new(name, description, min, max) {
this.min = min;
this.max = max;
this[_value] = null;
super.new(name, description);
if (!(typeof this.min == 'number')) {
dart.throw(new core.ArgumentError('min must be a double'));
}
if (!(typeof this.max == 'number')) {
dart.throw(new core.ArgumentError('max must be a double'));
}
if (!(dart.notNull(this.min) < dart.notNull(this.max))) {
dart.throw(new core.ArgumentError('min must be less than max'));
}
this[_value] = this.min;
}
[_toJSON]() {
let map = dart.map({type: 'Gauge', id: dart.str`metrics/${this.name}`, name: this.name, description: this.description, value: this.value, min: this.min, max: this.max}, core.String, core.Object);
return map;
}
};
dart.setSignature(developer.Gauge, {
constructors: () => ({new: dart.definiteFunctionType(developer.Gauge, [core.String, core.String, core.double, core.double])}),
fields: () => ({
min: core.double,
max: core.double,
[_value]: core.double
}),
getters: () => ({value: dart.definiteFunctionType(core.double, [])}),
setters: () => ({value: dart.definiteFunctionType(dart.void, [core.double])}),
methods: () => ({[_toJSON]: dart.definiteFunctionType(core.Map, [])})
});
developer.Counter = class Counter extends developer.Metric {
new(name, description) {
this[_value] = 0.0;
super.new(name, description);
}
get value() {
return this[_value];
}
set value(v) {
this[_value] = v;
}
[_toJSON]() {
let map = dart.map({type: 'Counter', id: dart.str`metrics/${this.name}`, name: this.name, description: this.description, value: this.value}, core.String, core.Object);
return map;
}
};
dart.setSignature(developer.Counter, {
constructors: () => ({new: dart.definiteFunctionType(developer.Counter, [core.String, core.String])}),
fields: () => ({[_value]: core.double}),
getters: () => ({value: dart.definiteFunctionType(core.double, [])}),
setters: () => ({value: dart.definiteFunctionType(dart.void, [core.double])}),
methods: () => ({[_toJSON]: dart.definiteFunctionType(core.Map, [])})
});
developer.Metrics = class Metrics extends core.Object {
static register(metric) {
if (!developer.Metric.is(metric)) {
dart.throw(new core.ArgumentError('metric must be a Metric'));
}
if (developer.Metrics._metrics[dartx._get](metric.name) != null) {
dart.throw(new core.ArgumentError('Registered metrics have unique names'));
}
developer.Metrics._metrics[dartx._set](metric.name, metric);
}
static deregister(metric) {
if (!developer.Metric.is(metric)) {
dart.throw(new core.ArgumentError('metric must be a Metric'));
}
developer.Metrics._metrics[dartx.remove](metric.name);
}
static _printMetric(id) {
let metric = developer.Metrics._metrics[dartx._get](id);
if (metric == null) {
return null;
}
return convert.JSON.encode(metric[_toJSON]());
}
static _printMetrics() {
let metrics = [];
for (let metric of developer.Metrics._metrics[dartx.values]) {
metrics[dartx.add](metric[_toJSON]());
}
let map = dart.map({type: 'MetricList', metrics: metrics}, core.String, core.Object);
return convert.JSON.encode(map);
}
};
dart.setSignature(developer.Metrics, {
sfields: () => ({_metrics: MapOfString$Metric()}),
statics: () => ({
register: dart.definiteFunctionType(dart.void, [developer.Metric]),
deregister: dart.definiteFunctionType(dart.void, [developer.Metric]),
_printMetric: dart.definiteFunctionType(core.String, [core.String]),
_printMetrics: dart.definiteFunctionType(core.String, [])
}),
names: ['register', 'deregister', '_printMetric', '_printMetrics']
});
dart.defineLazy(developer.Metrics, {
get _metrics() {
return MapOfString$Metric().new();
}
});
developer._isProduct = false;
developer.TimelineSyncFunction = dart.typedef('TimelineSyncFunction', () => dart.functionType(dart.dynamic, []));
developer.TimelineAsyncFunction = dart.typedef('TimelineAsyncFunction', () => dart.functionType(async.Future, []));
const _appendArguments = Symbol('_appendArguments');
developer.Timeline = class Timeline extends core.Object {
static startSync(name, opts) {
let arguments$ = opts && 'arguments' in opts ? opts.arguments : null;
if (developer._isProduct) {
return;
}
if (!(typeof name == 'string')) {
dart.throw(new core.ArgumentError.value(name, 'name', 'Must be a String'));
}
if (!dart.test(developer._isDartStreamEnabled())) {
developer.Timeline._stack[dartx.add](null);
return;
}
let block = new developer._SyncBlock._(name, developer._getTraceClock(), developer._getThreadCpuClock());
if (core.Map.is(arguments$)) {
block[_appendArguments](arguments$);
}
developer.Timeline._stack[dartx.add](block);
}
static finishSync() {
if (developer._isProduct) {
return;
}
if (developer.Timeline._stack[dartx.length] == 0) {
dart.throw(new core.StateError('Uneven calls to startSync and finishSync'));
}
let block = developer.Timeline._stack[dartx.removeLast]();
if (block == null) {
return;
}
block.finish();
}
static instantSync(name, opts) {
let arguments$ = opts && 'arguments' in opts ? opts.arguments : null;
if (developer._isProduct) {
return;
}
if (!(typeof name == 'string')) {
dart.throw(new core.ArgumentError.value(name, 'name', 'Must be a String'));
}
if (!dart.test(developer._isDartStreamEnabled())) {
return;
}
let instantArguments = null;
if (core.Map.is(arguments$)) {
instantArguments = core.Map.from(arguments$);
}
developer._reportInstantEvent(developer._getTraceClock(), 'Dart', name, developer._argumentsAsJson(instantArguments));
}
static timeSync(name, func, opts) {
let arguments$ = opts && 'arguments' in opts ? opts.arguments : null;
developer.Timeline.startSync(name, {arguments: arguments$});
try {
return func();
} finally {
developer.Timeline.finishSync();
}
}
static get now() {
return developer._getTraceClock();
}
};
dart.setSignature(developer.Timeline, {
sfields: () => ({
_stack: ListOf_SyncBlock(),
_isolateId: core.int,
_isolateIdString: core.String
}),
sgetters: () => ({now: dart.definiteFunctionType(core.int, [])}),
statics: () => ({
startSync: dart.definiteFunctionType(dart.void, [core.String], {arguments: core.Map}),
finishSync: dart.definiteFunctionType(dart.void, []),
instantSync: dart.definiteFunctionType(dart.void, [core.String], {arguments: core.Map}),
timeSync: dart.definiteFunctionType(dart.dynamic, [core.String, developer.TimelineSyncFunction], {arguments: core.Map})
}),
names: ['startSync', 'finishSync', 'instantSync', 'timeSync']
});
dart.defineLazy(developer.Timeline, {
get _stack() {
return ListOf_SyncBlock().new();
},
get _isolateId() {
return developer._getIsolateNum();
},
get _isolateIdString() {
return dart.toString(developer.Timeline._isolateId);
}
});
const _stack = Symbol('_stack');
const _taskId = Symbol('_taskId');
const _start = Symbol('_start');
const _finish = Symbol('_finish');
developer.TimelineTask = class TimelineTask extends core.Object {
new() {
this[_stack] = JSArrayOf_AsyncBlock().of([]);
this[_taskId] = developer._getNextAsyncId();
}
withTaskId(taskId) {
this[_stack] = JSArrayOf_AsyncBlock().of([]);
this[_taskId] = taskId;
if (!(typeof taskId == 'number')) {
dart.throw(new core.ArgumentError.value(taskId, 'taskId', 'Must be an int'));
}
}
start(name, opts) {
let arguments$ = opts && 'arguments' in opts ? opts.arguments : null;
if (developer._isProduct) {
return;
}
if (!(typeof name == 'string')) {
dart.throw(new core.ArgumentError.value(name, 'name', 'Must be a String'));
}
let block = new developer._AsyncBlock._(name, this[_taskId]);
if (core.Map.is(arguments$)) {
block[_appendArguments](arguments$);
}
this[_stack][dartx.add](block);
block[_start]();
}
instant(name, opts) {
let arguments$ = opts && 'arguments' in opts ? opts.arguments : null;
if (developer._isProduct) {
return;
}
if (!(typeof name == 'string')) {
dart.throw(new core.ArgumentError.value(name, 'name', 'Must be a String'));
}
let instantArguments = null;
if (core.Map.is(arguments$)) {
instantArguments = core.Map.from(arguments$);
}
developer._reportTaskEvent(developer._getTraceClock(), this[_taskId], 'n', 'Dart', name, developer._argumentsAsJson(instantArguments));
}
finish() {
if (developer._isProduct) {
return;
}
if (this[_stack][dartx.length] == 0) {
dart.throw(new core.StateError('Uneven calls to start and finish'));
}
let block = this[_stack][dartx.removeLast]();
block[_finish]();
}
pass() {
if (dart.notNull(this[_stack][dartx.length]) > 0) {
dart.throw(new core.StateError('You cannot pass a TimelineTask without finishing all started ' + 'operations'));
}
let r = this[_taskId];
return r;
}
};
dart.defineNamedConstructor(developer.TimelineTask, 'withTaskId');
dart.setSignature(developer.TimelineTask, {
constructors: () => ({
new: dart.definiteFunctionType(developer.TimelineTask, []),
withTaskId: dart.definiteFunctionType(developer.TimelineTask, [core.int])
}),
fields: () => ({
[_taskId]: core.int,
[_stack]: ListOf_AsyncBlock()
}),
methods: () => ({
start: dart.definiteFunctionType(dart.void, [core.String], {arguments: core.Map}),
instant: dart.definiteFunctionType(dart.void, [core.String], {arguments: core.Map}),
finish: dart.definiteFunctionType(dart.void, []),
pass: dart.definiteFunctionType(core.int, [])
})
});
const _arguments = Symbol('_arguments');
developer._AsyncBlock = class _AsyncBlock extends core.Object {
_(name, taskId) {
this.name = name;
this[_taskId] = taskId;
this.category = 'Dart';
this[_arguments] = null;
}
[_start]() {
developer._reportTaskEvent(developer._getTraceClock(), this[_taskId], 'b', this.category, this.name, developer._argumentsAsJson(this[_arguments]));
}
[_finish]() {
developer._reportTaskEvent(developer._getTraceClock(), this[_taskId], 'e', this.category, this.name, developer._argumentsAsJson(null));
}
[_appendArguments](arguments$) {
if (this[_arguments] == null) {
this[_arguments] = dart.map();
}
this[_arguments][dartx.addAll](arguments$);
}
};
dart.defineNamedConstructor(developer._AsyncBlock, '_');
dart.setSignature(developer._AsyncBlock, {
constructors: () => ({_: dart.definiteFunctionType(developer._AsyncBlock, [core.String, core.int])}),
fields: () => ({
category: core.String,
name: core.String,
[_taskId]: core.int,
[_arguments]: core.Map
}),
methods: () => ({
[_start]: dart.definiteFunctionType(dart.void, []),
[_finish]: dart.definiteFunctionType(dart.void, []),
[_appendArguments]: dart.definiteFunctionType(dart.void, [core.Map])
})
});
const _startCpu = Symbol('_startCpu');
developer._SyncBlock = class _SyncBlock extends core.Object {
_(name, start, startCpu) {
this.name = name;
this[_start] = start;
this[_startCpu] = startCpu;
this.category = 'Dart';
this[_arguments] = null;
}
finish() {
developer._reportCompleteEvent(this[_start], this[_startCpu], this.category, this.name, developer._argumentsAsJson(this[_arguments]));
}
[_appendArguments](arguments$) {
if (arguments$ == null) {
return;
}
if (this[_arguments] == null) {
this[_arguments] = dart.map();
}
this[_arguments][dartx.addAll](arguments$);
}
};
dart.defineNamedConstructor(developer._SyncBlock, '_');
dart.setSignature(developer._SyncBlock, {
constructors: () => ({_: dart.definiteFunctionType(developer._SyncBlock, [core.String, core.int, core.int])}),
fields: () => ({
category: core.String,
name: core.String,
[_arguments]: core.Map,
[_start]: core.int,
[_startCpu]: core.int
}),
methods: () => ({
finish: dart.definiteFunctionType(dart.void, []),
[_appendArguments]: dart.definiteFunctionType(dart.void, [core.Map])
})
});
developer._fastPathArguments = null;
developer._argumentsAsJson = function(arguments$) {
if (arguments$ == null || arguments$[dartx.length] == 0) {
if (developer._fastPathArguments == null) {
developer._fastPathArguments = dart.str`{"isolateNumber":"${developer.Timeline._isolateId}"}`;
}
return developer._fastPathArguments;
}
arguments$[dartx._set]('isolateNumber', developer.Timeline._isolateIdString);
return convert.JSON.encode(arguments$);
};
dart.fn(developer._argumentsAsJson, MapToString());
developer._isDartStreamEnabled = function() {
return false;
};
dart.fn(developer._isDartStreamEnabled, VoidTobool());
developer._getNextAsyncId = function() {
return 0;
};
dart.fn(developer._getNextAsyncId, VoidToint());
developer._getTraceClock = function() {
let x = developer._clockValue;
developer._clockValue = dart.notNull(x) + 1;
return x;
};
dart.fn(developer._getTraceClock, VoidToint());
developer._getThreadCpuClock = function() {
return -1;
};
dart.fn(developer._getThreadCpuClock, VoidToint());
developer._getIsolateNum = function() {
return 0;
};
dart.fn(developer._getIsolateNum, VoidToint());
developer._reportTaskEvent = function(start, taskId, phase, category, name, argumentsAsJson) {
};
dart.fn(developer._reportTaskEvent, intAndintAndString__Tovoid());
developer._reportCompleteEvent = function(start, startCpu, category, name, argumentsAsJson) {
};
dart.fn(developer._reportCompleteEvent, intAndintAndString__Tovoid());
developer._reportInstantEvent = function(start, category, name, argumentsAsJson) {
};
dart.fn(developer._reportInstantEvent, intAndStringAndString__Tovoid());
developer.ServiceProtocolInfo = class ServiceProtocolInfo extends core.Object {
new(serverUri) {
this.majorVersion = developer._getServiceMajorVersion();
this.minorVersion = developer._getServiceMinorVersion();
this.serverUri = serverUri;
}
toString() {
if (this.serverUri != null) {
return dart.str`Dart VM Service Protocol v${this.majorVersion}.${this.minorVersion} ` + dart.str`listening on ${this.serverUri}`;
} else {
return dart.str`Dart VM Service Protocol v${this.majorVersion}.${this.minorVersion}`;
}
}
};
dart.setSignature(developer.ServiceProtocolInfo, {
constructors: () => ({new: dart.definiteFunctionType(developer.ServiceProtocolInfo, [core.Uri])}),
fields: () => ({
majorVersion: core.int,
minorVersion: core.int,
serverUri: core.Uri
})
});
developer.Service = class Service extends core.Object {
static getInfo() {
return dart.async(function*() {
let receivePort = isolate.RawReceivePort.new();
let uriCompleter = CompleterOfUri().new();
receivePort.handler = dart.fn(uri => uriCompleter.complete(uri), UriTovoid());
developer._getServerInfo(receivePort.sendPort);
let uri = (yield uriCompleter.future);
receivePort.close();
return new developer.ServiceProtocolInfo(uri);
}, developer.ServiceProtocolInfo);
}
static controlWebServer(opts) {
return dart.async(function*(opts) {
let enable = opts && 'enable' in opts ? opts.enable : false;
if (!(typeof enable == 'boolean')) {
dart.throw(new core.ArgumentError.value(enable, 'enable', 'Must be a bool'));
}
let receivePort = isolate.RawReceivePort.new();
let uriCompleter = CompleterOfUri().new();
receivePort.handler = dart.fn(uri => uriCompleter.complete(uri), UriTovoid());
developer._webServerControl(receivePort.sendPort, enable);
let uri = (yield uriCompleter.future);
receivePort.close();
return new developer.ServiceProtocolInfo(uri);
}, developer.ServiceProtocolInfo, opts);
}
};
dart.setSignature(developer.Service, {
statics: () => ({
getInfo: dart.definiteFunctionType(async.Future$(developer.ServiceProtocolInfo), []),
controlWebServer: dart.definiteFunctionType(async.Future$(developer.ServiceProtocolInfo), [], {enable: core.bool})
}),
names: ['getInfo', 'controlWebServer']
});
developer._getServerInfo = function(sp) {
sp.send(null);
};
dart.lazyFn(developer._getServerInfo, () => SendPortTovoid());
developer._webServerControl = function(sp, enable) {
sp.send(null);
};
dart.lazyFn(developer._webServerControl, () => SendPortAndboolTovoid());
developer._getServiceMajorVersion = function() {
return 0;
};
dart.fn(developer._getServiceMajorVersion, VoidToint());
developer._getServiceMinorVersion = function() {
return 0;
};
dart.fn(developer._getServiceMinorVersion, VoidToint());
isolate.IsolateSpawnException = class IsolateSpawnException extends core.Object {
new(message) {
this.message = message;

View file

@ -18,6 +18,7 @@ dart_library.library('dart_sdk', null, /* Imports */[
const collection = Object.create(null);
const convert = Object.create(null);
const core = Object.create(null);
const developer = Object.create(null);
const isolate = Object.create(null);
const js = Object.create(null);
const js_util = Object.create(null);
@ -377,6 +378,12 @@ dart_library.library('dart_sdk', null, /* Imports */[
let MapOfString$String = () => (MapOfString$String = dart.constFn(core.Map$(core.String, core.String)))();
let IterableOfString = () => (IterableOfString = dart.constFn(core.Iterable$(core.String)))();
let MapOfString$dynamic = () => (MapOfString$dynamic = dart.constFn(core.Map$(core.String, dart.dynamic)))();
let MapOfString$ServiceExtensionHandler = () => (MapOfString$ServiceExtensionHandler = dart.constFn(core.Map$(core.String, developer.ServiceExtensionHandler)))();
let MapOfString$Metric = () => (MapOfString$Metric = dart.constFn(core.Map$(core.String, developer.Metric)))();
let ListOf_SyncBlock = () => (ListOf_SyncBlock = dart.constFn(core.List$(developer._SyncBlock)))();
let JSArrayOf_AsyncBlock = () => (JSArrayOf_AsyncBlock = dart.constFn(_interceptors.JSArray$(developer._AsyncBlock)))();
let ListOf_AsyncBlock = () => (ListOf_AsyncBlock = dart.constFn(core.List$(developer._AsyncBlock)))();
let CompleterOfUri = () => (CompleterOfUri = dart.constFn(async.Completer$(core.Uri)))();
let FutureOfIsolate = () => (FutureOfIsolate = dart.constFn(async.Future$(isolate.Isolate)))();
let JsArray = () => (JsArray = dart.constFn(js.JsArray$()))();
let ExpandoOfFunction = () => (ExpandoOfFunction = dart.constFn(core.Expando$(core.Function)))();
@ -684,6 +691,20 @@ dart_library.library('dart_sdk', null, /* Imports */[
let MapOfString$StringAndStringToMapOfString$String = () => (MapOfString$StringAndStringToMapOfString$String = dart.constFn(dart.definiteFunctionType(MapOfString$String(), [MapOfString$String(), core.String])))();
let intAndintAndintTovoid = () => (intAndintAndintTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.int, core.int, core.int])))();
let String__Tovoid = () => (String__Tovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.String], [dart.dynamic])))();
let __Tobool = () => (__Tobool = dart.constFn(dart.definiteFunctionType(core.bool, [], {when: core.bool, message: core.String})))();
let String__Tovoid$ = () => (String__Tovoid$ = dart.constFn(dart.definiteFunctionType(dart.void, [core.String], {time: core.DateTime, sequenceNumber: core.int, level: core.int, name: core.String, zone: async.Zone, error: core.Object, stackTrace: core.StackTrace})))();
let StringAndServiceExtensionHandlerTovoid = () => (StringAndServiceExtensionHandlerTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.String, developer.ServiceExtensionHandler])))();
let StringAndMapTovoid = () => (StringAndMapTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.String, core.Map])))();
let StringToServiceExtensionHandler = () => (StringToServiceExtensionHandler = dart.constFn(dart.definiteFunctionType(developer.ServiceExtensionHandler, [core.String])))();
let StringAndServiceExtensionHandlerTodynamic = () => (StringAndServiceExtensionHandlerTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [core.String, developer.ServiceExtensionHandler])))();
let VoidToUserTag = () => (VoidToUserTag = dart.constFn(dart.definiteFunctionType(developer.UserTag, [])))();
let MapToString = () => (MapToString = dart.constFn(dart.definiteFunctionType(core.String, [core.Map])))();
let intAndintAndString__Tovoid = () => (intAndintAndString__Tovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.int, core.int, core.String, core.String, core.String, core.String])))();
let intAndintAndString__Tovoid$ = () => (intAndintAndString__Tovoid$ = dart.constFn(dart.definiteFunctionType(dart.void, [core.int, core.int, core.String, core.String, core.String])))();
let intAndStringAndString__Tovoid = () => (intAndStringAndString__Tovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.int, core.String, core.String, core.String])))();
let UriTovoid = () => (UriTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.Uri])))();
let SendPortTovoid = () => (SendPortTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [isolate.SendPort])))();
let SendPortAndboolTovoid = () => (SendPortAndboolTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [isolate.SendPort, core.bool])))();
let ListToIsolate = () => (ListToIsolate = dart.constFn(dart.definiteFunctionType(isolate.Isolate, [core.List])))();
let dynamicTo_DartObject = () => (dynamicTo_DartObject = dart.constFn(dart.definiteFunctionType(js._DartObject, [dart.dynamic])))();
let dynamicToJsObject = () => (dynamicToJsObject = dart.constFn(dart.definiteFunctionType(js.JsObject, [dart.dynamic])))();
@ -36447,6 +36468,741 @@ dart_library.library('dart_sdk', null, /* Imports */[
core.UriData._noScheme = -1;
core.UriData._tokenCharTable = dart.constList([0, 0, 27858, 1023, 65534, 51199, 65535, 32767], core.int);
core.UriData._uricTable = core.Uri._queryCharTable;
developer.debugger = function(opts) {
let when = opts && 'when' in opts ? opts.when : true;
let message = opts && 'message' in opts ? opts.message : null;
if (dart.test(when)) {
debugger;
}
return when;
};
dart.fn(developer.debugger, __Tobool());
developer.inspect = function(object) {
return object;
};
dart.fn(developer.inspect, ObjectToObject());
developer.log = function(message, opts) {
let time = opts && 'time' in opts ? opts.time : null;
let sequenceNumber = opts && 'sequenceNumber' in opts ? opts.sequenceNumber : null;
let level = opts && 'level' in opts ? opts.level : 0;
let name = opts && 'name' in opts ? opts.name : '';
let zone = opts && 'zone' in opts ? opts.zone : null;
let error = opts && 'error' in opts ? opts.error : null;
let stackTrace = opts && 'stackTrace' in opts ? opts.stackTrace : null;
};
dart.fn(developer.log, String__Tovoid$());
dart.defineLazy(developer, {
get _extensions() {
return MapOfString$ServiceExtensionHandler().new();
}
});
developer._clockValue = 0;
const _result = Symbol('_result');
const _errorCode = Symbol('_errorCode');
const _errorDetail = Symbol('_errorDetail');
const _isError = Symbol('_isError');
const _toString = Symbol('_toString');
developer.ServiceExtensionResponse = class ServiceExtensionResponse extends core.Object {
result(result) {
this[_result] = result;
this[_errorCode] = null;
this[_errorDetail] = null;
if (!(typeof this[_result] == 'string')) {
dart.throw(new core.ArgumentError.value(this[_result], "result", "Must be a String"));
}
}
error(errorCode, errorDetail) {
this[_result] = null;
this[_errorCode] = errorCode;
this[_errorDetail] = errorDetail;
developer.ServiceExtensionResponse._validateErrorCode(this[_errorCode]);
if (!(typeof this[_errorDetail] == 'string')) {
dart.throw(new core.ArgumentError.value(this[_errorDetail], "errorDetail", "Must be a String"));
}
}
static _errorCodeMessage(errorCode) {
developer.ServiceExtensionResponse._validateErrorCode(errorCode);
if (errorCode == developer.ServiceExtensionResponse.kInvalidParams) {
return "Invalid params";
}
return "Server error";
}
static _validateErrorCode(errorCode) {
if (!(typeof errorCode == 'number')) {
dart.throw(new core.ArgumentError.value(errorCode, "errorCode", "Must be an int"));
}
if (errorCode == developer.ServiceExtensionResponse.invalidParams) {
return;
}
if (dart.notNull(errorCode) >= developer.ServiceExtensionResponse.extensionErrorMin && dart.notNull(errorCode) <= developer.ServiceExtensionResponse.extensionErrorMax) {
return;
}
dart.throw(new core.ArgumentError.value(errorCode, "errorCode", "Out of range"));
}
[_isError]() {
return this[_errorCode] != null && this[_errorDetail] != null;
}
[_toString]() {
if (this[_result] != null) {
return this[_result];
} else {
dart.assert(this[_errorCode] != null);
dart.assert(this[_errorDetail] != null);
return convert.JSON.encode(dart.map({code: this[_errorCode], message: developer.ServiceExtensionResponse._errorCodeMessage(this[_errorCode]), data: dart.map({details: this[_errorDetail]}, core.String, core.String)}, core.String, core.Object));
}
}
};
dart.defineNamedConstructor(developer.ServiceExtensionResponse, 'result');
dart.defineNamedConstructor(developer.ServiceExtensionResponse, 'error');
dart.setSignature(developer.ServiceExtensionResponse, {
constructors: () => ({
result: dart.definiteFunctionType(developer.ServiceExtensionResponse, [core.String]),
error: dart.definiteFunctionType(developer.ServiceExtensionResponse, [core.int, core.String])
}),
fields: () => ({
[_result]: core.String,
[_errorCode]: core.int,
[_errorDetail]: core.String
}),
methods: () => ({
[_isError]: dart.definiteFunctionType(core.bool, []),
[_toString]: dart.definiteFunctionType(core.String, [])
}),
sfields: () => ({
kInvalidParams: core.int,
kExtensionError: core.int,
kExtensionErrorMax: core.int,
kExtensionErrorMin: core.int,
invalidParams: core.int,
extensionError: core.int,
extensionErrorMax: core.int,
extensionErrorMin: core.int
}),
statics: () => ({
_errorCodeMessage: dart.definiteFunctionType(core.String, [core.int]),
_validateErrorCode: dart.definiteFunctionType(dart.dynamic, [core.int])
}),
names: ['_errorCodeMessage', '_validateErrorCode']
});
developer.ServiceExtensionResponse.invalidParams = -32602;
developer.ServiceExtensionResponse.extensionError = -32000;
developer.ServiceExtensionResponse.extensionErrorMax = -32000;
developer.ServiceExtensionResponse.extensionErrorMin = -32016;
dart.defineLazy(developer.ServiceExtensionResponse, {
get kInvalidParams() {
return developer.ServiceExtensionResponse.invalidParams;
},
get kExtensionError() {
return developer.ServiceExtensionResponse.extensionError;
},
get kExtensionErrorMax() {
return developer.ServiceExtensionResponse.extensionErrorMax;
},
get kExtensionErrorMin() {
return developer.ServiceExtensionResponse.extensionErrorMin;
}
});
developer.ServiceExtensionHandler = dart.typedef('ServiceExtensionHandler', () => dart.functionType(async.Future$(developer.ServiceExtensionResponse), [core.String, MapOfString$String()]));
developer.registerExtension = function(method, handler) {
if (!(typeof method == 'string')) {
dart.throw(new core.ArgumentError.value(method, 'method', 'Must be a String'));
}
if (!dart.test(method[dartx.startsWith]('ext.'))) {
dart.throw(new core.ArgumentError.value(method, 'method', 'Must begin with ext.'));
}
if (developer._lookupExtension(method) != null) {
dart.throw(new core.ArgumentError(dart.str`Extension already registered: ${method}`));
}
if (!developer.ServiceExtensionHandler.is(handler)) {
dart.throw(new core.ArgumentError.value(handler, 'handler', 'Must be a ServiceExtensionHandler'));
}
developer._registerExtension(method, handler);
};
dart.fn(developer.registerExtension, StringAndServiceExtensionHandlerTovoid());
developer.postEvent = function(eventKind, eventData) {
if (!(typeof eventKind == 'string')) {
dart.throw(new core.ArgumentError.value(eventKind, 'eventKind', 'Must be a String'));
}
if (!core.Map.is(eventData)) {
dart.throw(new core.ArgumentError.value(eventData, 'eventData', 'Must be a Map'));
}
let eventDataAsString = convert.JSON.encode(eventData);
developer._postEvent(eventKind, eventDataAsString);
};
dart.fn(developer.postEvent, StringAndMapTovoid());
developer._postEvent = function(eventKind, eventData) {
};
dart.fn(developer._postEvent, StringAndStringTodynamic());
developer._lookupExtension = function(method) {
return developer._extensions[dartx._get](method);
};
dart.fn(developer._lookupExtension, StringToServiceExtensionHandler());
developer._registerExtension = function(method, handler) {
developer._extensions[dartx._set](method, handler);
};
dart.fn(developer._registerExtension, StringAndServiceExtensionHandlerTodynamic());
developer.UserTag = class UserTag extends core.Object {
static new(label) {
return developer._FakeUserTag.new(label);
}
static get defaultTag() {
return developer._FakeUserTag._defaultTag;
}
};
dart.setSignature(developer.UserTag, {
constructors: () => ({new: dart.definiteFunctionType(developer.UserTag, [core.String])}),
sfields: () => ({MAX_USER_TAGS: core.int}),
sgetters: () => ({defaultTag: dart.definiteFunctionType(developer.UserTag, [])})
});
developer.UserTag.MAX_USER_TAGS = 64;
developer._FakeUserTag = class _FakeUserTag extends core.Object {
real(label) {
this.label = label;
}
static new(label) {
let existingTag = developer._FakeUserTag._instances[dartx._get](label);
if (existingTag != null) {
return developer._FakeUserTag._check(existingTag);
}
if (developer._FakeUserTag._instances[dartx.length] == developer.UserTag.MAX_USER_TAGS) {
dart.throw(new core.UnsupportedError(dart.str`UserTag instance limit (${developer.UserTag.MAX_USER_TAGS}) reached.`));
}
let instance = new developer._FakeUserTag.real(label);
developer._FakeUserTag._instances[dartx._set](label, instance);
return instance;
}
makeCurrent() {
let old = developer._currentTag;
developer._currentTag = this;
return old;
}
};
dart.defineNamedConstructor(developer._FakeUserTag, 'real');
developer._FakeUserTag[dart.implements] = () => [developer.UserTag];
dart.setSignature(developer._FakeUserTag, {
constructors: () => ({
real: dart.definiteFunctionType(developer._FakeUserTag, [core.String]),
new: dart.definiteFunctionType(developer._FakeUserTag, [core.String])
}),
fields: () => ({label: core.String}),
methods: () => ({makeCurrent: dart.definiteFunctionType(developer.UserTag, [])}),
sfields: () => ({
_instances: core.Map,
_defaultTag: developer.UserTag
})
});
dart.defineLazy(developer._FakeUserTag, {
get _instances() {
return dart.map();
},
set _instances(_) {},
get _defaultTag() {
return developer._FakeUserTag.new('Default');
}
});
dart.defineLazy(developer, {
get _currentTag() {
return developer._FakeUserTag._defaultTag;
},
set _currentTag(_) {}
});
developer.getCurrentTag = function() {
return developer._currentTag;
};
dart.fn(developer.getCurrentTag, VoidToUserTag());
developer.Metric = class Metric extends core.Object {
new(name, description) {
this.name = name;
this.description = description;
if (this.name == 'vm' || dart.test(this.name[dartx.contains]('/'))) {
dart.throw(new core.ArgumentError('Invalid Metric name.'));
}
}
};
dart.setSignature(developer.Metric, {
constructors: () => ({new: dart.definiteFunctionType(developer.Metric, [core.String, core.String])}),
fields: () => ({
name: core.String,
description: core.String
})
});
const _value$0 = Symbol('_value');
const _toJSON = Symbol('_toJSON');
developer.Gauge = class Gauge extends developer.Metric {
get value() {
return this[_value$0];
}
set value(v) {
if (dart.notNull(v) < dart.notNull(this.min)) {
v = this.min;
} else if (dart.notNull(v) > dart.notNull(this.max)) {
v = this.max;
}
this[_value$0] = v;
}
new(name, description, min, max) {
this.min = min;
this.max = max;
this[_value$0] = null;
super.new(name, description);
if (!(typeof this.min == 'number')) {
dart.throw(new core.ArgumentError('min must be a double'));
}
if (!(typeof this.max == 'number')) {
dart.throw(new core.ArgumentError('max must be a double'));
}
if (!(dart.notNull(this.min) < dart.notNull(this.max))) {
dart.throw(new core.ArgumentError('min must be less than max'));
}
this[_value$0] = this.min;
}
[_toJSON]() {
let map = dart.map({type: 'Gauge', id: dart.str`metrics/${this.name}`, name: this.name, description: this.description, value: this.value, min: this.min, max: this.max}, core.String, core.Object);
return map;
}
};
dart.setSignature(developer.Gauge, {
constructors: () => ({new: dart.definiteFunctionType(developer.Gauge, [core.String, core.String, core.double, core.double])}),
fields: () => ({
min: core.double,
max: core.double,
[_value$0]: core.double
}),
getters: () => ({value: dart.definiteFunctionType(core.double, [])}),
setters: () => ({value: dart.definiteFunctionType(dart.void, [core.double])}),
methods: () => ({[_toJSON]: dart.definiteFunctionType(core.Map, [])})
});
developer.Counter = class Counter extends developer.Metric {
new(name, description) {
this[_value$0] = 0.0;
super.new(name, description);
}
get value() {
return this[_value$0];
}
set value(v) {
this[_value$0] = v;
}
[_toJSON]() {
let map = dart.map({type: 'Counter', id: dart.str`metrics/${this.name}`, name: this.name, description: this.description, value: this.value}, core.String, core.Object);
return map;
}
};
dart.setSignature(developer.Counter, {
constructors: () => ({new: dart.definiteFunctionType(developer.Counter, [core.String, core.String])}),
fields: () => ({[_value$0]: core.double}),
getters: () => ({value: dart.definiteFunctionType(core.double, [])}),
setters: () => ({value: dart.definiteFunctionType(dart.void, [core.double])}),
methods: () => ({[_toJSON]: dart.definiteFunctionType(core.Map, [])})
});
developer.Metrics = class Metrics extends core.Object {
static register(metric) {
if (!developer.Metric.is(metric)) {
dart.throw(new core.ArgumentError('metric must be a Metric'));
}
if (developer.Metrics._metrics[dartx._get](metric.name) != null) {
dart.throw(new core.ArgumentError('Registered metrics have unique names'));
}
developer.Metrics._metrics[dartx._set](metric.name, metric);
}
static deregister(metric) {
if (!developer.Metric.is(metric)) {
dart.throw(new core.ArgumentError('metric must be a Metric'));
}
developer.Metrics._metrics[dartx.remove](metric.name);
}
static _printMetric(id) {
let metric = developer.Metrics._metrics[dartx._get](id);
if (metric == null) {
return null;
}
return convert.JSON.encode(metric[_toJSON]());
}
static _printMetrics() {
let metrics = [];
for (let metric of developer.Metrics._metrics[dartx.values]) {
metrics[dartx.add](metric[_toJSON]());
}
let map = dart.map({type: 'MetricList', metrics: metrics}, core.String, core.Object);
return convert.JSON.encode(map);
}
};
dart.setSignature(developer.Metrics, {
sfields: () => ({_metrics: MapOfString$Metric()}),
statics: () => ({
register: dart.definiteFunctionType(dart.void, [developer.Metric]),
deregister: dart.definiteFunctionType(dart.void, [developer.Metric]),
_printMetric: dart.definiteFunctionType(core.String, [core.String]),
_printMetrics: dart.definiteFunctionType(core.String, [])
}),
names: ['register', 'deregister', '_printMetric', '_printMetrics']
});
dart.defineLazy(developer.Metrics, {
get _metrics() {
return MapOfString$Metric().new();
}
});
developer._isProduct = false;
developer.TimelineSyncFunction = dart.typedef('TimelineSyncFunction', () => dart.functionType(dart.dynamic, []));
developer.TimelineAsyncFunction = dart.typedef('TimelineAsyncFunction', () => dart.functionType(async.Future, []));
const _appendArguments = Symbol('_appendArguments');
developer.Timeline = class Timeline extends core.Object {
static startSync(name, opts) {
let arguments$ = opts && 'arguments' in opts ? opts.arguments : null;
if (developer._isProduct) {
return;
}
if (!(typeof name == 'string')) {
dart.throw(new core.ArgumentError.value(name, 'name', 'Must be a String'));
}
if (!dart.test(developer._isDartStreamEnabled())) {
developer.Timeline._stack[dartx.add](null);
return;
}
let block = new developer._SyncBlock._(name, developer._getTraceClock(), developer._getThreadCpuClock());
if (core.Map.is(arguments$)) {
block[_appendArguments](arguments$);
}
developer.Timeline._stack[dartx.add](block);
}
static finishSync() {
if (developer._isProduct) {
return;
}
if (developer.Timeline._stack[dartx.length] == 0) {
dart.throw(new core.StateError('Uneven calls to startSync and finishSync'));
}
let block = developer.Timeline._stack[dartx.removeLast]();
if (block == null) {
return;
}
block.finish();
}
static instantSync(name, opts) {
let arguments$ = opts && 'arguments' in opts ? opts.arguments : null;
if (developer._isProduct) {
return;
}
if (!(typeof name == 'string')) {
dart.throw(new core.ArgumentError.value(name, 'name', 'Must be a String'));
}
if (!dart.test(developer._isDartStreamEnabled())) {
return;
}
let instantArguments = null;
if (core.Map.is(arguments$)) {
instantArguments = core.Map.from(arguments$);
}
developer._reportInstantEvent(developer._getTraceClock(), 'Dart', name, developer._argumentsAsJson(instantArguments));
}
static timeSync(name, func, opts) {
let arguments$ = opts && 'arguments' in opts ? opts.arguments : null;
developer.Timeline.startSync(name, {arguments: arguments$});
try {
return func();
} finally {
developer.Timeline.finishSync();
}
}
static get now() {
return developer._getTraceClock();
}
};
dart.setSignature(developer.Timeline, {
sfields: () => ({
_stack: ListOf_SyncBlock(),
_isolateId: core.int,
_isolateIdString: core.String
}),
sgetters: () => ({now: dart.definiteFunctionType(core.int, [])}),
statics: () => ({
startSync: dart.definiteFunctionType(dart.void, [core.String], {arguments: core.Map}),
finishSync: dart.definiteFunctionType(dart.void, []),
instantSync: dart.definiteFunctionType(dart.void, [core.String], {arguments: core.Map}),
timeSync: dart.definiteFunctionType(dart.dynamic, [core.String, developer.TimelineSyncFunction], {arguments: core.Map})
}),
names: ['startSync', 'finishSync', 'instantSync', 'timeSync']
});
dart.defineLazy(developer.Timeline, {
get _stack() {
return ListOf_SyncBlock().new();
},
get _isolateId() {
return developer._getIsolateNum();
},
get _isolateIdString() {
return dart.toString(developer.Timeline._isolateId);
}
});
const _stack = Symbol('_stack');
const _taskId = Symbol('_taskId');
const _start$1 = Symbol('_start');
const _finish = Symbol('_finish');
developer.TimelineTask = class TimelineTask extends core.Object {
new() {
this[_stack] = JSArrayOf_AsyncBlock().of([]);
this[_taskId] = developer._getNextAsyncId();
}
withTaskId(taskId) {
this[_stack] = JSArrayOf_AsyncBlock().of([]);
this[_taskId] = taskId;
if (!(typeof taskId == 'number')) {
dart.throw(new core.ArgumentError.value(taskId, 'taskId', 'Must be an int'));
}
}
start(name, opts) {
let arguments$ = opts && 'arguments' in opts ? opts.arguments : null;
if (developer._isProduct) {
return;
}
if (!(typeof name == 'string')) {
dart.throw(new core.ArgumentError.value(name, 'name', 'Must be a String'));
}
let block = new developer._AsyncBlock._(name, this[_taskId]);
if (core.Map.is(arguments$)) {
block[_appendArguments](arguments$);
}
this[_stack][dartx.add](block);
block[_start$1]();
}
instant(name, opts) {
let arguments$ = opts && 'arguments' in opts ? opts.arguments : null;
if (developer._isProduct) {
return;
}
if (!(typeof name == 'string')) {
dart.throw(new core.ArgumentError.value(name, 'name', 'Must be a String'));
}
let instantArguments = null;
if (core.Map.is(arguments$)) {
instantArguments = core.Map.from(arguments$);
}
developer._reportTaskEvent(developer._getTraceClock(), this[_taskId], 'n', 'Dart', name, developer._argumentsAsJson(instantArguments));
}
finish() {
if (developer._isProduct) {
return;
}
if (this[_stack][dartx.length] == 0) {
dart.throw(new core.StateError('Uneven calls to start and finish'));
}
let block = this[_stack][dartx.removeLast]();
block[_finish]();
}
pass() {
if (dart.notNull(this[_stack][dartx.length]) > 0) {
dart.throw(new core.StateError('You cannot pass a TimelineTask without finishing all started ' + 'operations'));
}
let r = this[_taskId];
return r;
}
};
dart.defineNamedConstructor(developer.TimelineTask, 'withTaskId');
dart.setSignature(developer.TimelineTask, {
constructors: () => ({
new: dart.definiteFunctionType(developer.TimelineTask, []),
withTaskId: dart.definiteFunctionType(developer.TimelineTask, [core.int])
}),
fields: () => ({
[_taskId]: core.int,
[_stack]: ListOf_AsyncBlock()
}),
methods: () => ({
start: dart.definiteFunctionType(dart.void, [core.String], {arguments: core.Map}),
instant: dart.definiteFunctionType(dart.void, [core.String], {arguments: core.Map}),
finish: dart.definiteFunctionType(dart.void, []),
pass: dart.definiteFunctionType(core.int, [])
})
});
const _arguments$ = Symbol('_arguments');
developer._AsyncBlock = class _AsyncBlock extends core.Object {
_(name, taskId) {
this.name = name;
this[_taskId] = taskId;
this.category = 'Dart';
this[_arguments$] = null;
}
[_start$1]() {
developer._reportTaskEvent(developer._getTraceClock(), this[_taskId], 'b', this.category, this.name, developer._argumentsAsJson(this[_arguments$]));
}
[_finish]() {
developer._reportTaskEvent(developer._getTraceClock(), this[_taskId], 'e', this.category, this.name, developer._argumentsAsJson(null));
}
[_appendArguments](arguments$) {
if (this[_arguments$] == null) {
this[_arguments$] = dart.map();
}
this[_arguments$][dartx.addAll](arguments$);
}
};
dart.defineNamedConstructor(developer._AsyncBlock, '_');
dart.setSignature(developer._AsyncBlock, {
constructors: () => ({_: dart.definiteFunctionType(developer._AsyncBlock, [core.String, core.int])}),
fields: () => ({
category: core.String,
name: core.String,
[_taskId]: core.int,
[_arguments$]: core.Map
}),
methods: () => ({
[_start$1]: dart.definiteFunctionType(dart.void, []),
[_finish]: dart.definiteFunctionType(dart.void, []),
[_appendArguments]: dart.definiteFunctionType(dart.void, [core.Map])
})
});
const _startCpu = Symbol('_startCpu');
developer._SyncBlock = class _SyncBlock extends core.Object {
_(name, start, startCpu) {
this.name = name;
this[_start$1] = start;
this[_startCpu] = startCpu;
this.category = 'Dart';
this[_arguments$] = null;
}
finish() {
developer._reportCompleteEvent(this[_start$1], this[_startCpu], this.category, this.name, developer._argumentsAsJson(this[_arguments$]));
}
[_appendArguments](arguments$) {
if (arguments$ == null) {
return;
}
if (this[_arguments$] == null) {
this[_arguments$] = dart.map();
}
this[_arguments$][dartx.addAll](arguments$);
}
};
dart.defineNamedConstructor(developer._SyncBlock, '_');
dart.setSignature(developer._SyncBlock, {
constructors: () => ({_: dart.definiteFunctionType(developer._SyncBlock, [core.String, core.int, core.int])}),
fields: () => ({
category: core.String,
name: core.String,
[_arguments$]: core.Map,
[_start$1]: core.int,
[_startCpu]: core.int
}),
methods: () => ({
finish: dart.definiteFunctionType(dart.void, []),
[_appendArguments]: dart.definiteFunctionType(dart.void, [core.Map])
})
});
developer._fastPathArguments = null;
developer._argumentsAsJson = function(arguments$) {
if (arguments$ == null || arguments$[dartx.length] == 0) {
if (developer._fastPathArguments == null) {
developer._fastPathArguments = dart.str`{"isolateNumber":"${developer.Timeline._isolateId}"}`;
}
return developer._fastPathArguments;
}
arguments$[dartx._set]('isolateNumber', developer.Timeline._isolateIdString);
return convert.JSON.encode(arguments$);
};
dart.fn(developer._argumentsAsJson, MapToString());
developer._isDartStreamEnabled = function() {
return false;
};
dart.fn(developer._isDartStreamEnabled, VoidTobool());
developer._getNextAsyncId = function() {
return 0;
};
dart.fn(developer._getNextAsyncId, VoidToint());
developer._getTraceClock = function() {
let x = developer._clockValue;
developer._clockValue = dart.notNull(x) + 1;
return x;
};
dart.fn(developer._getTraceClock, VoidToint());
developer._getThreadCpuClock = function() {
return -1;
};
dart.fn(developer._getThreadCpuClock, VoidToint());
developer._getIsolateNum = function() {
return 0;
};
dart.fn(developer._getIsolateNum, VoidToint());
developer._reportTaskEvent = function(start, taskId, phase, category, name, argumentsAsJson) {
};
dart.fn(developer._reportTaskEvent, intAndintAndString__Tovoid());
developer._reportCompleteEvent = function(start, startCpu, category, name, argumentsAsJson) {
};
dart.fn(developer._reportCompleteEvent, intAndintAndString__Tovoid$());
developer._reportInstantEvent = function(start, category, name, argumentsAsJson) {
};
dart.fn(developer._reportInstantEvent, intAndStringAndString__Tovoid());
developer.ServiceProtocolInfo = class ServiceProtocolInfo extends core.Object {
new(serverUri) {
this.majorVersion = developer._getServiceMajorVersion();
this.minorVersion = developer._getServiceMinorVersion();
this.serverUri = serverUri;
}
toString() {
if (this.serverUri != null) {
return dart.str`Dart VM Service Protocol v${this.majorVersion}.${this.minorVersion} ` + dart.str`listening on ${this.serverUri}`;
} else {
return dart.str`Dart VM Service Protocol v${this.majorVersion}.${this.minorVersion}`;
}
}
};
dart.setSignature(developer.ServiceProtocolInfo, {
constructors: () => ({new: dart.definiteFunctionType(developer.ServiceProtocolInfo, [core.Uri])}),
fields: () => ({
majorVersion: core.int,
minorVersion: core.int,
serverUri: core.Uri
})
});
developer.Service = class Service extends core.Object {
static getInfo() {
return dart.async(function*() {
let receivePort = isolate.RawReceivePort.new();
let uriCompleter = CompleterOfUri().new();
receivePort.handler = dart.fn(uri => uriCompleter.complete(uri), UriTovoid());
developer._getServerInfo(receivePort.sendPort);
let uri = (yield uriCompleter.future);
receivePort.close();
return new developer.ServiceProtocolInfo(uri);
}, developer.ServiceProtocolInfo);
}
static controlWebServer(opts) {
return dart.async(function*(opts) {
let enable = opts && 'enable' in opts ? opts.enable : false;
if (!(typeof enable == 'boolean')) {
dart.throw(new core.ArgumentError.value(enable, 'enable', 'Must be a bool'));
}
let receivePort = isolate.RawReceivePort.new();
let uriCompleter = CompleterOfUri().new();
receivePort.handler = dart.fn(uri => uriCompleter.complete(uri), UriTovoid());
developer._webServerControl(receivePort.sendPort, enable);
let uri = (yield uriCompleter.future);
receivePort.close();
return new developer.ServiceProtocolInfo(uri);
}, developer.ServiceProtocolInfo, opts);
}
};
dart.setSignature(developer.Service, {
statics: () => ({
getInfo: dart.definiteFunctionType(async.Future$(developer.ServiceProtocolInfo), []),
controlWebServer: dart.definiteFunctionType(async.Future$(developer.ServiceProtocolInfo), [], {enable: core.bool})
}),
names: ['getInfo', 'controlWebServer']
});
developer._getServerInfo = function(sp) {
sp.send(null);
};
dart.lazyFn(developer._getServerInfo, () => SendPortTovoid());
developer._webServerControl = function(sp, enable) {
sp.send(null);
};
dart.lazyFn(developer._webServerControl, () => SendPortAndboolTovoid());
developer._getServiceMajorVersion = function() {
return 0;
};
dart.fn(developer._getServiceMajorVersion, VoidToint());
developer._getServiceMinorVersion = function() {
return 0;
};
dart.fn(developer._getServiceMinorVersion, VoidToint());
isolate.IsolateSpawnException = class IsolateSpawnException extends core.Object {
new(message) {
this.message = message;
@ -56953,19 +57709,19 @@ dart_library.library('dart_sdk', null, /* Imports */[
statics: () => ({createElement_tag: dart.definiteFunctionType(dart.dynamic, [core.String, core.String])}),
names: ['createElement_tag']
});
const _value$0 = Symbol('_value');
const _value$1 = Symbol('_value');
html$.ScrollAlignment = class ScrollAlignment extends core.Object {
_internal(value) {
this[_value$0] = value;
this[_value$1] = value;
}
toString() {
return dart.str`ScrollAlignment.${this[_value$0]}`;
return dart.str`ScrollAlignment.${this[_value$1]}`;
}
};
dart.defineNamedConstructor(html$.ScrollAlignment, '_internal');
dart.setSignature(html$.ScrollAlignment, {
constructors: () => ({_internal: dart.definiteFunctionType(html$.ScrollAlignment, [dart.dynamic])}),
fields: () => ({[_value$0]: dart.dynamic}),
fields: () => ({[_value$1]: dart.dynamic}),
sfields: () => ({
TOP: html$.ScrollAlignment,
CENTER: html$.ScrollAlignment,
@ -80226,43 +80982,43 @@ dart_library.library('dart_sdk', null, /* Imports */[
const _unit = Symbol('_unit');
html$.Dimension = class Dimension extends core.Object {
percent(value) {
this[_value$0] = value;
this[_value$1] = value;
this[_unit] = '%';
}
px(value) {
this[_value$0] = value;
this[_value$1] = value;
this[_unit] = 'px';
}
pc(value) {
this[_value$0] = value;
this[_value$1] = value;
this[_unit] = 'pc';
}
pt(value) {
this[_value$0] = value;
this[_value$1] = value;
this[_unit] = 'pt';
}
inch(value) {
this[_value$0] = value;
this[_value$1] = value;
this[_unit] = 'in';
}
cm(value) {
this[_value$0] = value;
this[_value$1] = value;
this[_unit] = 'cm';
}
mm(value) {
this[_value$0] = value;
this[_value$1] = value;
this[_unit] = 'mm';
}
em(value) {
this[_value$0] = value;
this[_value$1] = value;
this[_unit] = 'em';
}
ex(value) {
this[_value$0] = value;
this[_value$1] = value;
this[_unit] = 'ex';
}
css(cssValue) {
this[_value$0] = null;
this[_value$1] = null;
this[_unit] = null;
if (cssValue == '') cssValue = '0px';
if (dart.test(cssValue[dartx.endsWith]('%'))) {
@ -80271,16 +81027,16 @@ dart_library.library('dart_sdk', null, /* Imports */[
this[_unit] = cssValue[dartx.substring](dart.notNull(cssValue[dartx.length]) - 2);
}
if (dart.test(cssValue[dartx.contains]('.'))) {
this[_value$0] = core.double.parse(cssValue[dartx.substring](0, dart.notNull(cssValue[dartx.length]) - dart.notNull(this[_unit][dartx.length])));
this[_value$1] = core.double.parse(cssValue[dartx.substring](0, dart.notNull(cssValue[dartx.length]) - dart.notNull(this[_unit][dartx.length])));
} else {
this[_value$0] = core.int.parse(cssValue[dartx.substring](0, dart.notNull(cssValue[dartx.length]) - dart.notNull(this[_unit][dartx.length])));
this[_value$1] = core.int.parse(cssValue[dartx.substring](0, dart.notNull(cssValue[dartx.length]) - dart.notNull(this[_unit][dartx.length])));
}
}
toString() {
return dart.str`${this[_value$0]}${this[_unit]}`;
return dart.str`${this[_value$1]}${this[_unit]}`;
}
get value() {
return this[_value$0];
return this[_value$1];
}
};
dart.defineNamedConstructor(html$.Dimension, 'percent');
@ -80307,7 +81063,7 @@ dart_library.library('dart_sdk', null, /* Imports */[
css: dart.definiteFunctionType(html$.Dimension, [core.String])
}),
fields: () => ({
[_value$0]: core.num,
[_value$1]: core.num,
[_unit]: core.String
}),
getters: () => ({value: dart.definiteFunctionType(core.num, [])})
@ -94921,6 +95677,7 @@ dart_library.library('dart_sdk', null, /* Imports */[
exports.collection = collection;
exports.convert = convert;
exports.core = core;
exports.developer = developer;
exports.isolate = isolate;
exports.js = js;
exports.js_util = js_util;

Binary file not shown.

View file

@ -35,6 +35,7 @@ main(List<String> arguments) {
'dart:collection',
'dart:convert',
'dart:core',
'dart:developer',
'dart:isolate',
'dart:js',
'dart:js_util',

View file

@ -42,6 +42,11 @@ const Map<String, LibraryInfo> LIBRARIES = const {
maturity: Maturity.STABLE,
dart2jsPatchPath: "_internal/compiler/js_lib/core_patch.dart"),
"developer": const LibraryInfo(
"developer/developer.dart",
maturity: Maturity.STABLE,
dart2jsPatchPath: "_internal/js_runtime/lib/developer_patch.dart"),
"html": const LibraryInfo(
"html/dart2js/html_dart2js.dart",
category: "Client",

View file

@ -0,0 +1,60 @@
// Copyright (c) 2015, 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.
/// Interact with developer tools such as the debugger and inspector.
///
/// The dart:developer library is _unstable_ and its API might change slightly
/// as a result of developer feedback. This library is platform dependent and
/// therefore it has implementations for both dart2js and the Dart VM. Both are
/// under development and may not support all operations yet.
///
/// To use this library in your code:
///
/// import 'dart:developer';
///
library dart.developer;
import 'dart:async';
import 'dart:convert';
import 'dart:isolate' show RawReceivePort, SendPort;
part 'extension.dart';
part 'profiler.dart';
part 'timeline.dart';
part 'service.dart';
/// If [when] is true, stop the program as if a breakpoint were hit at the
/// following statement.
///
/// Returns the value of [when]. Some debuggers may display [message].
///
/// NOTE: When invoked, the isolate will not return until a debugger
/// continues execution. When running in the Dart VM the behaviour is the same
/// regardless of whether or not a debugger is connected. When compiled to
/// JavaScript, this uses the "debugger" statement, and behaves exactly as
/// that does.
external bool debugger({bool when: true, String message});
/// Send a reference to [object] to any attached debuggers.
///
/// Debuggers may open an inspector on the object. Returns the argument.
external Object inspect(Object object);
/// Emit a log event.
/// [message] is the log message.
/// [time] (optional) is the timestamp.
/// [sequenceNumber] (optional) is a monotonically increasing sequence number.
/// [level] (optional) is the severity level (value between 0 and 2000).
/// [name] (optional) is the name of the source of the log message.
/// [zone] (optional) the zone where the log was emitted
/// [error] (optional) an error object associated with this log event.
/// [stackTrace] (optional) a stack trace associated with this log event.
external void log(String message,
{DateTime time,
int sequenceNumber,
int level: 0,
String name: '',
Zone zone,
Object error,
StackTrace stackTrace});

View file

@ -0,0 +1,177 @@
// Copyright (c) 2015, 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.
part of dart.developer;
/// A response to a service protocol extension RPC.
///
/// If the RPC was successful, use [ServiceExtensionResponse.result], otherwise
/// use [ServiceExtensionResponse.error].
class ServiceExtensionResponse {
final String _result;
final int _errorCode;
final String _errorDetail;
/// Creates a successful response to a service protocol extension RPC.
///
/// Requires [result] to be a JSON object encoded as a string. When forming
/// the JSON-RPC message [result] will be inlined directly.
ServiceExtensionResponse.result(String result)
: _result = result,
_errorCode = null,
_errorDetail = null {
if (_result is! String) {
throw new ArgumentError.value(_result, "result", "Must be a String");
}
}
/// Creates an error response to a service protocol extension RPC.
///
/// Requires [errorCode] to be [invalidParams] or between [extensionErrorMin]
/// and [extensionErrorMax]. Requires [errorDetail] to be a JSON object
/// encoded as a string. When forming the JSON-RPC message [errorDetail] will
/// be inlined directly.
ServiceExtensionResponse.error(int errorCode, String errorDetail)
: _result = null,
_errorCode = errorCode,
_errorDetail = errorDetail {
_validateErrorCode(_errorCode);
if (_errorDetail is! String) {
throw new ArgumentError.value(_errorDetail,
"errorDetail",
"Must be a String");
}
}
/// Invalid method parameter(s) error code.
@deprecated static const kInvalidParams = invalidParams;
/// Generic extension error code.
@deprecated static const kExtensionError = extensionError;
/// Maximum extension provided error code.
@deprecated static const kExtensionErrorMax = extensionErrorMax;
/// Minimum extension provided error code.
@deprecated static const kExtensionErrorMin = extensionErrorMin;
/// Invalid method parameter(s) error code.
static const invalidParams = -32602;
/// Generic extension error code.
static const extensionError = -32000;
/// Maximum extension provided error code.
static const extensionErrorMax = -32000;
/// Minimum extension provided error code.
static const extensionErrorMin = -32016;
static String _errorCodeMessage(int errorCode) {
_validateErrorCode(errorCode);
if (errorCode == kInvalidParams) {
return "Invalid params";
}
return "Server error";
}
static _validateErrorCode(int errorCode) {
if (errorCode is! int) {
throw new ArgumentError.value(errorCode, "errorCode", "Must be an int");
}
if (errorCode == invalidParams) {
return;
}
if ((errorCode >= extensionErrorMin) &&
(errorCode <= extensionErrorMax)) {
return;
}
throw new ArgumentError.value(errorCode, "errorCode", "Out of range");
}
bool _isError() => (_errorCode != null) && (_errorDetail != null);
String _toString() {
if (_result != null) {
return _result;
} else {
assert(_errorCode != null);
assert(_errorDetail != null);
return JSON.encode({
'code': _errorCode,
'message': _errorCodeMessage(_errorCode),
'data': {
'details': _errorDetail
}
});
}
}
}
/// A service protocol extension handler. Registered with [registerExtension].
///
/// Must complete to a [ServiceExtensionResponse].
///
/// [method] - the method name of the service protocol request.
/// [parameters] - A map holding the parameters to the service protocol request.
///
/// *NOTE*: All parameter names and values are **encoded as strings**.
typedef Future<ServiceExtensionResponse>
ServiceExtensionHandler(String method, Map<String, String> parameters);
/// Register a [ServiceExtensionHandler] that will be invoked in this isolate
/// for [method]. *NOTE*: Service protocol extensions must be registered
/// in each isolate.
///
/// *NOTE*: [method] must begin with 'ext.' and you should use the following
/// structure to avoid conflicts with other packages: 'ext.package.command'.
/// That is, immediately following the 'ext.' prefix, should be the registering
/// package name followed by another period ('.') and then the command name.
/// For example: 'ext.dart.io.getOpenFiles'.
///
/// Because service extensions are isolate specific, clients using extensions
/// must always include an 'isolateId' parameter with each RPC.
void registerExtension(String method, ServiceExtensionHandler handler) {
if (method is! String) {
throw new ArgumentError.value(method,
'method',
'Must be a String');
}
if (!method.startsWith('ext.')) {
throw new ArgumentError.value(method,
'method',
'Must begin with ext.');
}
if (_lookupExtension(method) != null) {
throw new ArgumentError('Extension already registered: $method');
}
if (handler is! ServiceExtensionHandler) {
throw new ArgumentError.value(handler,
'handler',
'Must be a ServiceExtensionHandler');
}
_registerExtension(method, handler);
}
/// Post an event of [eventKind] with payload of [eventData] to the `Extension`
/// event stream.
void postEvent(String eventKind, Map eventData) {
if (eventKind is! String) {
throw new ArgumentError.value(eventKind,
'eventKind',
'Must be a String');
}
if (eventData is! Map) {
throw new ArgumentError.value(eventData,
'eventData',
'Must be a Map');
}
String eventDataAsString = JSON.encode(eventData);
_postEvent(eventKind, eventDataAsString);
}
external _postEvent(String eventKind, String eventData);
// Both of these functions are written inside C++ to avoid updating the data
// structures in Dart, getting an OOB, and observing stale state. Do not move
// these into Dart code unless you can ensure that the operations will can be
// done atomically. Native code lives in vm/isolate.cc-
// LookupServiceExtensionHandler and RegisterServiceExtensionHandler.
external ServiceExtensionHandler _lookupExtension(String method);
external _registerExtension(String method, ServiceExtensionHandler handler);

View file

@ -0,0 +1,197 @@
// Copyright (c) 2014, 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.
part of dart.developer;
/// A UserTag can be used to group samples in the Observatory profiler.
abstract class UserTag {
/// The maximum number of UserTag instances that can be created by a program.
static const MAX_USER_TAGS = 64;
factory UserTag(String label) => new _FakeUserTag(label);
/// Label of [this].
String get label;
/// Make [this] the current tag for the isolate. Returns the current tag
/// before setting.
UserTag makeCurrent();
/// The default [UserTag] with label 'Default'.
static UserTag get defaultTag => _FakeUserTag._defaultTag;
}
// This is a fake implementation of UserTag so that code can compile and run
// in dart2js.
class _FakeUserTag implements UserTag {
static Map _instances = {};
_FakeUserTag.real(this.label);
factory _FakeUserTag(String label) {
// Canonicalize by name.
var existingTag = _instances[label];
if (existingTag != null) {
return existingTag;
}
// Throw an exception if we've reached the maximum number of user tags.
if (_instances.length == UserTag.MAX_USER_TAGS) {
throw new UnsupportedError(
'UserTag instance limit (${UserTag.MAX_USER_TAGS}) reached.');
}
// Create a new instance and add it to the instance map.
var instance = new _FakeUserTag.real(label);
_instances[label] = instance;
return instance;
}
final String label;
UserTag makeCurrent() {
var old = _currentTag;
_currentTag = this;
return old;
}
static final UserTag _defaultTag = new _FakeUserTag('Default');
}
var _currentTag = _FakeUserTag._defaultTag;
/// Returns the current [UserTag] for the isolate.
UserTag getCurrentTag() {
return _currentTag;
}
/// Abstract [Metric] class. Metric names must be unique, are hierarchical,
/// and use periods as separators. For example, 'a.b.c'. Uniqueness is only
/// enforced when a Metric is registered. The name of a metric cannot contain
/// the slash ('/') character.
abstract class Metric {
/// [name] of this metric.
final String name;
/// [description] of this metric.
final String description;
Metric(this.name, this.description) {
if ((name == 'vm') || name.contains('/')) {
throw new ArgumentError('Invalid Metric name.');
}
}
Map _toJSON();
}
/// A measured value with a min and max. Initial value is min. Value will
/// be clamped to the interval [min, max].
class Gauge extends Metric {
final double min;
final double max;
double _value;
double get value => _value;
set value(double v) {
if (v < min) {
v = min;
} else if (v > max) {
v = max;
}
_value = v;
}
Gauge(String name, String description, this.min, this.max)
: super(name, description) {
if (min is! double) {
throw new ArgumentError('min must be a double');
}
if (max is! double) {
throw new ArgumentError('max must be a double');
}
if (!(min < max)) {
throw new ArgumentError('min must be less than max');
}
_value = min;
}
Map _toJSON() {
var map = {
'type': 'Gauge',
'id': 'metrics/$name',
'name': name,
'description': description,
'value': value,
'min': min,
'max': max,
};
return map;
}
}
/// A changing value. Initial value is 0.0.
class Counter extends Metric {
Counter(String name, String description)
: super(name, description);
double _value = 0.0;
double get value => _value;
set value(double v) {
_value = v;
}
Map _toJSON() {
var map = {
'type': 'Counter',
'id': 'metrics/$name',
'name': name,
'description': description,
'value': value,
};
return map;
}
}
class Metrics {
static final Map<String, Metric> _metrics = new Map<String, Metric>();
/// Register [Metric]s to make them visible to Observatory.
static void register(Metric metric) {
if (metric is! Metric) {
throw new ArgumentError('metric must be a Metric');
}
if (_metrics[metric.name] != null) {
throw new ArgumentError('Registered metrics have unique names');
}
_metrics[metric.name] = metric;
}
/// Deregister [Metric]s to make them not visible to Observatory.
static void deregister(Metric metric) {
if (metric is! Metric) {
throw new ArgumentError('metric must be a Metric');
}
_metrics.remove(metric.name);
}
static String _printMetric(String id) {
var metric = _metrics[id];
if (metric == null) {
return null;
}
return JSON.encode(metric._toJSON());
}
static String _printMetrics() {
var metrics = [];
for (var metric in _metrics.values) {
metrics.add(metric._toJSON());
}
var map = {
'type': 'MetricList',
'metrics': metrics,
};
return JSON.encode(map);
}
}

View file

@ -0,0 +1,89 @@
// Copyright (c) 2016, 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.
part of dart.developer;
/// Service protocol is the protocol that a client like the observatory
/// could use to access the services provided by the Dart VM for
/// debugging and inspecting Dart programs. This class encapsulates the
/// version number and Uri for accessing this service.
class ServiceProtocolInfo {
/// The major version of the protocol. If the running Dart environment does
/// not support the service protocol, this is 0.
final int majorVersion = _getServiceMajorVersion();
/// The minor version of the protocol. If the running Dart environment does
/// not support the service protocol, this is 0.
final int minorVersion = _getServiceMinorVersion();
/// The Uri to access the service. If the web server is not running, this
/// will be null.
final Uri serverUri;
ServiceProtocolInfo(this.serverUri);
String toString() {
if (serverUri != null) {
return 'Dart VM Service Protocol v$majorVersion.$minorVersion '
'listening on $serverUri';
} else {
return 'Dart VM Service Protocol v$majorVersion.$minorVersion';
}
}
}
/// Access information about the service protocol and control the web server
/// that provides access to the services provided by the Dart VM for
/// debugging and inspecting Dart programs.
class Service {
/// Get information about the service protocol (version number and
/// Uri to access the service).
static Future<ServiceProtocolInfo> getInfo() async {
// Port to receive response from service isolate.
final RawReceivePort receivePort = new RawReceivePort();
final Completer<Uri> uriCompleter = new Completer<Uri>();
receivePort.handler = (Uri uri) => uriCompleter.complete(uri);
// Request the information from the service isolate.
_getServerInfo(receivePort.sendPort);
// Await the response from the service isolate.
Uri uri = await uriCompleter.future;
// Close the port.
receivePort.close();
return new ServiceProtocolInfo(uri);
}
/// Control the web server that the service protocol is accessed through.
/// The [enable] argument must be a boolean and is used as a toggle to
/// enable(true) or disable(false) the web server servicing requests.
static Future<ServiceProtocolInfo> controlWebServer(
{bool enable: false}) async {
if (enable is! bool) {
throw new ArgumentError.value(enable,
'enable',
'Must be a bool');
}
// Port to receive response from service isolate.
final RawReceivePort receivePort = new RawReceivePort();
final Completer<Uri> uriCompleter = new Completer<Uri>();
receivePort.handler = (Uri uri) => uriCompleter.complete(uri);
// Request the information from the service isolate.
_webServerControl(receivePort.sendPort, enable);
// Await the response from the service isolate.
Uri uri = await uriCompleter.future;
// Close the port.
receivePort.close();
return new ServiceProtocolInfo(uri);
}
}
/// [sp] will receive a Uri or null.
external void _getServerInfo(SendPort sp);
/// [sp] will receive a Uri or null.
external void _webServerControl(SendPort sp, bool enable);
/// Returns the major version of the service protocol.
external int _getServiceMajorVersion();
/// Returns the minor version of the service protocol.
external int _getServiceMinorVersion();

View file

@ -0,0 +1,328 @@
// Copyright (c) 2015, 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.
part of dart.developer;
const bool _isProduct = const bool.fromEnvironment("dart.vm.product");
typedef dynamic TimelineSyncFunction();
typedef Future TimelineAsyncFunction();
/// Add to the timeline.
class Timeline {
/// Start a synchronous operation labeled [name]. Optionally takes
/// a [Map] of [arguments]. This operation must be finished before
/// returning to the event queue.
static void startSync(String name, {Map arguments}) {
if (_isProduct) {
return;
}
if (name is! String) {
throw new ArgumentError.value(name,
'name',
'Must be a String');
}
if (!_isDartStreamEnabled()) {
// Push a null onto the stack and return.
_stack.add(null);
return;
}
var block = new _SyncBlock._(name, _getTraceClock(), _getThreadCpuClock());
if (arguments is Map) {
block._appendArguments(arguments);
}
_stack.add(block);
}
/// Finish the last synchronous operation that was started.
static void finishSync() {
if (_isProduct) {
return;
}
if (_stack.length == 0) {
throw new StateError(
'Uneven calls to startSync and finishSync');
}
// Pop top item off of stack.
var block = _stack.removeLast();
if (block == null) {
// Dart stream was disabled when startSync was called.
return;
}
// Finish it.
block.finish();
}
/// Emit an instant event.
static void instantSync(String name, {Map arguments}) {
if (_isProduct) {
return;
}
if (name is! String) {
throw new ArgumentError.value(name,
'name',
'Must be a String');
}
if (!_isDartStreamEnabled()) {
// Stream is disabled.
return;
}
Map instantArguments;
if (arguments is Map) {
instantArguments = new Map.from(arguments);
}
_reportInstantEvent(_getTraceClock(),
'Dart',
name,
_argumentsAsJson(instantArguments));
}
/// A utility method to time a synchronous [function]. Internally calls
/// [function] bracketed by calls to [startSync] and [finishSync].
static dynamic timeSync(String name,
TimelineSyncFunction function,
{Map arguments}) {
startSync(name, arguments: arguments);
try {
return function();
} finally {
finishSync();
}
}
/// The current time stamp from the clock used by the timeline. Units are
/// microseconds.
static int get now => _getTraceClock();
static final List<_SyncBlock> _stack = new List<_SyncBlock>();
static final int _isolateId = _getIsolateNum();
static final String _isolateIdString = _isolateId.toString();
}
/// An asynchronous task on the timeline. An asynchronous task can have many
/// (nested) synchronous operations. Synchronous operations can live longer than
/// the current isolate event. To pass a [TimelineTask] to another isolate,
/// you must first call [pass] to get the task id and then construct a new
/// [TimelineTask] in the other isolate.
class TimelineTask {
/// Create a task. [taskId] will be set by the system.
TimelineTask()
: _taskId = _getNextAsyncId() {
}
/// Create a task with an explicit [taskId]. This is useful if you are
/// passing a task from one isolate to another.
TimelineTask.withTaskId(int taskId)
: _taskId = taskId {
if (taskId is! int) {
throw new ArgumentError.value(taskId,
'taskId',
'Must be an int');
}
}
/// Start a synchronous operation within this task named [name].
/// Optionally takes a [Map] of [arguments].
void start(String name, {Map arguments}) {
if (_isProduct) {
return;
}
if (name is! String) {
throw new ArgumentError.value(name,
'name',
'Must be a String');
}
var block = new _AsyncBlock._(name, _taskId);
if (arguments is Map) {
block._appendArguments(arguments);
}
_stack.add(block);
block._start();
}
/// Emit an instant event for this task.
void instant(String name, {Map arguments}) {
if (_isProduct) {
return;
}
if (name is! String) {
throw new ArgumentError.value(name,
'name',
'Must be a String');
}
Map instantArguments;
if (arguments is Map) {
instantArguments = new Map.from(arguments);
}
_reportTaskEvent(_getTraceClock(),
_taskId,
'n',
'Dart',
name,
_argumentsAsJson(instantArguments));
}
/// Finish the last synchronous operation that was started.
void finish() {
if (_isProduct) {
return;
}
if (_stack.length == 0) {
throw new StateError(
'Uneven calls to start and finish');
}
// Pop top item off of stack.
var block = _stack.removeLast();
block._finish();
}
/// Retrieve the [TimelineTask]'s task id. Will throw an exception if the
/// stack is not empty.
int pass() {
if (_stack.length > 0) {
throw new StateError(
'You cannot pass a TimelineTask without finishing all started '
'operations');
}
int r = _taskId;
return r;
}
final int _taskId;
final List<_AsyncBlock> _stack = [];
}
/// An asynchronous block of time on the timeline. This block can be kept
/// open across isolate messages.
class _AsyncBlock {
/// The category this block belongs to.
final String category = 'Dart';
/// The name of this block.
final String name;
/// The asynchronous task id.
final int _taskId;
/// An (optional) set of arguments which will be serialized to JSON and
/// associated with this block.
Map _arguments;
_AsyncBlock._(this.name, this._taskId);
// Emit the start event.
void _start() {
_reportTaskEvent(_getTraceClock(),
_taskId,
'b',
category,
name,
_argumentsAsJson(_arguments));
}
// Emit the finish event.
void _finish() {
_reportTaskEvent(_getTraceClock(),
_taskId,
'e',
category,
name,
_argumentsAsJson(null));
}
void _appendArguments(Map arguments) {
if (_arguments == null) {
_arguments = {};
}
_arguments.addAll(arguments);
}
}
/// A synchronous block of time on the timeline. This block should not be
/// kept open across isolate messages.
class _SyncBlock {
/// The category this block belongs to.
final String category = 'Dart';
/// The name of this block.
final String name;
/// An (optional) set of arguments which will be serialized to JSON and
/// associated with this block.
Map _arguments;
// The start time stamp.
final int _start;
// The start time stamp of the thread cpu clock.
final int _startCpu;
_SyncBlock._(this.name,
this._start,
this._startCpu);
/// Finish this block of time. At this point, this block can no longer be
/// used.
void finish() {
// Report event to runtime.
_reportCompleteEvent(_start,
_startCpu,
category,
name,
_argumentsAsJson(_arguments));
}
void _appendArguments(Map arguments) {
if (arguments == null) {
return;
}
if (_arguments == null) {
_arguments = {};
}
_arguments.addAll(arguments);
}
}
String _fastPathArguments;
String _argumentsAsJson(Map arguments) {
if ((arguments == null) || (arguments.length == 0)) {
// Fast path no arguments. Avoid calling JSON.encode.
if (_fastPathArguments == null) {
_fastPathArguments = '{"isolateNumber":"${Timeline._isolateId}"}';
}
return _fastPathArguments;
}
// Add isolateNumber to arguments map.
arguments['isolateNumber'] = Timeline._isolateIdString;
return JSON.encode(arguments);
}
/// Returns true if the Dart Timeline stream is enabled.
external bool _isDartStreamEnabled();
/// Returns the next async task id.
external int _getNextAsyncId();
/// Returns the current value from the trace clock.
external int _getTraceClock();
/// Returns the current value from the thread CPU usage clock.
external int _getThreadCpuClock();
/// Returns the isolate's main port number.
external int _getIsolateNum();
/// Reports an event for a task.
external void _reportTaskEvent(int start,
int taskId,
String phase,
String category,
String name,
String argumentsAsJson);
/// Reports a complete synchronous event.
external void _reportCompleteEvent(int start,
int startCpu,
String category,
String name,
String argumentsAsJson);
/// Reports an instant event.
external void _reportInstantEvent(int start,
String category,
String name,
String argumentsAsJson);

View file

@ -0,0 +1,127 @@
// Copyright (c) 2015, 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.
// Patch file for dart:developer library.
import 'dart:_js_helper' show patch, ForceInline;
import 'dart:_foreign_helper' show JS;
@patch
// @ForceInline()
bool debugger({bool when: true, String message}) {
if (when) {
JS('', 'debugger');
}
return when;
}
@patch
Object inspect(Object object) {
return object;
}
@patch
void log(String message,
{DateTime time,
int sequenceNumber,
int level: 0,
String name: '',
Zone zone,
Object error,
StackTrace stackTrace}) {
// TODO.
}
final _extensions = new Map<String, ServiceExtensionHandler>();
@patch
ServiceExtensionHandler _lookupExtension(String method) {
return _extensions[method];
}
@patch
_registerExtension(String method, ServiceExtensionHandler handler) {
_extensions[method] = handler;
}
@patch
_postEvent(String eventKind, String eventData) {
// TODO.
}
@patch
bool _isDartStreamEnabled() {
return false;
}
@patch
int _getTraceClock() {
// TODO.
return _clockValue++;
}
int _clockValue = 0;
@patch
int _getThreadCpuClock() {
return -1;
}
@patch
void _reportCompleteEvent(int start,
int startCpu,
String category,
String name,
String argumentsAsJson) {
// TODO.
}
@patch
void _reportInstantEvent(int start,
String category,
String name,
String argumentsAsJson) {
// TODO.
}
@patch
int _getNextAsyncId() {
return 0;
}
@patch
int _getIsolateNum() {
return 0;
}
@patch
void _reportTaskEvent(int start,
int taskId,
String phase,
String category,
String name,
String argumentsAsJson) {
// TODO.
}
@patch
int _getServiceMajorVersion() {
return 0;
}
@patch
int _getServiceMinorVersion() {
return 0;
}
@patch
void _getServerInfo(SendPort sp) {
sp.send(null);
}
@patch
void _webServerControl(SendPort sp, bool enable) {
sp.send(null);
}