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

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

Issue 2137163002: Remove unnecessary loop and quit in CronetChunkedOutputStream (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2785
Patch Set: 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 dd0d53c041fbc2bda2e31cfa9665df2c3f9673c7..1f2c1711f7f01a81735455e18e8fd694bf5c46b6 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
@@ -82,11 +82,8 @@ final class CronetChunkedOutputStream extends CronetOutputStream {
@Override
public void close() throws IOException {
- if (!mLastChunk) {
- // Write last chunk.
- mLastChunk = true;
- mMessageLoop.loop();
- }
+ // Last chunk is written.
+ mLastChunk = true;
mClosed = true;
}
@@ -137,9 +134,11 @@ final class CronetChunkedOutputStream extends CronetOutputStream {
byteBuffer.put(mBuffer);
// Reuse this buffer.
mBuffer.clear();
- // Quit message loop so embedder can write more data.
- mMessageLoop.quit();
uploadDataSink.onReadSucceeded(mLastChunk);
+ if (!mLastChunk) {
+ // Quit message loop so embedder can write more data.
+ mMessageLoop.quit();
+ }
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698