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

Side by Side Diff: sdk/lib/io/io_resource_info.dart

Issue 1680593004: dart:developer service extension fixes (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « sdk/lib/io/file_impl.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 dart.io; 5 part of dart.io;
6 6
7 abstract class _IOResourceInfo { 7 abstract class _IOResourceInfo {
8 final String type; 8 final String type;
9 final int id; 9 final int id;
10 String get name; 10 String get name;
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 static FileClosed(_FileResourceInfo info) { 105 static FileClosed(_FileResourceInfo info) {
106 assert(openFiles.containsKey(info.id)); 106 assert(openFiles.containsKey(info.id));
107 openFiles.remove(info.id); 107 openFiles.remove(info.id);
108 } 108 }
109 109
110 static Iterable<Map<String, String>> getOpenFilesList() { 110 static Iterable<Map<String, String>> getOpenFilesList() {
111 return new List.from(openFiles.values.map((e) => e.referenceValueMap)); 111 return new List.from(openFiles.values.map((e) => e.referenceValueMap));
112 } 112 }
113 113
114 static Future<ServiceExtensionResponse> getOpenFiles(function, params) { 114 static Future<ServiceExtensionResponse> getOpenFiles(function, params) {
115 assert(function == '__getOpenFiles'); 115 assert(function == 'ext.dart.io.getOpenFiles');
116 var data = {'type': '_openfiles', 'data': getOpenFilesList()}; 116 var data = {'type': '_openfiles', 'data': getOpenFilesList()};
117 var json = JSON.encode(data); 117 var json = JSON.encode(data);
118 return new Future.value(new ServiceExtensionResponse.result(json)); 118 return new Future.value(new ServiceExtensionResponse.result(json));
119 } 119 }
120 120
121 Map<String, String> getFileInfoMap() { 121 Map<String, String> getFileInfoMap() {
122 var result = fullValueMap; 122 var result = fullValueMap;
123 return result; 123 return result;
124 } 124 }
125 125
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 static ProcessStopped(_ProcessResourceInfo info) { 175 static ProcessStopped(_ProcessResourceInfo info) {
176 assert(startedProcesses.containsKey(info.id)); 176 assert(startedProcesses.containsKey(info.id));
177 startedProcesses.remove(info.id); 177 startedProcesses.remove(info.id);
178 } 178 }
179 179
180 static Iterable<Map<String, String>> getStartedProcessesList() => 180 static Iterable<Map<String, String>> getStartedProcessesList() =>
181 new List.from(startedProcesses.values.map((e) => e.referenceValueMap)); 181 new List.from(startedProcesses.values.map((e) => e.referenceValueMap));
182 182
183 static Future<ServiceExtensionResponse> getStartedProcesses( 183 static Future<ServiceExtensionResponse> getStartedProcesses(
184 String function, Map<String, String> params) { 184 String function, Map<String, String> params) {
185 assert(function == '__getProcesses'); 185 assert(function == 'ext.dart.io.getProcesses');
186 var data = {'type': '_startedprocesses', 'data': getStartedProcessesList()}; 186 var data = {'type': '_startedprocesses', 'data': getStartedProcessesList()};
187 var json = JSON.encode(data); 187 var json = JSON.encode(data);
188 return new Future.value(new ServiceExtensionResponse.result(json)); 188 return new Future.value(new ServiceExtensionResponse.result(json));
189 } 189 }
190 190
191 static Future<ServiceExtensionResponse> getProcessInfoMapById( 191 static Future<ServiceExtensionResponse> getProcessInfoMapById(
192 String function, Map<String, String> params) { 192 String function, Map<String, String> params) {
193 var id = int.parse(params['id']); 193 var id = int.parse(params['id']);
194 var result = startedProcesses.containsKey(id) 194 var result = startedProcesses.containsKey(id)
195 ? startedProcesses[id].fullValueMap 195 ? startedProcesses[id].fullValueMap
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 String function, Map<String, String> params) { 257 String function, Map<String, String> params) {
258 assert(params.containsKey('id')); 258 assert(params.containsKey('id'));
259 var id = int.parse(params['id']); 259 var id = int.parse(params['id']);
260 var result = 260 var result =
261 openSockets.containsKey(id) ? openSockets[id].getSocketInfoMap() : {}; 261 openSockets.containsKey(id) ? openSockets[id].getSocketInfoMap() : {};
262 var json = JSON.encode(result); 262 var json = JSON.encode(result);
263 return new Future.value(new ServiceExtensionResponse.result(json)); 263 return new Future.value(new ServiceExtensionResponse.result(json));
264 } 264 }
265 265
266 static Future<ServiceExtensionResponse> getOpenSockets(function, params) { 266 static Future<ServiceExtensionResponse> getOpenSockets(function, params) {
267 assert(function == '__getOpenSockets'); 267 assert(function == 'ext.dart.io.getOpenSockets');
268 var data = {'type': '_opensockets', 'data': getOpenSocketsList()}; 268 var data = {'type': '_opensockets', 'data': getOpenSocketsList()};
269 var json = JSON.encode(data); 269 var json = JSON.encode(data);
270 return new Future.value(new ServiceExtensionResponse.result(json)); 270 return new Future.value(new ServiceExtensionResponse.result(json));
271 } 271 }
272 272
273 static SocketOpened(_SocketResourceInfo info) { 273 static SocketOpened(_SocketResourceInfo info) {
274 assert(!openSockets.containsKey(info.id)); 274 assert(!openSockets.containsKey(info.id));
275 openSockets[info.id] = info; 275 openSockets[info.id] = info;
276 } 276 }
277 277
278 static SocketClosed(_SocketResourceInfo info) { 278 static SocketClosed(_SocketResourceInfo info) {
279 assert(openSockets.containsKey(info.id)); 279 assert(openSockets.containsKey(info.id));
280 openSockets.remove(info.id); 280 openSockets.remove(info.id);
281 } 281 }
282 282
283 } 283 }
OLDNEW
« no previous file with comments | « sdk/lib/io/file_impl.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698