summaryrefslogtreecommitdiffstats
path: root/net/disk_cache/backend_impl.cc
diff options
context:
space:
mode:
Diffstat (limited to 'net/disk_cache/backend_impl.cc')
-rw-r--r--net/disk_cache/backend_impl.cc29
1 files changed, 20 insertions, 9 deletions
diff --git a/net/disk_cache/backend_impl.cc b/net/disk_cache/backend_impl.cc
index 58a6e9e..223c970 100644
--- a/net/disk_cache/backend_impl.cc
+++ b/net/disk_cache/backend_impl.cc
@@ -194,11 +194,12 @@ class CacheCreator {
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 @@ class CacheCreator {
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 @@ namespace disk_cache {
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 @@ int CreateCacheBackend(net::CacheType type, const FilePath& path, int max_bytes,
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 PreferedCacheSize(int64 available) {
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 @@ int BackendImpl::Init(CompletionCallback* callback) {
}
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 @@ BackendImpl::BackendImpl(const FilePath& path,
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,
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 @@ BackendImpl::BackendImpl(const FilePath& path,
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 @@ EntryImpl* BackendImpl::CreateEntryImpl(const std::string& key) {
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;
@@ -1537,6 +1547,7 @@ int BackendImpl::NewEntry(Addr address, EntryImpl** entry, bool* dirty) {
open_entries_[address.value()] = cache_entry;
}
+ cache_entry->BeginLogging(net_log_, false);
cache_entry.swap(entry);
return 0;
}