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

Unified Diff: components/cronet/android/java/src/org/chromium/net/urlconnection/CronetHttpURLConnection.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: self review 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/CronetHttpURLConnection.java
diff --git a/components/cronet/android/java/src/org/chromium/net/urlconnection/CronetHttpURLConnection.java b/components/cronet/android/java/src/org/chromium/net/urlconnection/CronetHttpURLConnection.java
index d420512f197629930ca7757076209938b3b743eb..5165c9ff2d9b0e4d07f76e5610dd068d32927481 100644
--- a/components/cronet/android/java/src/org/chromium/net/urlconnection/CronetHttpURLConnection.java
+++ b/components/cronet/android/java/src/org/chromium/net/urlconnection/CronetHttpURLConnection.java
@@ -469,13 +469,13 @@ public class CronetHttpURLConnection extends HttpURLConnection {
}
mResponseInfo = info;
mRequest.cancel();
- setResponseDataCompleted(null);
+ setRequestCompleted(null);
}
@Override
public void onSucceeded(UrlRequest request, UrlResponseInfo info) {
mResponseInfo = info;
- setResponseDataCompleted(null);
+ setRequestCompleted(null);
}
@Override
@@ -487,13 +487,13 @@ public class CronetHttpURLConnection extends HttpURLConnection {
}
mResponseInfo = info;
mException = exception;
- setResponseDataCompleted(mException);
+ setRequestCompleted(mException);
}
@Override
public void onCanceled(UrlRequest request, UrlResponseInfo info) {
mResponseInfo = info;
- setResponseDataCompleted(new IOException("stream closed"));
+ setRequestCompleted(new IOException("stream closed"));
}
/**
@@ -502,10 +502,13 @@ public class CronetHttpURLConnection extends HttpURLConnection {
* @param exception if not {@code null}, it is the exception to report when
* caller tries to read more data.
*/
- private void setResponseDataCompleted(IOException exception) {
+ private void setRequestCompleted(IOException exception) {
mef 2016/07/08 17:42:06 Why the rename? Can you update the comment?
xunjieli 2016/07/08 17:56:26 Done. I think it is not neccessary to change it,
if (mInputStream != null) {
mInputStream.setResponseDataCompleted(exception);
}
+ if (mOutputStream != null) {
+ mOutputStream.setRequestCompleted(exception);
+ }
mMessageLoop.quit();
}
}

Powered by Google App Engine
This is Rietveld 408576698