diff options
author | rvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-01 18:30:48 +0000 |
---|---|---|
committer | rvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-01 18:30:48 +0000 |
commit | ef610457ca8d0d43594a765e2b1f1ea194c5a591 (patch) | |
tree | be6ff36d07f9b2e7a740eb8a40645ab0ec0cba6c /net | |
parent | 53b891fee34d1db4f5f0b036c1009f4ad46ef673 (diff) | |
download | chromium_src-ef610457ca8d0d43594a765e2b1f1ea194c5a591.zip chromium_src-ef610457ca8d0d43594a765e2b1f1ea194c5a591.tar.gz chromium_src-ef610457ca8d0d43594a765e2b1f1ea194c5a591.tar.bz2 |
Http cache: reorder some functions. No code change.
I'm just making the order of the methods match the
order of declaration again.
BUG=nonde
TEST=none
Review URL: http://codereview.chromium.org/175042
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25062 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r-- | net/http/http_cache.cc | 151 |
1 files changed, 74 insertions, 77 deletions
diff --git a/net/http/http_cache.cc b/net/http/http_cache.cc index d963c3a1..727a059 100644 --- a/net/http/http_cache.cc +++ b/net/http/http_cache.cc @@ -263,9 +263,6 @@ class HttpCache::Transaction // layer (skipping the cache entirely). bool ShouldPassThrough(); - // Returns true if we should force an end-to-end fetch. - bool ShouldBypassCache(); - // Called to begin reading from the cache. Returns network error code. int BeginCacheRead(); @@ -333,12 +330,12 @@ class HttpCache::Transaction // Called to write response_ to the cache entry. void WriteResponseInfoToEntry(); - // Called to truncate response content in the entry. - void TruncateResponseData(); - // Called to append response data to the cache entry. void AppendResponseDataToEntry(IOBuffer* data, int data_len); + // Called to truncate response content in the entry. + void TruncateResponseData(); + // Called when we are done writing to the cache entry. void DoneWritingToEntry(bool success); @@ -1346,6 +1343,77 @@ void HttpCache::Transaction::DoomPartialEntry(bool delete_object) { partial_.reset(NULL); } +int HttpCache::Transaction::DoNetworkReadCompleted(int result) { + DCHECK(mode_ & WRITE || mode_ == NONE); + + if (revoked()) + return HandleResult(ERR_UNEXPECTED); + + AppendResponseDataToEntry(read_buf_, result); + + if (partial_.get()) + return DoPartialNetworkReadCompleted(result); + + if (result == 0) // End of file. + DoneWritingToEntry(true); + + return HandleResult(result); +} + +int HttpCache::Transaction::DoPartialNetworkReadCompleted(int result) { + partial_->OnNetworkReadCompleted(result); + + if (result == 0) { // End of file. + if (mode_ == READ_WRITE) { + // We need to move on to the next range. + network_trans_.reset(); + result = ContinuePartialCacheValidation(); + if (result != OK) + // Any error was already handled. + return result; + } + DoneWritingToEntry(true); + } + return HandleResult(result); +} + +int HttpCache::Transaction::DoCacheReadCompleted(int result) { + DCHECK(cache_); + cache_read_callback_->Release(); // Balance the AddRef() from Start(). + + if (revoked()) + return HandleResult(ERR_UNEXPECTED); + + if (partial_.get()) + return DoPartialCacheReadCompleted(result); + + if (result > 0) { + read_offset_ += result; + } else if (result == 0) { // End of file. + cache_->DoneReadingFromEntry(entry_, this); + entry_ = NULL; + } + return HandleResult(result); +} + +int HttpCache::Transaction::DoPartialCacheReadCompleted(int result) { + partial_->OnCacheReadCompleted(result); + + if (result == 0) { // End of file. + if (partial_.get() && mode_ == READ_WRITE) { + // We need to move on to the next range. + result = ContinuePartialCacheValidation(); + if (result != OK) + // Any error was already handled. + return result; + cache_->ConvertWriterToReader(entry_); + } + cache_->DoneReadingFromEntry(entry_, this); + entry_ = NULL; + } + return HandleResult(result); +} + void HttpCache::Transaction::OnNetworkInfoAvailable(int result) { DCHECK(result != ERR_IO_PENDING); @@ -1457,81 +1525,10 @@ void HttpCache::Transaction::OnNetworkReadCompleted(int result) { DoNetworkReadCompleted(result); } -int HttpCache::Transaction::DoNetworkReadCompleted(int result) { - DCHECK(mode_ & WRITE || mode_ == NONE); - - if (revoked()) - return HandleResult(ERR_UNEXPECTED); - - AppendResponseDataToEntry(read_buf_, result); - - if (partial_.get()) - return DoPartialNetworkReadCompleted(result); - - if (result == 0) // End of file. - DoneWritingToEntry(true); - - return HandleResult(result); -} - -int HttpCache::Transaction::DoPartialNetworkReadCompleted(int result) { - partial_->OnNetworkReadCompleted(result); - - if (result == 0) { // End of file. - if (mode_ == READ_WRITE) { - // We need to move on to the next range. - network_trans_.reset(); - result = ContinuePartialCacheValidation(); - if (result != OK) - // Any error was already handled. - return result; - } - DoneWritingToEntry(true); - } - return HandleResult(result); -} - void HttpCache::Transaction::OnCacheReadCompleted(int result) { DoCacheReadCompleted(result); } -int HttpCache::Transaction::DoCacheReadCompleted(int result) { - DCHECK(cache_); - cache_read_callback_->Release(); // Balance the AddRef() from Start(). - - if (revoked()) - return HandleResult(ERR_UNEXPECTED); - - if (partial_.get()) - return DoPartialCacheReadCompleted(result); - - if (result > 0) { - read_offset_ += result; - } else if (result == 0) { // End of file. - cache_->DoneReadingFromEntry(entry_, this); - entry_ = NULL; - } - return HandleResult(result); -} - -int HttpCache::Transaction::DoPartialCacheReadCompleted(int result) { - partial_->OnCacheReadCompleted(result); - - if (result == 0) { // End of file. - if (partial_.get() && mode_ == READ_WRITE) { - // We need to move on to the next range. - result = ContinuePartialCacheValidation(); - if (result != OK) - // Any error was already handled. - return result; - cache_->ConvertWriterToReader(entry_); - } - cache_->DoneReadingFromEntry(entry_, this); - entry_ = NULL; - } - return HandleResult(result); -} - //----------------------------------------------------------------------------- HttpCache::HttpCache(HostResolver* host_resolver, |