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

Unified Diff: net/disk_cache/simple/simple_entry_impl.h

Issue 12277004: Make SimpleEntryImpl::Close asynchronous. (Closed) Base URL: http://git.chromium.org/git/chromium.git@3-doomdoom
Patch Set: remediate Created 7 years, 10 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
« no previous file with comments | « no previous file | net/disk_cache/simple/simple_entry_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/disk_cache/simple/simple_entry_impl.h
diff --git a/net/disk_cache/simple/simple_entry_impl.h b/net/disk_cache/simple/simple_entry_impl.h
index 4dc76ddddd803c45106a0081f1d2c2e79535daaa..82d7bbbdcf8e99588799b9f8f33d4c77f2f8561d 100644
--- a/net/disk_cache/simple/simple_entry_impl.h
+++ b/net/disk_cache/simple/simple_entry_impl.h
@@ -89,9 +89,11 @@ class SimpleEntryImpl : public Entry {
// Called after a SimpleSynchronousEntry has completed an asynchronous IO
// operation, such as ReadData() or WriteData(). Calls |completion_callback|.
+ // If |entry| no longer exists, then it ensures |sync_entry| is closed.
static void EntryOperationComplete(
const CompletionCallback& completion_callback,
base::WeakPtr<SimpleEntryImpl> entry,
+ SimpleSynchronousEntry* sync_entry,
int result);
// Called on construction and also after the completion of asynchronous IO to
@@ -114,7 +116,11 @@ class SimpleEntryImpl : public Entry {
int32 data_size_[kSimpleEntryFileCount];
// The |synchronous_entry_| is the worker thread object that performs IO on
- // entries.
+ // entries. It's owned by this SimpleEntryImpl, which is responsible for its
+ // destruction by calling SimpleSynchronousEntry::Close(). However, since
+ // |this| can be destroyed while a synchronous operation is completing, the
+ // |synchronous_entry_| must sometimes be destroyed when an operation
+ // completes and finds its owning SimpleEntryImpl has already been destroyed.
Randy Smith (Not in Mondays) 2013/02/26 21:13:12 So the way I read the code / another way to phrase
gavinp 2013/02/27 21:50:02 I like the way you wrote that ownership, so I've f
SimpleSynchronousEntry* synchronous_entry_;
// Set to true when a worker operation is posted on the |synchronous_entry_|,
« no previous file with comments | « no previous file | net/disk_cache/simple/simple_entry_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698