diff options
author | rvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-24 01:54:05 +0000 |
---|---|---|
committer | rvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-24 01:54:05 +0000 |
commit | 1f8859ad6ec7ea807c0330ddf5559e13be5fb26c (patch) | |
tree | 68887107d0d40f1b22c7a7a07ccd9d7e4caf157a /net/proxy | |
parent | 13dc122db24457653d57ff07791043d518eb05e7 (diff) | |
download | chromium_src-1f8859ad6ec7ea807c0330ddf5559e13be5fb26c.zip chromium_src-1f8859ad6ec7ea807c0330ddf5559e13be5fb26c.tar.gz chromium_src-1f8859ad6ec7ea807c0330ddf5559e13be5fb26c.tar.bz2 |
Change URLRequest to use a ref-counted buffer for actual IO.The ref-counting will prevent the deletion / reuse of memorywhile the buffer is actually being used by pending IO.This seems a very intrusive change, but at least we will be ableto make sure that it works without having to chase every singledestruction of an URLRequest to make sure that any pending IOwas cancelled, and also allows us to avoid blocking onthe object destruction.BUG=5325
Review URL: http://codereview.chromium.org/18390
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8603 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/proxy')
-rw-r--r-- | net/proxy/proxy_script_fetcher.cc | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/net/proxy/proxy_script_fetcher.cc b/net/proxy/proxy_script_fetcher.cc index 4f9f603..b48ee1a 100644 --- a/net/proxy/proxy_script_fetcher.cc +++ b/net/proxy/proxy_script_fetcher.cc @@ -6,7 +6,9 @@ #include "base/compiler_specific.h" #include "base/message_loop.h" +#include "base/ref_counted.h" #include "base/string_util.h" +#include "net/base/io_buffer.h" #include "net/base/load_flags.h" #include "net/url_request/url_request.h" @@ -77,7 +79,7 @@ class ProxyScriptFetcherImpl : public ProxyScriptFetcher, // Buffer that URLRequest writes into. enum { kBufSize = 4096 }; - char buf_[kBufSize]; + scoped_refptr<net::IOBuffer> buf_; // The next ID to use for |cur_request_| (monotonically increasing). int next_id_; @@ -105,6 +107,7 @@ ProxyScriptFetcherImpl::ProxyScriptFetcherImpl( URLRequestContext* url_request_context) : ALLOW_THIS_IN_INITIALIZER_LIST(task_factory_(this)), url_request_context_(url_request_context), + buf_(new net::IOBuffer(kBufSize)), next_id_(0), cur_request_(NULL), cur_request_id_(0), @@ -217,7 +220,7 @@ void ProxyScriptFetcherImpl::OnReadCompleted(URLRequest* request, request->Cancel(); return; } - result_bytes_->append(buf_, num_bytes); + result_bytes_->append(buf_->data(), num_bytes); ReadBody(request); } else { // Error while reading, or EOF OnResponseCompleted(request); |