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

Unified Diff: runtime/bin/socket_patch.dart

Issue 185543004: Merge all http-outgoing transfomers into _HttpOutgoing, including simpler(better) buffering. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Cleanup Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | sdk/lib/io/http_impl.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 27329f139abece776673f92b4604f1e6b353c515..2d1044dafd52027f54a74c88abc4751a54da4680 100644
--- a/runtime/bin/socket_patch.dart
+++ b/runtime/bin/socket_patch.dart
@@ -1179,7 +1179,13 @@ class _SocketStreamConsumer extends StreamConsumer<List<int>> {
assert(buffer == null);
buffer = data;
offset = 0;
- write();
+ try {
+ write();
+ } catch (e) {
+ stop();
+ socket._consumerDone();
+ done(e);
+ }
},
onError: (error, [stackTrace]) {
socket._consumerDone();
@@ -1199,28 +1205,22 @@ class _SocketStreamConsumer extends StreamConsumer<List<int>> {
}
void write() {
- try {
- if (subscription == null) return;
- assert(buffer != null);
- // Write as much as possible.
- offset += socket._write(buffer, offset, buffer.length - offset);
- if (offset < buffer.length) {
- if (!paused) {
- paused = true;
- subscription.pause();
- }
- socket._enableWriteEvent();
- } else {
- buffer = null;
- if (paused) {
- paused = false;
- subscription.resume();
- }
+ if (subscription == null) return;
+ assert(buffer != null);
+ // Write as much as possible.
+ offset += socket._write(buffer, offset, buffer.length - offset);
+ if (offset < buffer.length) {
+ if (!paused) {
+ paused = true;
+ subscription.pause();
+ }
+ socket._enableWriteEvent();
+ } else {
+ buffer = null;
+ if (paused) {
+ paused = false;
+ subscription.resume();
}
- } catch (e) {
- stop();
- socket._consumerDone();
- done(e);
}
}
« no previous file with comments | « no previous file | sdk/lib/io/http_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698