Index: net/disk_cache/backend_impl.cc |
=================================================================== |
--- net/disk_cache/backend_impl.cc (revision 70512) |
+++ net/disk_cache/backend_impl.cc (working copy) |
@@ -194,11 +194,12 @@ |
public: |
CacheCreator(const FilePath& path, bool force, int max_bytes, |
net::CacheType type, uint32 flags, |
- base::MessageLoopProxy* thread, disk_cache::Backend** backend, |
+ base::MessageLoopProxy* thread, net::NetLog* net_log, |
+ disk_cache::Backend** backend, |
net::CompletionCallback* callback) |
: path_(path), force_(force), retry_(false), max_bytes_(max_bytes), |
type_(type), flags_(flags), thread_(thread), backend_(backend), |
- callback_(callback), cache_(NULL), |
+ callback_(callback), cache_(NULL), net_log_(net_log), |
ALLOW_THIS_IN_INITIALIZER_LIST( |
my_callback_(this, &CacheCreator::OnIOComplete)) { |
} |
@@ -223,13 +224,14 @@ |
disk_cache::Backend** backend_; |
net::CompletionCallback* callback_; |
disk_cache::BackendImpl* cache_; |
+ net::NetLog* net_log_; |
net::CompletionCallbackImpl<CacheCreator> my_callback_; |
DISALLOW_COPY_AND_ASSIGN(CacheCreator); |
}; |
int CacheCreator::Run() { |
- cache_ = new disk_cache::BackendImpl(path_, thread_); |
+ cache_ = new disk_cache::BackendImpl(path_, thread_, net_log_); |
cache_->SetMaxSize(max_bytes_); |
cache_->SetType(type_); |
cache_->SetFlags(flags_); |
@@ -295,7 +297,8 @@ |
int CreateCacheBackend(net::CacheType type, const FilePath& path, int max_bytes, |
bool force, base::MessageLoopProxy* thread, |
- Backend** backend, CompletionCallback* callback) { |
+ net::NetLog* net_log, Backend** backend, |
+ CompletionCallback* callback) { |
DCHECK(callback); |
if (type == net::MEMORY_CACHE) { |
*backend = MemBackendImpl::CreateBackend(max_bytes); |
@@ -304,7 +307,7 @@ |
DCHECK(thread); |
return BackendImpl::CreateBackend(path, force, max_bytes, type, kNone, thread, |
- backend, callback); |
+ net_log, backend, callback); |
} |
// Returns the preferred maximum number of bytes for the cache given the |
@@ -351,11 +354,12 @@ |
int BackendImpl::CreateBackend(const FilePath& full_path, bool force, |
int max_bytes, net::CacheType type, |
uint32 flags, base::MessageLoopProxy* thread, |
- Backend** backend, |
+ net::NetLog* net_log, Backend** backend, |
CompletionCallback* callback) { |
DCHECK(callback); |
CacheCreator* creator = new CacheCreator(full_path, force, max_bytes, type, |
- flags, thread, backend, callback); |
+ flags, thread, net_log, backend, |
+ callback); |
// This object will self-destroy when finished. |
return creator->Run(); |
} |
@@ -366,7 +370,8 @@ |
} |
BackendImpl::BackendImpl(const FilePath& path, |
- base::MessageLoopProxy* cache_thread) |
+ base::MessageLoopProxy* cache_thread, |
+ net::NetLog* net_log) |
: ALLOW_THIS_IN_INITIALIZER_LIST(background_queue_(this, cache_thread)), |
path_(path), |
block_files_(path), |
@@ -383,6 +388,7 @@ |
new_eviction_(false), |
first_timer_(true), |
throttle_requests_(false), |
+ net_log_(net_log), |
done_(true, false), |
ALLOW_THIS_IN_INITIALIZER_LIST(factory_(this)), |
ALLOW_THIS_IN_INITIALIZER_LIST(ptr_factory_(this)) { |
@@ -390,7 +396,8 @@ |
BackendImpl::BackendImpl(const FilePath& path, |
uint32 mask, |
- base::MessageLoopProxy* cache_thread) |
+ base::MessageLoopProxy* cache_thread, |
+ net::NetLog* net_log) |
: ALLOW_THIS_IN_INITIALIZER_LIST(background_queue_(this, cache_thread)), |
path_(path), |
block_files_(path), |
@@ -407,6 +414,7 @@ |
new_eviction_(false), |
first_timer_(true), |
throttle_requests_(false), |
+ net_log_(net_log), |
done_(true, false), |
ALLOW_THIS_IN_INITIALIZER_LIST(factory_(this)), |
ALLOW_THIS_IN_INITIALIZER_LIST(ptr_factory_(this)) { |
@@ -848,6 +856,8 @@ |
return NULL; |
} |
+ cache_entry->BeginLogging(net_log_, true); |
+ |
// We are not failing the operation; let's add this to the map. |
open_entries_[entry_address.value()] = cache_entry; |
@@ -1528,6 +1538,7 @@ |
open_entries_[address.value()] = cache_entry; |
} |
+ cache_entry->BeginLogging(net_log_, false); |
cache_entry.swap(entry); |
return 0; |
} |