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

Side by Side Diff: components/cronet/android/cronet_upload_data_stream_adapter.cc

Issue 948503004: [Cronet] Enable chunked upload in CronetUrlRequest (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments Created 5 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #include "components/cronet/android/cronet_upload_data_stream_adapter.h" 5 #include "components/cronet/android/cronet_upload_data_stream_adapter.h"
6 6
7 #include "net/base/io_buffer.h" 7 #include "net/base/io_buffer.h"
8 #include "net/base/net_errors.h" 8 #include "net/base/net_errors.h"
9 9
10 namespace cronet { 10 namespace cronet {
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 // if any, will continue. 80 // if any, will continue.
81 waiting_on_read_ = false; 81 waiting_on_read_ = false;
82 waiting_on_rewind_ = false; 82 waiting_on_rewind_ = false;
83 } 83 }
84 84
85 void CronetUploadDataStreamAdapter::OnReadSuccess(int bytes_read, 85 void CronetUploadDataStreamAdapter::OnReadSuccess(int bytes_read,
86 bool final_chunk) { 86 bool final_chunk) {
87 DCHECK(read_in_progress_); 87 DCHECK(read_in_progress_);
88 DCHECK(!rewind_in_progress_); 88 DCHECK(!rewind_in_progress_);
89 DCHECK(bytes_read > 0 || (final_chunk && bytes_read == 0)); 89 DCHECK(bytes_read > 0 || (final_chunk && bytes_read == 0));
90 DCHECK(!is_chunked() || !final_chunk); 90 if (!is_chunked()) {
91 DCHECK(!final_chunk);
92 }
91 93
92 read_in_progress_ = false; 94 read_in_progress_ = false;
93 95
94 if (waiting_on_rewind_) { 96 if (waiting_on_rewind_) {
95 DCHECK(!waiting_on_read_); 97 DCHECK(!waiting_on_read_);
96 // Since a read just completed, can't be at the front of the stream. 98 // Since a read just completed, can't be at the front of the stream.
97 StartRewind(); 99 StartRewind();
98 return; 100 return;
99 } 101 }
100 // ResetInternal has been called, but still waiting on InitInternal. 102 // ResetInternal has been called, but still waiting on InitInternal.
(...skipping 29 matching lines...) Expand all
130 DCHECK(!read_in_progress_); 132 DCHECK(!read_in_progress_);
131 DCHECK(waiting_on_rewind_); 133 DCHECK(waiting_on_rewind_);
132 DCHECK(!rewind_in_progress_); 134 DCHECK(!rewind_in_progress_);
133 DCHECK(!at_front_of_stream_); 135 DCHECK(!at_front_of_stream_);
134 136
135 rewind_in_progress_ = true; 137 rewind_in_progress_ = true;
136 delegate_->Rewind(); 138 delegate_->Rewind();
137 } 139 }
138 140
139 } // namespace cronet 141 } // namespace cronet
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698