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

Side by Side Diff: runtime/observatory/lib/src/service/object.dart

Issue 1537523002: Add dart:developer.postEvent for posting events to the service protocol from Dart code (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 // Some value smaller than the object ring, so requesting a large array 7 // Some value smaller than the object ring, so requesting a large array
8 // doesn't result in an expired ref because the elements lapped it in the 8 // doesn't result in an expired ref because the elements lapped it in the
9 // object ring. 9 // object ring.
10 const int kDefaultFieldLimit = 100; 10 const int kDefaultFieldLimit = 100;
(...skipping 1119 matching lines...) Expand 10 before | Expand all | Expand 10 after
1130 return obj; 1130 return obj;
1131 })); 1131 }));
1132 } 1132 }
1133 return result; 1133 return result;
1134 } 1134 }
1135 } 1135 }
1136 1136
1137 /// State for a running isolate. 1137 /// State for a running isolate.
1138 class Isolate extends ServiceObjectOwner with Coverage { 1138 class Isolate extends ServiceObjectOwner with Coverage {
1139 static const kLoggingStream = '_Logging'; 1139 static const kLoggingStream = '_Logging';
1140 static const kExtensionStream = 'Extension';
1141
1140 @reflectable VM get vm => owner; 1142 @reflectable VM get vm => owner;
1141 @reflectable Isolate get isolate => this; 1143 @reflectable Isolate get isolate => this;
1142 @observable int number; 1144 @observable int number;
1143 @observable int originNumber; 1145 @observable int originNumber;
1144 @observable DateTime startTime; 1146 @observable DateTime startTime;
1145 @observable Duration get upTime { 1147 @observable Duration get upTime {
1146 if (startTime == null) { 1148 if (startTime == null) {
1147 return null; 1149 return null;
1148 } 1150 }
1149 return (new DateTime.now().difference(startTime)); 1151 return (new DateTime.now().difference(startTime));
(...skipping 750 matching lines...) Expand 10 before | Expand all | Expand 10 after
1900 static const kResume = 'Resume'; 1902 static const kResume = 'Resume';
1901 static const kBreakpointAdded = 'BreakpointAdded'; 1903 static const kBreakpointAdded = 'BreakpointAdded';
1902 static const kBreakpointResolved = 'BreakpointResolved'; 1904 static const kBreakpointResolved = 'BreakpointResolved';
1903 static const kBreakpointRemoved = 'BreakpointRemoved'; 1905 static const kBreakpointRemoved = 'BreakpointRemoved';
1904 static const kGraph = '_Graph'; 1906 static const kGraph = '_Graph';
1905 static const kGC = 'GC'; 1907 static const kGC = 'GC';
1906 static const kInspect = 'Inspect'; 1908 static const kInspect = 'Inspect';
1907 static const kDebuggerSettingsUpdate = '_DebuggerSettingsUpdate'; 1909 static const kDebuggerSettingsUpdate = '_DebuggerSettingsUpdate';
1908 static const kConnectionClosed = 'ConnectionClosed'; 1910 static const kConnectionClosed = 'ConnectionClosed';
1909 static const kLogging = '_Logging'; 1911 static const kLogging = '_Logging';
1912 static const kExtension = 'Extension';
1910 1913
1911 ServiceEvent._empty(ServiceObjectOwner owner) : super._empty(owner); 1914 ServiceEvent._empty(ServiceObjectOwner owner) : super._empty(owner);
1912 1915
1913 ServiceEvent.connectionClosed(this.reason) : super._empty(null) { 1916 ServiceEvent.connectionClosed(this.reason) : super._empty(null) {
1914 kind = kConnectionClosed; 1917 kind = kConnectionClosed;
1915 } 1918 }
1916 1919
1917 @observable String kind; 1920 @observable String kind;
1918 @observable DateTime timestamp; 1921 @observable DateTime timestamp;
1919 @observable Breakpoint breakpoint; 1922 @observable Breakpoint breakpoint;
1920 @observable Frame topFrame; 1923 @observable Frame topFrame;
1921 @observable String extensionRPC; 1924 @observable String extensionRPC;
1922 @observable Instance exception; 1925 @observable Instance exception;
1923 @observable Instance asyncContinuation; 1926 @observable Instance asyncContinuation;
1924 @observable bool atAsyncJump; 1927 @observable bool atAsyncJump;
1925 @observable ServiceObject inspectee; 1928 @observable ServiceObject inspectee;
1926 @observable ByteData data; 1929 @observable ByteData data;
1927 @observable int count; 1930 @observable int count;
1928 @observable String reason; 1931 @observable String reason;
1929 @observable String exceptions; 1932 @observable String exceptions;
1930 @observable String bytesAsString; 1933 @observable String bytesAsString;
1931 @observable Map logRecord; 1934 @observable Map logRecord;
1935 @observable String extensionKind;
1936 @observable Map extensionData;
1932 1937
1933 int chunkIndex, chunkCount, nodeCount; 1938 int chunkIndex, chunkCount, nodeCount;
1934 1939
1935 @observable bool get isPauseEvent { 1940 @observable bool get isPauseEvent {
1936 return (kind == kPauseStart || 1941 return (kind == kPauseStart ||
1937 kind == kPauseExit || 1942 kind == kPauseExit ||
1938 kind == kPauseBreakpoint || 1943 kind == kPauseBreakpoint ||
1939 kind == kPauseInterrupted || 1944 kind == kPauseInterrupted ||
1940 kind == kPauseException); 1945 kind == kPauseException);
1941 } 1946 }
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
1999 if (map['bytes'] != null) { 2004 if (map['bytes'] != null) {
2000 var bytes = BASE64.decode(map['bytes']); 2005 var bytes = BASE64.decode(map['bytes']);
2001 bytesAsString = UTF8.decode(bytes); 2006 bytesAsString = UTF8.decode(bytes);
2002 } 2007 }
2003 if (map['logRecord'] != null) { 2008 if (map['logRecord'] != null) {
2004 logRecord = map['logRecord']; 2009 logRecord = map['logRecord'];
2005 logRecord['time'] = 2010 logRecord['time'] =
2006 new DateTime.fromMillisecondsSinceEpoch(logRecord['time']); 2011 new DateTime.fromMillisecondsSinceEpoch(logRecord['time']);
2007 logRecord['level'] = _findLogLevel(logRecord['level']); 2012 logRecord['level'] = _findLogLevel(logRecord['level']);
2008 } 2013 }
2014 if (map['extensionKind'] != null) {
2015 extensionKind = map['extensionKind'];
2016 extensionData = map['extensionData'];
2017 }
2009 } 2018 }
2010 2019
2011 String toString() { 2020 String toString() {
2012 var ownerName = owner.id != null ? owner.id.toString() : owner.name; 2021 var ownerName = owner.id != null ? owner.id.toString() : owner.name;
2013 if (data == null) { 2022 if (data == null) {
2014 return "ServiceEvent(owner='${ownerName}', kind='${kind}', " 2023 return "ServiceEvent(owner='${ownerName}', kind='${kind}', "
2015 "time=${timestamp})"; 2024 "time=${timestamp})";
2016 } else { 2025 } else {
2017 return "ServiceEvent(owner='${ownerName}', kind='${kind}', " 2026 return "ServiceEvent(owner='${ownerName}', kind='${kind}', "
2018 "data.lengthInBytes=${data.lengthInBytes}, time=${timestamp})"; 2027 "data.lengthInBytes=${data.lengthInBytes}, time=${timestamp})";
(...skipping 2037 matching lines...) Expand 10 before | Expand all | Expand 10 after
4056 var v = list[i]; 4065 var v = list[i];
4057 if ((v is ObservableMap) && _isServiceMap(v)) { 4066 if ((v is ObservableMap) && _isServiceMap(v)) {
4058 list[i] = owner.getFromMap(v); 4067 list[i] = owner.getFromMap(v);
4059 } else if (v is ObservableList) { 4068 } else if (v is ObservableList) {
4060 _upgradeObservableList(v, owner); 4069 _upgradeObservableList(v, owner);
4061 } else if (v is ObservableMap) { 4070 } else if (v is ObservableMap) {
4062 _upgradeObservableMap(v, owner); 4071 _upgradeObservableMap(v, owner);
4063 } 4072 }
4064 } 4073 }
4065 } 4074 }
OLDNEW
« no previous file with comments | « runtime/lib/developer.dart ('k') | runtime/observatory/tests/service/developer_extension_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698