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

Side by Side Diff: net/disk_cache/entry_impl.cc

Issue 7461106: Inform disk cache of WebKit memory cache hits. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/disk_cache/entry_impl.h" 5 #include "net/disk_cache/entry_impl.h"
6 6
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "net/base/io_buffer.h" 10 #include "net/base/io_buffer.h"
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 return; 389 return;
390 390
391 sparse_->CancelIO(); 391 sparse_->CancelIO();
392 } 392 }
393 393
394 int EntryImpl::ReadyForSparseIOImpl(CompletionCallback* callback) { 394 int EntryImpl::ReadyForSparseIOImpl(CompletionCallback* callback) {
395 DCHECK(sparse_.get()); 395 DCHECK(sparse_.get());
396 return sparse_->ReadyToUse(callback); 396 return sparse_->ReadyToUse(callback);
397 } 397 }
398 398
399 void EntryImpl::UpdateRankForExternalCacheHitImpl() {
400 UpdateRank(false);
401 }
402
399 uint32 EntryImpl::GetHash() { 403 uint32 EntryImpl::GetHash() {
400 return entry_.Data()->hash; 404 return entry_.Data()->hash;
401 } 405 }
402 406
403 bool EntryImpl::CreateEntry(Addr node_address, const std::string& key, 407 bool EntryImpl::CreateEntry(Addr node_address, const std::string& key,
404 uint32 hash) { 408 uint32 hash) {
405 Trace("Create entry In"); 409 Trace("Create entry In");
406 EntryStore* entry_store = entry_.Data(); 410 EntryStore* entry_store = entry_.Data();
407 RankingsNode* node = node_.Data(); 411 RankingsNode* node = node_.Data();
408 memset(entry_store, 0, sizeof(EntryStore) * entry_.address().num_blocks()); 412 memset(entry_store, 0, sizeof(EntryStore) * entry_.address().num_blocks());
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
826 } 830 }
827 831
828 int EntryImpl::ReadyForSparseIO(net::CompletionCallback* callback) { 832 int EntryImpl::ReadyForSparseIO(net::CompletionCallback* callback) {
829 if (!sparse_.get()) 833 if (!sparse_.get())
830 return net::OK; 834 return net::OK;
831 835
832 backend_->background_queue()->ReadyForSparseIO(this, callback); 836 backend_->background_queue()->ReadyForSparseIO(this, callback);
833 return net::ERR_IO_PENDING; 837 return net::ERR_IO_PENDING;
834 } 838 }
835 839
840 void EntryImpl::UpdateRankForExternalCacheHit() {
841 backend_->background_queue()->UpdateRankForExternalCacheHit(this);
842 }
843
836 // When an entry is deleted from the cache, we clean up all the data associated 844 // When an entry is deleted from the cache, we clean up all the data associated
837 // with it for two reasons: to simplify the reuse of the block (we know that any 845 // with it for two reasons: to simplify the reuse of the block (we know that any
838 // unused block is filled with zeros), and to simplify the handling of write / 846 // unused block is filled with zeros), and to simplify the handling of write /
839 // read partial information from an entry (don't have to worry about returning 847 // read partial information from an entry (don't have to worry about returning
840 // data related to a previous cache entry because the range was not fully 848 // data related to a previous cache entry because the range was not fully
841 // written before). 849 // written before).
842 EntryImpl::~EntryImpl() { 850 EntryImpl::~EntryImpl() {
843 Log("~EntryImpl in"); 851 Log("~EntryImpl in");
844 852
845 // Save the sparse info to disk. This will generate IO for this entry and 853 // Save the sparse info to disk. This will generate IO for this entry and
(...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after
1426 Trace("%s 0x%p 0x%x 0x%x", msg, reinterpret_cast<void*>(this), 1434 Trace("%s 0x%p 0x%x 0x%x", msg, reinterpret_cast<void*>(this),
1427 entry_.address().value(), node_.address().value()); 1435 entry_.address().value(), node_.address().value());
1428 1436
1429 Trace(" data: 0x%x 0x%x 0x%x", entry_.Data()->data_addr[0], 1437 Trace(" data: 0x%x 0x%x 0x%x", entry_.Data()->data_addr[0],
1430 entry_.Data()->data_addr[1], entry_.Data()->long_key); 1438 entry_.Data()->data_addr[1], entry_.Data()->long_key);
1431 1439
1432 Trace(" doomed: %d 0x%x", doomed_, dirty); 1440 Trace(" doomed: %d 0x%x", doomed_, dirty);
1433 } 1441 }
1434 1442
1435 } // namespace disk_cache 1443 } // namespace disk_cache
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698