| Index: components/cronet/android/java/src/org/chromium/net/urlconnection/CronetChunkedOutputStream.java
|
| diff --git a/components/cronet/android/java/src/org/chromium/net/urlconnection/CronetChunkedOutputStream.java b/components/cronet/android/java/src/org/chromium/net/urlconnection/CronetChunkedOutputStream.java
|
| index 1f2c1711f7f01a81735455e18e8fd694bf5c46b6..ea6d7dcb26700c4dfbba7f6ea629e458cd9dc405 100644
|
| --- a/components/cronet/android/java/src/org/chromium/net/urlconnection/CronetChunkedOutputStream.java
|
| +++ b/components/cronet/android/java/src/org/chromium/net/urlconnection/CronetChunkedOutputStream.java
|
| @@ -25,7 +25,6 @@ final class CronetChunkedOutputStream extends CronetOutputStream {
|
| private final UploadDataProvider mUploadDataProvider = new UploadDataProviderImpl();
|
| private long mBytesWritten;
|
| private boolean mLastChunk = false;
|
| - private boolean mClosed = false;
|
|
|
| /**
|
| * Package protected constructor.
|
| @@ -49,7 +48,7 @@ final class CronetChunkedOutputStream extends CronetOutputStream {
|
|
|
| @Override
|
| public void write(int oneByte) throws IOException {
|
| - checkNotClosed();
|
| + super.write(oneByte);
|
| while (mBuffer.position() == mBuffer.limit()) {
|
| // Wait until buffer is consumed.
|
| mMessageLoop.loop();
|
| @@ -60,7 +59,7 @@ final class CronetChunkedOutputStream extends CronetOutputStream {
|
|
|
| @Override
|
| public void write(byte[] buffer, int offset, int count) throws IOException {
|
| - checkNotClosed();
|
| + super.write(buffer, offset, count);
|
| if (buffer.length - offset < count || offset < 0 || count < 0) {
|
| throw new IndexOutOfBoundsException();
|
| }
|
| @@ -68,8 +67,10 @@ final class CronetChunkedOutputStream extends CronetOutputStream {
|
| return;
|
| }
|
| int toSend = count;
|
| + // TODO(xunjieli): refactor commond code with CronetFixedModeOutputStream.
|
| while (toSend > 0) {
|
| if (mBuffer.position() == mBuffer.limit()) {
|
| + checkNotClosed();
|
| // Wait until buffer is consumed.
|
| mMessageLoop.loop();
|
| }
|
| @@ -82,15 +83,9 @@ final class CronetChunkedOutputStream extends CronetOutputStream {
|
|
|
| @Override
|
| public void close() throws IOException {
|
| + super.close();
|
| // Last chunk is written.
|
| mLastChunk = true;
|
| - mClosed = true;
|
| - }
|
| -
|
| - private void checkNotClosed() throws IOException {
|
| - if (mClosed) {
|
| - throw new IOException("Stream has been closed.");
|
| - }
|
| }
|
|
|
| // Below are CronetOutputStream implementations:
|
|
|