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

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

Issue 18390: Change URLRequest to use a ref-counted buffer for actual IO.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « net/url_request/url_request_inet_job.h ('k') | net/url_request/url_request_job.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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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_inet_job.h" 5 #include "net/url_request/url_request_inet_job.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 CleanupConnection(); 178 CleanupConnection();
179 } 179 }
180 NotifyReadComplete(bytes_read); 180 NotifyReadComplete(bytes_read);
181 } else { 181 } else {
182 // If we get here, an IO is completing which we didn't 182 // If we get here, an IO is completing which we didn't
183 // start or we lost track of our state. 183 // start or we lost track of our state.
184 NOTREACHED(); 184 NOTREACHED();
185 } 185 }
186 } 186 }
187 187
188 bool URLRequestInetJob::ReadRawData(char* dest, int dest_size, 188 bool URLRequestInetJob::ReadRawData(net::IOBuffer* dest, int dest_size,
189 int *bytes_read) { 189 int *bytes_read) {
190 if (is_done()) 190 if (is_done())
191 return 0; 191 return 0;
192 192
193 DCHECK_NE(dest_size, 0); 193 DCHECK_NE(dest_size, 0);
194 DCHECK_NE(bytes_read, (int*)NULL); 194 DCHECK_NE(bytes_read, (int*)NULL);
195 DCHECK(!read_in_progress_); 195 DCHECK(!read_in_progress_);
196 196
197 *bytes_read = 0; 197 *bytes_read = 0;
198 198
199 int result = CallInternetRead(dest, dest_size, bytes_read); 199 int result = CallInternetRead(dest->data(), dest_size, bytes_read);
200 if (result == ERROR_SUCCESS) { 200 if (result == ERROR_SUCCESS) {
201 DLOG(INFO) << "read " << *bytes_read << " bytes"; 201 DLOG(INFO) << "read " << *bytes_read << " bytes";
202 if (*bytes_read == 0) 202 if (*bytes_read == 0)
203 CleanupConnection(); // finished reading all the data 203 CleanupConnection(); // finished reading all the data
204 return true; 204 return true;
205 } 205 }
206 206
207 if (ProcessRequestError(result)) 207 if (ProcessRequestError(result))
208 read_in_progress_ = true; 208 read_in_progress_ = true;
209 209
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 break; 371 break;
372 } 372 }
373 case INTERNET_STATUS_USER_INPUT_REQUIRED: 373 case INTERNET_STATUS_USER_INPUT_REQUIRED:
374 case INTERNET_STATUS_STATE_CHANGE: 374 case INTERNET_STATUS_STATE_CHANGE:
375 // TODO(darin): This is probably a security problem. Do something better. 375 // TODO(darin): This is probably a security problem. Do something better.
376 ResumeSuspendedDownload(handle, 0); 376 ResumeSuspendedDownload(handle, 0);
377 break; 377 break;
378 } 378 }
379 } 379 }
380 380
OLDNEW
« no previous file with comments | « net/url_request/url_request_inet_job.h ('k') | net/url_request/url_request_job.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698