OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "net/base/upload_data_stream.h" | 5 #include "net/base/upload_data_stream.h" |
6 | 6 |
7 #include "base/callback_helpers.h" | 7 #include "base/callback_helpers.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "net/base/io_buffer.h" | 9 #include "net/base/io_buffer.h" |
10 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
102 if (result == OK) { | 102 if (result == OK) { |
103 initialized_successfully_ = true; | 103 initialized_successfully_ = true; |
104 if (!is_chunked_ && total_size_ == 0) | 104 if (!is_chunked_ && total_size_ == 0) |
105 is_eof_ = true; | 105 is_eof_ = true; |
106 } | 106 } |
107 if (!callback_.is_null()) | 107 if (!callback_.is_null()) |
108 base::ResetAndReturn(&callback_).Run(result); | 108 base::ResetAndReturn(&callback_).Run(result); |
109 } | 109 } |
110 | 110 |
111 void UploadDataStream::OnReadCompleted(int result) { | 111 void UploadDataStream::OnReadCompleted(int result) { |
112 DCHECK_GE(result, 0); | 112 if (result > 0) { |
113 DCHECK(initialized_successfully_); | 113 DCHECK(initialized_successfully_); |
mmenke
2016/06/06 16:22:33
I think this DCHECK can go before the if.
maksims (do not use this acc)
2016/06/21 11:09:25
Done.
| |
114 | 114 |
115 current_position_ += result; | 115 current_position_ += result; |
116 if (!is_chunked_) { | 116 if (!is_chunked_) { |
117 DCHECK_LE(current_position_, total_size_); | 117 DCHECK_LE(current_position_, total_size_); |
118 if (current_position_ == total_size_) | 118 if (current_position_ == total_size_) |
119 is_eof_ = true; | 119 is_eof_ = true; |
120 } | |
121 | |
122 DCHECK(result > 0 || is_eof_); | |
mmenke
2016/06/06 16:22:33
This DCHECK no longer does anything.
Suggest movi
maksims (do not use this acc)
2016/06/21 11:09:25
Done.
| |
120 } | 123 } |
121 | 124 |
122 DCHECK(result > 0 || is_eof_); | |
123 | |
124 if (!callback_.is_null()) | 125 if (!callback_.is_null()) |
125 base::ResetAndReturn(&callback_).Run(result); | 126 base::ResetAndReturn(&callback_).Run(result); |
126 } | 127 } |
127 | 128 |
128 } // namespace net | 129 } // namespace net |
OLD | NEW |