| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 part of service; | 5 part of service; |
| 6 | 6 |
| 7 /// Helper function for canceling a Future<StreamSubscription>. | 7 /// Helper function for canceling a Future<StreamSubscription>. |
| 8 Future cancelFutureSubscription( | 8 Future cancelFutureSubscription( |
| 9 Future<StreamSubscription> subscriptionFuture) async { | 9 Future<StreamSubscription> subscriptionFuture) async { |
| 10 if (subscriptionFuture != null) { | 10 if (subscriptionFuture != null) { |
| (...skipping 936 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 947 } | 947 } |
| 948 return obj; | 948 return obj; |
| 949 })); | 949 })); |
| 950 } | 950 } |
| 951 return result; | 951 return result; |
| 952 } | 952 } |
| 953 } | 953 } |
| 954 | 954 |
| 955 /// State for a running isolate. | 955 /// State for a running isolate. |
| 956 class Isolate extends ServiceObjectOwner with Coverage { | 956 class Isolate extends ServiceObjectOwner with Coverage { |
| 957 static const kLoggingStream = '_Logging'; |
| 957 @reflectable VM get vm => owner; | 958 @reflectable VM get vm => owner; |
| 958 @reflectable Isolate get isolate => this; | 959 @reflectable Isolate get isolate => this; |
| 959 @observable int number; | 960 @observable int number; |
| 960 @observable DateTime startTime; | 961 @observable DateTime startTime; |
| 961 @observable Duration get upTime => | 962 @observable Duration get upTime => |
| 962 (new DateTime.now().difference(startTime)); | 963 (new DateTime.now().difference(startTime)); |
| 963 | 964 |
| 964 @observable ObservableMap counters = new ObservableMap(); | 965 @observable ObservableMap counters = new ObservableMap(); |
| 965 | 966 |
| 966 void _updateRunState() { | 967 void _updateRunState() { |
| (...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1584 message = map['message']; | 1585 message = map['message']; |
| 1585 exception = new ServiceObject._fromMap(owner, map['exception']); | 1586 exception = new ServiceObject._fromMap(owner, map['exception']); |
| 1586 stacktrace = new ServiceObject._fromMap(owner, map['stacktrace']); | 1587 stacktrace = new ServiceObject._fromMap(owner, map['stacktrace']); |
| 1587 name = 'DartError($message)'; | 1588 name = 'DartError($message)'; |
| 1588 vmName = name; | 1589 vmName = name; |
| 1589 } | 1590 } |
| 1590 | 1591 |
| 1591 String toString() => 'DartError($message)'; | 1592 String toString() => 'DartError($message)'; |
| 1592 } | 1593 } |
| 1593 | 1594 |
| 1595 Level _findLogLevel(int value) { |
| 1596 for (var level in Level.LEVELS) { |
| 1597 if (level.value == value) { |
| 1598 return level; |
| 1599 } |
| 1600 } |
| 1601 return new Level('$value', value); |
| 1602 } |
| 1603 |
| 1594 /// A [ServiceEvent] is an asynchronous event notification from the vm. | 1604 /// A [ServiceEvent] is an asynchronous event notification from the vm. |
| 1595 class ServiceEvent extends ServiceObject { | 1605 class ServiceEvent extends ServiceObject { |
| 1596 /// The possible 'kind' values. | 1606 /// The possible 'kind' values. |
| 1597 static const kIsolateStart = 'IsolateStart'; | 1607 static const kIsolateStart = 'IsolateStart'; |
| 1598 static const kIsolateExit = 'IsolateExit'; | 1608 static const kIsolateExit = 'IsolateExit'; |
| 1599 static const kIsolateUpdate = 'IsolateUpdate'; | 1609 static const kIsolateUpdate = 'IsolateUpdate'; |
| 1600 static const kPauseStart = 'PauseStart'; | 1610 static const kPauseStart = 'PauseStart'; |
| 1601 static const kPauseExit = 'PauseExit'; | 1611 static const kPauseExit = 'PauseExit'; |
| 1602 static const kPauseBreakpoint = 'PauseBreakpoint'; | 1612 static const kPauseBreakpoint = 'PauseBreakpoint'; |
| 1603 static const kPauseInterrupted = 'PauseInterrupted'; | 1613 static const kPauseInterrupted = 'PauseInterrupted'; |
| 1604 static const kPauseException = 'PauseException'; | 1614 static const kPauseException = 'PauseException'; |
| 1605 static const kResume = 'Resume'; | 1615 static const kResume = 'Resume'; |
| 1606 static const kBreakpointAdded = 'BreakpointAdded'; | 1616 static const kBreakpointAdded = 'BreakpointAdded'; |
| 1607 static const kBreakpointResolved = 'BreakpointResolved'; | 1617 static const kBreakpointResolved = 'BreakpointResolved'; |
| 1608 static const kBreakpointRemoved = 'BreakpointRemoved'; | 1618 static const kBreakpointRemoved = 'BreakpointRemoved'; |
| 1609 static const kGraph = '_Graph'; | 1619 static const kGraph = '_Graph'; |
| 1610 static const kGC = 'GC'; | 1620 static const kGC = 'GC'; |
| 1611 static const kInspect = 'Inspect'; | 1621 static const kInspect = 'Inspect'; |
| 1612 static const kDebuggerSettingsUpdate = '_DebuggerSettingsUpdate'; | 1622 static const kDebuggerSettingsUpdate = '_DebuggerSettingsUpdate'; |
| 1613 static const kConnectionClosed = 'ConnectionClosed'; | 1623 static const kConnectionClosed = 'ConnectionClosed'; |
| 1624 static const kLogging = '_Logging'; |
| 1614 | 1625 |
| 1615 ServiceEvent._empty(ServiceObjectOwner owner) : super._empty(owner); | 1626 ServiceEvent._empty(ServiceObjectOwner owner) : super._empty(owner); |
| 1616 | 1627 |
| 1617 ServiceEvent.connectionClosed(this.reason) : super._empty(null) { | 1628 ServiceEvent.connectionClosed(this.reason) : super._empty(null) { |
| 1618 kind = kConnectionClosed; | 1629 kind = kConnectionClosed; |
| 1619 } | 1630 } |
| 1620 | 1631 |
| 1621 @observable String kind; | 1632 @observable String kind; |
| 1622 @observable Breakpoint breakpoint; | 1633 @observable Breakpoint breakpoint; |
| 1623 @observable Frame topFrame; | 1634 @observable Frame topFrame; |
| 1624 @observable Instance exception; | 1635 @observable Instance exception; |
| 1625 @observable Instance asyncContinuation; | 1636 @observable Instance asyncContinuation; |
| 1626 @observable ServiceObject inspectee; | 1637 @observable ServiceObject inspectee; |
| 1627 @observable ByteData data; | 1638 @observable ByteData data; |
| 1628 @observable int count; | 1639 @observable int count; |
| 1629 @observable String reason; | 1640 @observable String reason; |
| 1630 @observable String exceptions; | 1641 @observable String exceptions; |
| 1631 @observable String bytesAsString; | 1642 @observable String bytesAsString; |
| 1643 @observable Map logRecord; |
| 1632 int chunkIndex, chunkCount, nodeCount; | 1644 int chunkIndex, chunkCount, nodeCount; |
| 1633 | 1645 |
| 1634 @observable bool get isPauseEvent { | 1646 @observable bool get isPauseEvent { |
| 1635 return (kind == kPauseStart || | 1647 return (kind == kPauseStart || |
| 1636 kind == kPauseExit || | 1648 kind == kPauseExit || |
| 1637 kind == kPauseBreakpoint || | 1649 kind == kPauseBreakpoint || |
| 1638 kind == kPauseInterrupted || | 1650 kind == kPauseInterrupted || |
| 1639 kind == kPauseException); | 1651 kind == kPauseException); |
| 1640 } | 1652 } |
| 1641 | 1653 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1684 count = map['count']; | 1696 count = map['count']; |
| 1685 } | 1697 } |
| 1686 if (map['_debuggerSettings'] != null && | 1698 if (map['_debuggerSettings'] != null && |
| 1687 map['_debuggerSettings']['_exceptions'] != null) { | 1699 map['_debuggerSettings']['_exceptions'] != null) { |
| 1688 exceptions = map['_debuggerSettings']['_exceptions']; | 1700 exceptions = map['_debuggerSettings']['_exceptions']; |
| 1689 } | 1701 } |
| 1690 if (map['bytes'] != null) { | 1702 if (map['bytes'] != null) { |
| 1691 var bytes = decodeBase64(map['bytes']); | 1703 var bytes = decodeBase64(map['bytes']); |
| 1692 bytesAsString = UTF8.decode(bytes); | 1704 bytesAsString = UTF8.decode(bytes); |
| 1693 } | 1705 } |
| 1706 if (map['logRecord'] != null) { |
| 1707 logRecord = map['logRecord']; |
| 1708 logRecord['time'] = |
| 1709 new DateTime.fromMillisecondsSinceEpoch(logRecord['time']); |
| 1710 logRecord['level'] = _findLogLevel(logRecord['level']); |
| 1711 } |
| 1694 } | 1712 } |
| 1695 | 1713 |
| 1696 String toString() { | 1714 String toString() { |
| 1697 if (data == null) { | 1715 if (data == null) { |
| 1698 return "ServiceEvent(owner='${owner.id}', kind='${kind}')"; | 1716 return "ServiceEvent(owner='${owner.id}', kind='${kind}')"; |
| 1699 } else { | 1717 } else { |
| 1700 return "ServiceEvent(owner='${owner.id}', kind='${kind}', " | 1718 return "ServiceEvent(owner='${owner.id}', kind='${kind}', " |
| 1701 "data.lengthInBytes=${data.lengthInBytes})"; | 1719 "data.lengthInBytes=${data.lengthInBytes})"; |
| 1702 } | 1720 } |
| 1703 } | 1721 } |
| (...skipping 1879 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3583 var v = list[i]; | 3601 var v = list[i]; |
| 3584 if ((v is ObservableMap) && _isServiceMap(v)) { | 3602 if ((v is ObservableMap) && _isServiceMap(v)) { |
| 3585 list[i] = owner.getFromMap(v); | 3603 list[i] = owner.getFromMap(v); |
| 3586 } else if (v is ObservableList) { | 3604 } else if (v is ObservableList) { |
| 3587 _upgradeObservableList(v, owner); | 3605 _upgradeObservableList(v, owner); |
| 3588 } else if (v is ObservableMap) { | 3606 } else if (v is ObservableMap) { |
| 3589 _upgradeObservableMap(v, owner); | 3607 _upgradeObservableMap(v, owner); |
| 3590 } | 3608 } |
| 3591 } | 3609 } |
| 3592 } | 3610 } |
| OLD | NEW |