diff options
author | rvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-17 18:28:08 +0000 |
---|---|---|
committer | rvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-17 18:28:08 +0000 |
commit | b79d7abdc9e7de5d17beca1ddcbfcd8c20e1cdd4 (patch) | |
tree | 9519f83149f5ab1e547b921a8360bf9063dae4ef /net/http/http_cache_transaction.h | |
parent | f971e4dd420220c5384537fbce97f6481ce65ed9 (diff) | |
download | chromium_src-b79d7abdc9e7de5d17beca1ddcbfcd8c20e1cdd4.zip chromium_src-b79d7abdc9e7de5d17beca1ddcbfcd8c20e1cdd4.tar.gz chromium_src-b79d7abdc9e7de5d17beca1ddcbfcd8c20e1cdd4.tar.bz2 |
Http cache: Add a few more states to the transaction SM.
Now we have states for writing and reading the
cached headers.
BUG=26726, 18055
TEST=covered by current unit tests
Review URL: http://codereview.chromium.org/500009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@34845 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/http/http_cache_transaction.h')
-rw-r--r-- | net/http/http_cache_transaction.h | 35 |
1 files changed, 26 insertions, 9 deletions
diff --git a/net/http/http_cache_transaction.h b/net/http/http_cache_transaction.h index b396010..0e66f4d 100644 --- a/net/http/http_cache_transaction.h +++ b/net/http/http_cache_transaction.h @@ -98,6 +98,7 @@ class HttpCache::Transaction : public HttpTransaction { STATE_NONE, STATE_SEND_REQUEST, STATE_SEND_REQUEST_COMPLETE, + STATE_SUCCESSFUL_SEND_REQUEST, STATE_NETWORK_READ, STATE_NETWORK_READ_COMPLETE, STATE_INIT_ENTRY, @@ -110,9 +111,16 @@ class HttpCache::Transaction : public HttpTransaction { STATE_ADD_TO_ENTRY, STATE_ENTRY_AVAILABLE, STATE_PARTIAL_CACHE_VALIDATION, + STATE_UPDATE_CACHED_RESPONSE, + STATE_UPDATE_CACHED_RESPONSE_COMPLETE, + STATE_OVERWRITE_CACHED_RESPONSE, + STATE_TRUNCATE_CACHED_DATA, + STATE_TRUNCATE_CACHED_DATA_COMPLETE, + STATE_PARTIAL_HEADERS_RECEIVED, STATE_CACHE_READ_RESPONSE, STATE_CACHE_READ_RESPONSE_COMPLETE, STATE_CACHE_WRITE_RESPONSE, + STATE_CACHE_WRITE_TRUNCATED_RESPONSE, STATE_CACHE_WRITE_RESPONSE_COMPLETE, STATE_CACHE_QUERY_DATA, STATE_CACHE_QUERY_DATA_COMPLETE, @@ -137,6 +145,7 @@ class HttpCache::Transaction : public HttpTransaction { // corresponding callback. int DoSendRequest(); int DoSendRequestComplete(int result); + int DoSuccessfulSendRequest(); int DoNetworkRead(); int DoNetworkReadComplete(int result); int DoInitEntry(); @@ -149,10 +158,21 @@ class HttpCache::Transaction : public HttpTransaction { int DoAddToEntry(); int DoEntryAvailable(); int DoPartialCacheValidation(); - int DoCacheReadData(); - int DoCacheReadDataComplete(int result); + int DoUpdateCachedResponse(); + int DoUpdateCachedResponseComplete(int result); + int DoOverwriteCachedResponse(); + int DoTruncateCachedData(); + int DoTruncateCachedDataComplete(int result); + int DoPartialHeadersReceived(); + int DoCacheReadResponse(); + int DoCacheReadResponseComplete(); + int DoCacheWriteResponse(); + int DoCacheWriteTruncatedResponse(); + int DoCacheWriteResponseComplete(int result); int DoCacheQueryData(); int DoCacheQueryDataComplete(int result); + int DoCacheReadData(); + int DoCacheReadDataComplete(int result); int DoCacheWriteData(int num_bytes); int DoCacheWriteDataComplete(int result); @@ -221,9 +241,6 @@ class HttpCache::Transaction : public HttpTransaction { // Reads data from the cache entry. int ReadFromEntry(IOBuffer* data, int data_len); - // Called to populate response_ from the cache entry. - int ReadResponseInfoFromEntry(); - // Called to write data to the cache entry. If the write fails, then the // cache entry is destroyed. Future calls to this function will just do // nothing without side-effect. Returns a network error code. @@ -232,16 +249,13 @@ class HttpCache::Transaction : public HttpTransaction { // Called to write response_ to the cache entry. |truncated| indicates if the // entry should be marked as incomplete. - void WriteResponseInfoToEntry(bool truncated); + int WriteResponseInfoToEntry(bool truncated); // Called to append response data to the cache entry. Returns a network error // code. int AppendResponseDataToEntry(IOBuffer* data, int data_len, CompletionCallback* callback); - // Called to truncate response content in the entry. - void TruncateResponseData(); - // Called when we are done writing to the cache entry. void DoneWritingToEntry(bool success); @@ -277,12 +291,15 @@ class HttpCache::Transaction : public HttpTransaction { CompletionCallback* callback_; // Consumer's callback. HttpResponseInfo response_; HttpResponseInfo auth_response_; + const HttpResponseInfo* new_response_; std::string cache_key_; Mode mode_; + State target_state_; bool reading_; // We are already reading. bool invalid_range_; // We may bypass the cache for this request. bool enable_range_support_; bool truncated_; // We don't have all the response data. + bool server_responded_206_; scoped_refptr<IOBuffer> read_buf_; int read_buf_len_; int read_offset_; |