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

Unified Diff: runtime/bin/socket_patch.dart

Issue 1320023008: Refactor the io resource classes (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: address comments 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | runtime/observatory/tests/service/tcp_socket_service_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/socket_patch.dart
diff --git a/runtime/bin/socket_patch.dart b/runtime/bin/socket_patch.dart
index be459ba164dd2c653ae3b0e4ee2d8175db0d197e..47e5f444f16026cc20c4929491e7b05054fc9854 100644
--- a/runtime/bin/socket_patch.dart
+++ b/runtime/bin/socket_patch.dart
@@ -313,8 +313,6 @@ class _NativeSocket extends _NativeSocketNativeWrapper with _ServiceObject {
bool writeEventIssued = false;
bool writeAvailable = false;
- static final Stopwatch sw = new Stopwatch()..start();
-
static bool connectedResourceHandler = false;
_ReadWriteResourceInfo resourceInfo;
@@ -584,8 +582,7 @@ class _NativeSocket extends _NativeSocketNativeWrapper with _ServiceObject {
// TODO(ricow): Remove when we track internal and pipe uses.
assert(resourceInfo != null || isPipe || isInternal);
if (resourceInfo != null) {
- resourceInfo.readCount++;
- resourceInfo.lastRead = timestamp;
+ resourceInfo.didRead();
}
return result;
}
@@ -612,8 +609,7 @@ class _NativeSocket extends _NativeSocketNativeWrapper with _ServiceObject {
// TODO(ricow): Remove when we track internal and pipe uses.
assert(resourceInfo != null || isPipe || isInternal);
if (resourceInfo != null) {
- resourceInfo.readCount++;
- resourceInfo.lastRead = timestamp;
+ resourceInfo.didRead();
}
return result;
}
@@ -656,9 +652,7 @@ class _NativeSocket extends _NativeSocketNativeWrapper with _ServiceObject {
// TODO(ricow): Remove when we track internal and pipe uses.
assert(resourceInfo != null || isPipe || isInternal);
if (resourceInfo != null) {
- resourceInfo.totalWritten += result;
- resourceInfo.writeCount++;
- resourceInfo.lastWrite = timestamp;
+ resourceInfo.addWrite(result);
}
return result;
}
@@ -679,9 +673,7 @@ class _NativeSocket extends _NativeSocketNativeWrapper with _ServiceObject {
// TODO(ricow): Remove when we track internal and pipe uses.
assert(resourceInfo != null || isPipe || isInternal);
if (resourceInfo != null) {
- resourceInfo.totalWritten += result;
- resourceInfo.writeCount++;
- resourceInfo.lastWrite = timestamp;
+ resourceInfo.addWrite(result);
}
return result;
}
@@ -701,8 +693,8 @@ class _NativeSocket extends _NativeSocketNativeWrapper with _ServiceObject {
// TODO(ricow): Remove when we track internal and pipe uses.
assert(resourceInfo != null || isPipe || isInternal);
if (resourceInfo != null) {
- resourceInfo.totalRead += 1;
- resourceInfo.lastRead = timestamp;
+ // We track this as read one byte.
+ resourceInfo.addRead(1);
}
return socket;
}
« no previous file with comments | « no previous file | runtime/observatory/tests/service/tcp_socket_service_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698