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

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

Issue 13913010: Add Cache size to the Simple Index. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: syncing Created 7 years, 8 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 | « net/disk_cache/simple/simple_entry_impl.h ('k') | net/disk_cache/simple/simple_index.h » ('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.cc
diff --git a/net/disk_cache/simple/simple_entry_impl.cc b/net/disk_cache/simple/simple_entry_impl.cc
index ad45b653781f248e963b03893b7abc8f5cb50579..03dc471d30780b7d93af3a44c7c8c770071cc92f 100644
--- a/net/disk_cache/simple/simple_entry_impl.cc
+++ b/net/disk_cache/simple/simple_entry_impl.cc
@@ -150,7 +150,8 @@ int SimpleEntryImpl::ReadData(int index,
index_->UseIfExists(key_);
SynchronousOperationCallback sync_operation_callback =
base::Bind(&SimpleEntryImpl::EntryOperationComplete,
- callback, weak_ptr_factory_.GetWeakPtr(), synchronous_entry_);
+ index_, callback, weak_ptr_factory_.GetWeakPtr(),
+ synchronous_entry_);
WorkerPool::PostTask(FROM_HERE,
base::Bind(&SimpleSynchronousEntry::ReadData,
base::Unretained(synchronous_entry_),
@@ -175,7 +176,8 @@ int SimpleEntryImpl::WriteData(int index,
index_->UseIfExists(key_);
SynchronousOperationCallback sync_operation_callback =
base::Bind(&SimpleEntryImpl::EntryOperationComplete,
- callback, weak_ptr_factory_.GetWeakPtr(), synchronous_entry_);
+ index_, callback, weak_ptr_factory_.GetWeakPtr(),
+ synchronous_entry_);
WorkerPool::PostTask(FROM_HERE,
base::Bind(&SimpleSynchronousEntry::WriteData,
base::Unretained(synchronous_entry_),
@@ -273,10 +275,15 @@ void SimpleEntryImpl::CreationOperationComplete(
// static
void SimpleEntryImpl::EntryOperationComplete(
+ base::WeakPtr<SimpleIndex> index,
const CompletionCallback& completion_callback,
base::WeakPtr<SimpleEntryImpl> entry,
SimpleSynchronousEntry* sync_entry,
int result) {
+ DCHECK(sync_entry);
+ if (index)
+ index->UpdateEntrySize(sync_entry->key(), sync_entry->GetFileSize());
+
if (entry) {
DCHECK(entry->synchronous_entry_in_use_by_worker_);
entry->synchronous_entry_in_use_by_worker_ = false;
« no previous file with comments | « net/disk_cache/simple/simple_entry_impl.h ('k') | net/disk_cache/simple/simple_index.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698