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

Unified Diff: components/cronet/android/url_request_adapter.cc

Issue 737913005: Cronet UrlRequest onAppendChunk now checks that request is not destroyed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Mark tests small. Created 6 years, 1 month 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 | « components/cronet/android/test/javatests/src/org/chromium/cronet_test_apk/UploadTest.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/cronet/android/url_request_adapter.cc
diff --git a/components/cronet/android/url_request_adapter.cc b/components/cronet/android/url_request_adapter.cc
index 8b2df90773dc35ff4143381d5f13b9132d908b38..5d8f84965fc9c59dc616399aa77d4637234728f8 100644
--- a/components/cronet/android/url_request_adapter.cc
+++ b/components/cronet/android/url_request_adapter.cc
@@ -126,6 +126,13 @@ void URLRequestAdapter::Start() {
void URLRequestAdapter::OnAppendChunk(const scoped_ptr<char[]> bytes,
int bytes_len, bool is_last_chunk) {
DCHECK(OnNetworkThread());
+ // Request could have completed and been destroyed on the network thread
+ // while appendChunk was posting the task from an application thread.
+ if (!url_request_) {
+ VLOG(1) << "Cannot append chunk to destroyed request: "
+ << url_.possibly_invalid_spec().c_str();
+ return;
+ }
url_request_->AppendChunkToUpload(bytes.get(), bytes_len, is_last_chunk);
}
« no previous file with comments | « components/cronet/android/test/javatests/src/org/chromium/cronet_test_apk/UploadTest.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698