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

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

Issue 1343033002: Use cammelCase for all service extension variables (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 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 | « runtime/observatory/tests/service/udp_socket_service_test.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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 writeCount = 0, 69 writeCount = 0,
70 lastRead = 0.0, 70 lastRead = 0.0,
71 lastWrite = 0.0, 71 lastWrite = 0.0,
72 super(type); 72 super(type);
73 73
74 Map<String, String> get fullValueMap => 74 Map<String, String> get fullValueMap =>
75 { 75 {
76 'type': type, 76 'type': type,
77 'id': id, 77 'id': id,
78 'name': name, 78 'name': name,
79 'total_read': totalRead, 79 'totalRead': totalRead,
80 'total_written': totalWritten, 80 'totalWritten': totalWritten,
81 'read_count': readCount, 81 'readCount': readCount,
82 'write_count': writeCount, 82 'writeCount': writeCount,
83 'last_read': lastRead, 83 'lastRead': lastRead,
84 'last_write': lastWrite 84 'lastWrite': lastWrite
85 }; 85 };
86 } 86 }
87 87
88 class _FileResourceInfo extends _ReadWriteResourceInfo { 88 class _FileResourceInfo extends _ReadWriteResourceInfo {
89 static const String TYPE = '_file'; 89 static const String TYPE = '_file';
90 90
91 final file; 91 final file;
92 92
93 static Map<int, _FileResourceInfo> openFiles = 93 static Map<int, _FileResourceInfo> openFiles =
94 new Map<int, _FileResourceInfo>(); 94 new Map<int, _FileResourceInfo>();
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 String get name => process._path; 154 String get name => process._path;
155 155
156 void stopped() => ProcessStopped(this); 156 void stopped() => ProcessStopped(this);
157 157
158 Map<String, String> get fullValueMap => 158 Map<String, String> get fullValueMap =>
159 { 159 {
160 'type': type, 160 'type': type,
161 'id': id, 161 'id': id,
162 'name': name, 162 'name': name,
163 'pid': process.pid, 163 'pid': process.pid,
164 'started_at': startedAt, 164 'startedAt': startedAt,
165 'arguments': process._arguments, 165 'arguments': process._arguments,
166 'working_directory': 166 'workingDirectory':
167 process._workingDirectory == null ? '.' : process._workingDirectory, 167 process._workingDirectory == null ? '.' : process._workingDirectory,
168 }; 168 };
169 169
170 static ProcessStarted(_ProcessResourceInfo info) { 170 static ProcessStarted(_ProcessResourceInfo info) {
171 assert(!startedProcesses.containsKey(info.id)); 171 assert(!startedProcesses.containsKey(info.id));
172 startedProcesses[info.id] = info; 172 startedProcesses[info.id] = info;
173 } 173 }
174 174
175 static ProcessStopped(_ProcessResourceInfo info) { 175 static ProcessStopped(_ProcessResourceInfo info) {
176 assert(startedProcesses.containsKey(info.id)); 176 assert(startedProcesses.containsKey(info.id));
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 } catch (e) { } // ignored if we can't get the information 225 } catch (e) { } // ignored if we can't get the information
226 return '${socket.address.host}:${socket.port}$remote'; 226 return '${socket.address.host}:${socket.port}$remote';
227 } 227 }
228 228
229 static Iterable<Map<String, String>> getOpenSocketsList() { 229 static Iterable<Map<String, String>> getOpenSocketsList() {
230 return new List.from(openSockets.values.map((e) => e.referenceValueMap)); 230 return new List.from(openSockets.values.map((e) => e.referenceValueMap));
231 } 231 }
232 232
233 Map<String, String> getSocketInfoMap() { 233 Map<String, String> getSocketInfoMap() {
234 var result = fullValueMap; 234 var result = fullValueMap;
235 result['socket_type'] = socket.isTcp ? TCP_STRING : UDP_STRING; 235 result['socketType'] = socket.isTcp ? TCP_STRING : UDP_STRING;
236 result['listening'] = socket.isListening; 236 result['listening'] = socket.isListening;
237 result['host'] = socket.address.host; 237 result['host'] = socket.address.host;
238 result['port'] = socket.port; 238 result['port'] = socket.port;
239 if (!socket.isListening) { 239 if (!socket.isListening) {
240 try { 240 try {
241 result['remote_host'] = socket.remoteAddress.host; 241 result['remoteHost'] = socket.remoteAddress.host;
242 result['remote_port'] = socket.remotePort; 242 result['remotePort'] = socket.remotePort;
243 } catch (e) { 243 } catch (e) {
244 // UDP. 244 // UDP.
245 result['remote_port'] = 'NA'; 245 result['remotePort'] = 'NA';
246 result['remote_host'] = 'NA'; 246 result['remoteHost'] = 'NA';
247 } 247 }
248 } else { 248 } else {
249 result['remote_port'] = 'NA'; 249 result['remotePort'] = 'NA';
250 result['remote_host'] = 'NA'; 250 result['remoteHost'] = 'NA';
251 } 251 }
252 result['address_type'] = socket.address.type.name; 252 result['addressType'] = socket.address.type.name;
253 return result; 253 return result;
254 } 254 }
255 255
256 static Future<ServiceExtensionResponse> getSocketInfoMapByID( 256 static Future<ServiceExtensionResponse> getSocketInfoMapByID(
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);
(...skipping 11 matching lines...) Expand all
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 | « runtime/observatory/tests/service/udp_socket_service_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698