| OLD | NEW |
| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 // if there are some bytes available). | 47 // if there are some bytes available). |
| 48 void addRead(int bytes) { | 48 void addRead(int bytes) { |
| 49 totalRead += bytes; | 49 totalRead += bytes; |
| 50 readCount++; | 50 readCount++; |
| 51 lastRead = _IOResourceInfo.timestamp; | 51 lastRead = _IOResourceInfo.timestamp; |
| 52 } | 52 } |
| 53 | 53 |
| 54 // In cases where we read but did not neccesarily get any bytes, use this to | 54 // In cases where we read but did not neccesarily get any bytes, use this to |
| 55 // update the readCount and timestamp. Manually update totalRead if any bytes | 55 // update the readCount and timestamp. Manually update totalRead if any bytes |
| 56 // where acutally read. | 56 // where acutally read. |
| 57 void didRead() => addRead(0); | 57 void didRead() { addRead(0); } |
| 58 | 58 |
| 59 void addWrite(int bytes) { | 59 void addWrite(int bytes) { |
| 60 totalWritten += bytes; | 60 totalWritten += bytes; |
| 61 writeCount++; | 61 writeCount++; |
| 62 lastWrite = _IOResourceInfo.timestamp; | 62 lastWrite = _IOResourceInfo.timestamp; |
| 63 } | 63 } |
| 64 | 64 |
| 65 _ReadWriteResourceInfo(String type) : | 65 _ReadWriteResourceInfo(String type) : |
| 66 totalRead = 0, | 66 totalRead = 0, |
| 67 totalWritten = 0, | 67 totalWritten = 0, |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 new Map<int, _ProcessResourceInfo>(); | 146 new Map<int, _ProcessResourceInfo>(); |
| 147 | 147 |
| 148 _ProcessResourceInfo(this.process) : | 148 _ProcessResourceInfo(this.process) : |
| 149 startedAt = _IOResourceInfo.timestamp, | 149 startedAt = _IOResourceInfo.timestamp, |
| 150 super(TYPE) { | 150 super(TYPE) { |
| 151 ProcessStarted(this); | 151 ProcessStarted(this); |
| 152 } | 152 } |
| 153 | 153 |
| 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 'startedAt': startedAt, | 164 'startedAt': startedAt, |
| 165 'arguments': process._arguments, | 165 'arguments': process._arguments, |
| 166 'workingDirectory': | 166 'workingDirectory': |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 } |
| OLD | NEW |