Chromium Code Reviews| Index: components/cronet/android/java/src/org/chromium/net/CronetUrlRequest.java |
| diff --git a/components/cronet/android/java/src/org/chromium/net/CronetUrlRequest.java b/components/cronet/android/java/src/org/chromium/net/CronetUrlRequest.java |
| index e03e97dde1463e8ce594a9b54d2bc6355fd0c5de..3c99d95e85c5e4367bf545015578a827a309af56 100644 |
| --- a/components/cronet/android/java/src/org/chromium/net/CronetUrlRequest.java |
| +++ b/components/cronet/android/java/src/org/chromium/net/CronetUrlRequest.java |
| @@ -210,8 +210,7 @@ final class CronetUrlRequest implements UrlRequest { |
| throw new IllegalArgumentException( |
| "Requests with upload data must have a Content-Type."); |
| } |
| - mStarted = true; |
|
mef
2016/03/10 17:10:39
This was also a problem as 'isDone' is looking at
xunjieli
2016/03/10 17:29:53
But if start() is called a second time before the
mef
2016/03/10 17:44:05
Ah, excellent point! Done.
|
| - mUploadDataStream.attachToRequest(this, mUrlRequestAdapter, new Runnable() { |
| + mUploadDataStream.postTaskToExecutor(new Runnable() { |
| @Override |
| public void run() { |
| synchronized (mUrlRequestAdapterLock) { |
| @@ -227,19 +226,25 @@ final class CronetUrlRequest implements UrlRequest { |
| destroyRequestAdapter(false); |
| throw e; |
| } |
| - mStarted = true; |
| startInternalLocked(); |
| } |
| } |
| @GuardedBy("mUrlRequestAdapterLock") |
| private void startInternalLocked() { |
| + if (mUrlRequestAdapter == 0) { |
| + return; |
| + } |
| + if (mUploadDataStream != null) { |
| + mUploadDataStream.attachToRequest(this, mUrlRequestAdapter); |
|
mef
2016/03/10 17:10:39
attach only if request is still valid.
|
| + } |
| if (mDisableCache) { |
| nativeDisableCache(mUrlRequestAdapter); |
| } |
| if (mRequestMetricsAccumulator != null) { |
| mRequestMetricsAccumulator.onRequestStarted(); |
| } |
| + mStarted = true; |
| nativeStart(mUrlRequestAdapter); |
| } |