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

Unified Diff: chrome/browser/net/url_fetcher.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/net/url_fetcher.h ('k') | chrome/browser/plugin_process_host.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/net/url_fetcher.cc
===================================================================
--- chrome/browser/net/url_fetcher.cc (revision 8565)
+++ chrome/browser/net/url_fetcher.cc (working copy)
@@ -11,7 +11,10 @@
#include "chrome/browser/chrome_thread.h"
#include "googleurl/src/gurl.h"
#include "net/base/load_flags.h"
+#include "net/base/io_buffer.h"
+static const int kBufferSize = 4096;
+
URLFetcher::URLFetcher(const GURL& url,
RequestType request_type,
Delegate* d)
@@ -36,6 +39,7 @@
request_(NULL),
load_flags_(net::LOAD_NORMAL),
response_code_(-1),
+ buffer_(new net::IOBuffer(kBufferSize)),
protect_entry_(URLFetcherProtectManager::GetInstance()->Register(
original_url_.host())),
num_retries_(0) {
@@ -71,7 +75,7 @@
// completed immediately, without trying to read any data back (all we care
// about is the response code and headers, which we already have).
if (request_->status().is_success() && (request_type_ != HEAD))
- request_->Read(buffer_, sizeof(buffer_), &bytes_read);
+ request_->Read(buffer_, kBufferSize, &bytes_read);
OnReadCompleted(request_, bytes_read);
}
@@ -84,8 +88,8 @@
do {
if (!request_->status().is_success() || bytes_read <= 0)
break;
- data_.append(buffer_, bytes_read);
- } while (request_->Read(buffer_, sizeof(buffer_), &bytes_read));
+ data_.append(buffer_->data(), bytes_read);
+ } while (request_->Read(buffer_, kBufferSize, &bytes_read));
if (request_->status().is_success())
request_->GetResponseCookies(&cookies_);
« no previous file with comments | « chrome/browser/net/url_fetcher.h ('k') | chrome/browser/plugin_process_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698