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

Unified Diff: runtime/bin/http_impl.dart

Issue 10832188: Add an OutputStream.closed getter. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 4 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
Index: runtime/bin/http_impl.dart
diff --git a/runtime/bin/http_impl.dart b/runtime/bin/http_impl.dart
index c664c512ca6bce3de537be4395153ad939e7dd1a..8a68b9018677a17e50085653dd962260b25a5428 100644
--- a/runtime/bin/http_impl.dart
+++ b/runtime/bin/http_impl.dart
@@ -709,6 +709,8 @@ class _HttpRequestResponseBase {
HttpConnectionInfo get connectionInfo() => _httpConnection.connectionInfo;
+ bool get _done() => _state == DONE;
+
int _state;
bool _headResponse;
@@ -945,12 +947,12 @@ class _HttpResponse extends _HttpRequestResponseBase implements HttpResponse {
// Delegate functions for the HttpOutputStream implementation.
bool _streamWrite(List<int> buffer, bool copyBuffer) {
- if (_state == DONE) throw new HttpException("Response closed");
+ if (_done) throw new HttpException("Response closed");
return _write(buffer, copyBuffer);
}
bool _streamWriteFrom(List<int> buffer, int offset, int len) {
- if (_state == DONE) throw new HttpException("Response closed");
+ if (_done) throw new HttpException("Response closed");
return _writeList(buffer, offset, len);
}
@@ -1137,6 +1139,8 @@ class _HttpOutputStream extends _BaseOutputStream implements OutputStream {
_requestOrResponse._streamClose();
}
+ bool get closed() => _requestOrResponse._done;
+
void destroy() {
throw "Not implemented";
}
@@ -1517,7 +1521,7 @@ class _HttpClientRequest
}
OutputStream get outputStream() {
- if (_state == DONE) throw new HttpException("Request closed");
+ if (_done) throw new HttpException("Request closed");
if (_outputStream == null) {
_outputStream = new _HttpOutputStream(this);
}
@@ -1526,12 +1530,12 @@ class _HttpClientRequest
// Delegate functions for the HttpOutputStream implementation.
bool _streamWrite(List<int> buffer, bool copyBuffer) {
- if (_state == DONE) throw new HttpException("Request closed");
+ if (_done) throw new HttpException("Request closed");
return _write(buffer, copyBuffer);
}
bool _streamWriteFrom(List<int> buffer, int offset, int len) {
- if (_state == DONE) throw new HttpException("Request closed");
+ if (_done) throw new HttpException("Request closed");
return _writeList(buffer, offset, len);
}

Powered by Google App Engine
This is Rietveld 408576698