Chromium Code Reviews| 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_|, |