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

Unified Diff: components/cronet/android/java/src/org/chromium/net/urlconnection/CronetFixedModeOutputStream.java

Issue 2131323002: [Cronet] Check whether request is done before spinning up message loop (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comment Created 4 years, 5 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: components/cronet/android/java/src/org/chromium/net/urlconnection/CronetFixedModeOutputStream.java
diff --git a/components/cronet/android/java/src/org/chromium/net/urlconnection/CronetFixedModeOutputStream.java b/components/cronet/android/java/src/org/chromium/net/urlconnection/CronetFixedModeOutputStream.java
index 6f83f0022c053c5193e85b3fdcaf92264a55da81..3da329169cb9b5c51bc507be86281476202b88f1 100644
--- a/components/cronet/android/java/src/org/chromium/net/urlconnection/CronetFixedModeOutputStream.java
+++ b/components/cronet/android/java/src/org/chromium/net/urlconnection/CronetFixedModeOutputStream.java
@@ -73,6 +73,7 @@ final class CronetFixedModeOutputStream extends CronetOutputStream {
@Override
public void write(int oneByte) throws IOException {
+ checkNotClosed();
checkNotExceedContentLength(1);
ensureBufferHasRemaining();
mBuffer.put((byte) oneByte);
@@ -82,6 +83,7 @@ final class CronetFixedModeOutputStream extends CronetOutputStream {
@Override
public void write(byte[] buffer, int offset, int count) throws IOException {
+ checkNotClosed();
if (buffer.length - offset < count || offset < 0 || count < 0) {
throw new IndexOutOfBoundsException();
}
@@ -126,6 +128,7 @@ final class CronetFixedModeOutputStream extends CronetOutputStream {
* write more data.
*/
private void uploadBufferInternal() throws IOException {
+ checkNotClosed();
mBuffer.flip();
mMessageLoop.loop();
}
@@ -142,8 +145,6 @@ final class CronetFixedModeOutputStream extends CronetOutputStream {
}
}
- // TODO(xunjieli): implement close().
-
// Below are CronetOutputStream implementations:
@Override

Powered by Google App Engine
This is Rietveld 408576698