| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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; | 5 package org.chromium.net; |
| 6 | 6 |
| 7 import android.util.Log; | 7 import android.util.Log; |
| 8 | 8 |
| 9 import org.apache.http.conn.ConnectTimeoutException; | 9 import org.apache.http.conn.ConnectTimeoutException; |
| 10 import org.chromium.base.CalledByNative; | 10 import org.chromium.base.CalledByNative; |
| (...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 mUploadData); | 352 mUploadData); |
| 353 } else if (mUploadChannel != null) { | 353 } else if (mUploadChannel != null) { |
| 354 nativeSetUploadChannel(mUrlRequestAdapter, mUploadContentType, | 354 nativeSetUploadChannel(mUrlRequestAdapter, mUploadContentType, |
| 355 mUploadContentLength); | 355 mUploadContentLength); |
| 356 } else if (mChunkedUpload) { | 356 } else if (mChunkedUpload) { |
| 357 nativeEnableChunkedUpload(mUrlRequestAdapter, | 357 nativeEnableChunkedUpload(mUrlRequestAdapter, |
| 358 mUploadContentType); | 358 mUploadContentType); |
| 359 } | 359 } |
| 360 | 360 |
| 361 nativeStart(mUrlRequestAdapter); | 361 nativeStart(mUrlRequestAdapter); |
| 362 } | 362 } |
| 363 } | 363 } |
| 364 | 364 |
| 365 @Override | 365 @Override |
| 366 public void cancel() { | 366 public void cancel() { |
| 367 synchronized (mLock) { | 367 synchronized (mLock) { |
| 368 if (mCanceled) { | 368 if (mCanceled) { |
| 369 return; | 369 return; |
| 370 } | 370 } |
| 371 | 371 |
| 372 mCanceled = true; | 372 mCanceled = true; |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 503 private void onResponseStarted() { | 503 private void onResponseStarted() { |
| 504 try { | 504 try { |
| 505 mContentType = nativeGetContentType(mUrlRequestAdapter); | 505 mContentType = nativeGetContentType(mUrlRequestAdapter); |
| 506 mContentLength = nativeGetContentLength(mUrlRequestAdapter); | 506 mContentLength = nativeGetContentLength(mUrlRequestAdapter); |
| 507 mHeadersAvailable = true; | 507 mHeadersAvailable = true; |
| 508 | 508 |
| 509 if (mContentLengthLimit > 0 && | 509 if (mContentLengthLimit > 0 && |
| 510 mContentLength > mContentLengthLimit && | 510 mContentLength > mContentLengthLimit && |
| 511 mCancelIfContentLengthOverLimit) { | 511 mCancelIfContentLengthOverLimit) { |
| 512 onContentLengthOverLimit(); | 512 onContentLengthOverLimit(); |
| 513 return; | 513 return; |
| 514 } | 514 } |
| 515 | 515 |
| 516 if (mBufferFullResponse && mContentLength != -1 && | 516 if (mBufferFullResponse && mContentLength != -1 && |
| 517 !mContentLengthOverLimit) { | 517 !mContentLengthOverLimit) { |
| 518 ((ChunkedWritableByteChannel) getSink()).setCapacity( | 518 ((ChunkedWritableByteChannel) getSink()).setCapacity( |
| 519 (int) mContentLength); | 519 (int) mContentLength); |
| 520 } | 520 } |
| 521 | 521 |
| 522 if (mOffset != 0) { | 522 if (mOffset != 0) { |
| 523 // The server may ignore the request for a byte range, in which | 523 // The server may ignore the request for a byte range, in which |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 699 | 699 |
| 700 private native void nativeGetAllHeaders(long urlRequestAdapter, | 700 private native void nativeGetAllHeaders(long urlRequestAdapter, |
| 701 ResponseHeadersMap headers); | 701 ResponseHeadersMap headers); |
| 702 | 702 |
| 703 private native String nativeGetNegotiatedProtocol(long urlRequestAdapter); | 703 private native String nativeGetNegotiatedProtocol(long urlRequestAdapter); |
| 704 | 704 |
| 705 // Explicit class to work around JNI-generator generics confusion. | 705 // Explicit class to work around JNI-generator generics confusion. |
| 706 private class ResponseHeadersMap extends HashMap<String, List<String>> { | 706 private class ResponseHeadersMap extends HashMap<String, List<String>> { |
| 707 } | 707 } |
| 708 } | 708 } |
| OLD | NEW |