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

Unified Diff: net/disk_cache/sparse_control.cc

Issue 3054012: Disk Cache: Replace the backend pointer of the ChildrenDeleter... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 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
« net/disk_cache/entry_unittest.cc ('K') | « net/disk_cache/entry_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/disk_cache/sparse_control.cc
===================================================================
--- net/disk_cache/sparse_control.cc (revision 53428)
+++ net/disk_cache/sparse_control.cc (working copy)
@@ -51,7 +51,7 @@
public disk_cache::FileIOCallback {
public:
ChildrenDeleter(disk_cache::BackendImpl* backend, const std::string& name)
- : backend_(backend), name_(name) {}
+ : backend_(backend->GetWeakPtr()), name_(name) {}
virtual void OnFileIOComplete(int bytes_copied);
@@ -66,7 +66,7 @@
void DeleteChildren();
- disk_cache::BackendImpl* backend_;
+ base::WeakPtr<disk_cache::BackendImpl> backend_;
std::string name_;
disk_cache::Bitmap children_map_;
int64 signature_;
@@ -101,6 +101,9 @@
void ChildrenDeleter::ReadData(disk_cache::Addr address, int len) {
DCHECK(address.is_block_file());
+ if (!backend_)
+ return Release();
+
disk_cache::File* file(backend_->File(address));
if (!file)
return Release();
@@ -121,7 +124,7 @@
void ChildrenDeleter::DeleteChildren() {
int child_id = 0;
- if (!children_map_.FindNextSetBit(&child_id)) {
+ if (!children_map_.FindNextSetBit(&child_id) || !backend_) {
// We are done. Just delete this object.
return Release();
}
« net/disk_cache/entry_unittest.cc ('K') | « net/disk_cache/entry_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698