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

Unified Diff: net/http/http_cache.h

Issue 1230113012: [net] Better StopCaching() handling for HttpCache::Transaction. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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.h
diff --git a/net/http/http_cache.h b/net/http/http_cache.h
index 026d476e92f0dcfd36c309d07c5016ddfaa04854..ad6f661ae9aecd9396dbb0ecdeaf2744ccf3bbad 100644
--- a/net/http/http_cache.h
+++ b/net/http/http_cache.h
@@ -347,17 +347,22 @@ class NET_EXPORT HttpCache : public HttpTransactionFactory,
// one (in this case, the entry is no longer valid).
int AddTransactionToEntry(ActiveEntry* entry, Transaction* trans);
- // Called when the transaction has finished working with this entry. |cancel|
- // is true if the operation was cancelled by the caller instead of running
- // to completion.
- void DoneWithEntry(ActiveEntry* entry, Transaction* trans, bool cancel);
+ // Used with DoneWithEntry() to indicate the state of the entry.
+ enum class EntryState { SUCCEEDED, DOOMED };
rvargas (doing something else) 2015/09/11 23:56:17 nit: types go before methods.
asanka 2015/09/17 21:59:40 Done.
- // Called when the transaction has finished writing to this entry. |success|
- // is false if the cache entry should be deleted.
- void DoneWritingToEntry(ActiveEntry* entry, bool success);
-
- // Called when the transaction has finished reading from this entry.
- void DoneReadingFromEntry(ActiveEntry* entry, Transaction* trans);
+ // Removes |trans| from |entry|. |trans| is required to be a reader or writer
+ // that was added to |trans| by AddTransactionToEntry(). For writers,
+ // |entry_state| indicates the state of the entry after releasing.
rvargas (doing something else) 2015/09/11 23:56:17 nit: what is "after releasing"?
asanka 2015/09/17 21:59:40 Clarified.
+ //
+ // If |entry_state| is DOOMED, then the cache entry is destroyed and any
rvargas (doing something else) 2015/09/11 23:56:17 nit: Can we change this to a command like word ins
asanka 2015/09/17 21:59:40 Changed to KEEP/DOOM
+ // pending transactions that were formerly waiting to be added to |entry| will
+ // receive ERR_CACHE_RACE.
+ //
+ // If |entry_state| is SUCCEEDED, then |entry| is assumed to be safe for
+ // further consumption and pending transaction will be permitted to use it.
+ void DoneWithEntry(ActiveEntry* entry,
+ Transaction* trans,
+ EntryState entry_state);
// Converts the active writer transaction to a reader so that other
// transactions can start reading from this entry.

Powered by Google App Engine
This is Rietveld 408576698