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

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

Issue 2173923002: [Cronet] Mark request as complete when OutputStream fails (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.net.urlconnection; 5 package org.chromium.net.urlconnection;
6 6
7 import org.chromium.base.VisibleForTesting; 7 import org.chromium.base.VisibleForTesting;
8 import org.chromium.net.UploadDataProvider; 8 import org.chromium.net.UploadDataProvider;
9 import org.chromium.net.UploadDataSink; 9 import org.chromium.net.UploadDataSink;
10 10
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 124
125 /** 125 /**
126 * Helper function to upload {@code mBuffer} to the native stack. This 126 * Helper function to upload {@code mBuffer} to the native stack. This
127 * function blocks until {@code mBuffer} is consumed and there is space to 127 * function blocks until {@code mBuffer} is consumed and there is space to
128 * write more data. 128 * write more data.
129 */ 129 */
130 private void uploadBufferInternal() throws IOException { 130 private void uploadBufferInternal() throws IOException {
131 checkNotClosed(); 131 checkNotClosed();
132 mBuffer.flip(); 132 mBuffer.flip();
133 mMessageLoop.loop(); 133 mMessageLoop.loop();
134 checkNoException();
134 } 135 }
135 136
136 /** 137 /**
137 * Throws {@link java.net.ProtocolException} if adding {@code numBytes} will 138 * Throws {@link java.net.ProtocolException} if adding {@code numBytes} will
138 * exceed content length. 139 * exceed content length.
139 */ 140 */
140 private void checkNotExceedContentLength(int numBytes) throws ProtocolExcept ion { 141 private void checkNotExceedContentLength(int numBytes) throws ProtocolExcept ion {
141 if (mBytesWritten + numBytes > mContentLength) { 142 if (mBytesWritten + numBytes > mContentLength) {
142 throw new ProtocolException("expected " 143 throw new ProtocolException("expected "
143 + (mContentLength - mBytesWritten) + " bytes but received " 144 + (mContentLength - mBytesWritten) + " bytes but received "
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 } 197 }
197 198
198 /** 199 /**
199 * Sets the default buffer length for use in tests. 200 * Sets the default buffer length for use in tests.
200 */ 201 */
201 @VisibleForTesting 202 @VisibleForTesting
202 static void setDefaultBufferLengthForTesting(int length) { 203 static void setDefaultBufferLengthForTesting(int length) {
203 sDefaultBufferLength = length; 204 sDefaultBufferLength = length;
204 } 205 }
205 } 206 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698