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

Unified Diff: net/http/http_cache_transaction.h

Issue 1230113012: [net] Better StopCaching() handling for HttpCache::Transaction. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Release cache lock early and request open range if it's the final range. Created 5 years, 5 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
Index: net/http/http_cache_transaction.h
diff --git a/net/http/http_cache_transaction.h b/net/http/http_cache_transaction.h
index ec88da37e1416febc51c03d538ea5a0af79d2d0a..beea308ed97a358fd7cccc52d2384ba1153df1b1 100644
--- a/net/http/http_cache_transaction.h
+++ b/net/http/http_cache_transaction.h
@@ -375,9 +375,17 @@ class HttpCache::Transaction : public HttpTransaction {
// is always "OK".
int OnWriteResponseInfoToEntryComplete(int result);
+ // Called when the client has finished reading. May start the state machine
+ // again. Hence should only be called when there are no more pending
+ // operations.
+ int DoneWithRequest();
+
// Called when we are done writing to the cache entry.
void DoneWritingToEntry(bool success);
+ // Called when we are done with the cache entry.
+ void DoneWithEntry(bool cancel);
+
// Returns an error to signal the caller that the current read failed. The
// current operation |result| is also logged. If |restart| is true, the
// transaction should be restarted.
@@ -403,6 +411,12 @@ class HttpCache::Transaction : public HttpTransaction {
// between the byte range request and the cached entry.
int DoRestartPartialRequest();
+ int DoReadComplete(int result);
+
+ int BeginCacheEntryRelease(int result_to_forward);
+
+ void OnCacheReleaseComplete(const base::Closure& closure, int result);
+
// Resets the relavant internal state to remove traces of internal processing
// related to range requests. Deletes |partial_| if |delete_object| is true.
void ResetPartialState(bool delete_object);
@@ -442,15 +456,16 @@ class HttpCache::Transaction : public HttpTransaction {
std::string cache_key_;
Mode mode_;
bool reading_; // We are already reading. Never reverts to false once set.
- bool invalid_range_; // We may bypass the cache for this request.
- bool truncated_; // We don't have all the response data.
- bool is_sparse_; // The data is stored in sparse byte ranges.
+ bool invalid_range_; // We may bypass the cache for this request.
+ bool truncated_; // We don't have all the response data.
+ bool is_sparse_; // The data is stored in sparse byte ranges.
bool range_requested_; // The user requested a byte range.
- bool handling_206_; // We must deal with this 206 response.
- bool cache_pending_; // We are waiting for the HttpCache.
- bool done_reading_; // All available data was read.
- bool vary_mismatch_; // The request doesn't match the stored vary data.
+ bool handling_206_; // We must deal with this 206 response.
+ bool cache_pending_; // We are waiting for the HttpCache.
+ bool done_writing_; // All available data was written to the cache entry.
+ bool vary_mismatch_; // The request doesn't match the stored vary data.
bool couldnt_conditionalize_request_;
+ bool stopped_caching_; // Avoid further writes to the cache.
bool bypass_lock_for_test_; // A test is exercising the cache lock.
bool fail_conditionalization_for_test_; // Fail ConditionalizeRequest.
scoped_refptr<IOBuffer> read_buf_;

Powered by Google App Engine
This is Rietveld 408576698