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

Side by Side Diff: net/url_request/url_request_file_dir_job.cc

Issue 1239993004: Fix all failed and canceled URLRequestStatuses without errors. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix more failures Created 5 years, 4 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
« no previous file with comments | « mojo/services/network/url_loader_impl_apptest.cc ('k') | net/url_request/url_request_status.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/url_request/url_request_file_dir_job.h" 5 #include "net/url_request/url_request_file_dir_job.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 // We completed the read, so reset the read buffer. 155 // We completed the read, so reset the read buffer.
156 read_pending_ = false; 156 read_pending_ = false;
157 read_buffer_ = NULL; 157 read_buffer_ = NULL;
158 read_buffer_length_ = 0; 158 read_buffer_length_ = 0;
159 159
160 SetStatus(URLRequestStatus()); 160 SetStatus(URLRequestStatus());
161 NotifyReadComplete(bytes_read); 161 NotifyReadComplete(bytes_read);
162 } else { 162 } else {
163 NOTREACHED(); 163 NOTREACHED();
164 // TODO: Better error code. 164 // TODO: Better error code.
165 NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, 0)); 165 NotifyDone(URLRequestStatus::FromError(ERR_FAILED));
166 } 166 }
167 } 167 }
168 } 168 }
169 169
170 bool URLRequestFileDirJob::FillReadBuffer(char* buf, int buf_size, 170 bool URLRequestFileDirJob::FillReadBuffer(char* buf, int buf_size,
171 int* bytes_read) { 171 int* bytes_read) {
172 DCHECK(bytes_read); 172 DCHECK(bytes_read);
173 173
174 *bytes_read = 0; 174 *bytes_read = 0;
175 175
176 int count = std::min(buf_size, static_cast<int>(data_.size())); 176 int count = std::min(buf_size, static_cast<int>(data_.size()));
177 if (count) { 177 if (count) {
178 memcpy(buf, &data_[0], count); 178 memcpy(buf, &data_[0], count);
179 data_.erase(0, count); 179 data_.erase(0, count);
180 *bytes_read = count; 180 *bytes_read = count;
181 return true; 181 return true;
182 } else if (list_complete_) { 182 } else if (list_complete_) {
183 // EOF 183 // EOF
184 return true; 184 return true;
185 } 185 }
186 return false; 186 return false;
187 } 187 }
188 188
189 } // namespace net 189 } // namespace net
OLDNEW
« no previous file with comments | « mojo/services/network/url_loader_impl_apptest.cc ('k') | net/url_request/url_request_status.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698