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

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

Issue 14063011: Disk cache: Make sure that entry_ and node_ are not saved after doom. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/hash.h" 7 #include "base/hash.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 backend_->RemoveEntry(this); 495 backend_->RemoveEntry(this);
496 496
497 // Note that at this point node_ and entry_ are just two blocks of data, and 497 // Note that at this point node_ and entry_ are just two blocks of data, and
498 // even if they reference each other, nobody should be referencing them. 498 // even if they reference each other, nobody should be referencing them.
499 499
500 Addr address(entry_.Data()->long_key); 500 Addr address(entry_.Data()->long_key);
501 DeleteData(address, kKeyFileIndex); 501 DeleteData(address, kKeyFileIndex);
502 backend_->ModifyStorageSize(entry_.Data()->key_len, 0); 502 backend_->ModifyStorageSize(entry_.Data()->key_len, 0);
503 503
504 backend_->DeleteBlock(entry_.address(), true); 504 backend_->DeleteBlock(entry_.address(), true);
505 entry_.Discard();
505 506
506 if (!LeaveRankingsBehind()) 507 if (!LeaveRankingsBehind()) {
507 backend_->DeleteBlock(node_.address(), true); 508 backend_->DeleteBlock(node_.address(), true);
509 node_.Discard();
510 }
508 } 511 }
509 512
510 CacheAddr EntryImpl::GetNextAddress() { 513 CacheAddr EntryImpl::GetNextAddress() {
511 return entry_.Data()->next; 514 return entry_.Data()->next;
512 } 515 }
513 516
514 void EntryImpl::SetNextAddress(Addr address) { 517 void EntryImpl::SetNextAddress(Addr address) {
515 DCHECK_NE(address.value(), entry_.address().value()); 518 DCHECK_NE(address.value(), entry_.address().value());
516 entry_.Data()->next = address.value(); 519 entry_.Data()->next = address.value();
517 bool success = entry_.Store(); 520 bool success = entry_.Store();
(...skipping 1019 matching lines...) Expand 10 before | Expand all | Expand 10 after
1537 Trace("%s 0x%p 0x%x 0x%x", msg, reinterpret_cast<void*>(this), 1540 Trace("%s 0x%p 0x%x 0x%x", msg, reinterpret_cast<void*>(this),
1538 entry_.address().value(), node_.address().value()); 1541 entry_.address().value(), node_.address().value());
1539 1542
1540 Trace(" data: 0x%x 0x%x 0x%x", entry_.Data()->data_addr[0], 1543 Trace(" data: 0x%x 0x%x 0x%x", entry_.Data()->data_addr[0],
1541 entry_.Data()->data_addr[1], entry_.Data()->long_key); 1544 entry_.Data()->data_addr[1], entry_.Data()->long_key);
1542 1545
1543 Trace(" doomed: %d 0x%x", doomed_, dirty); 1546 Trace(" doomed: %d 0x%x", doomed_, dirty);
1544 } 1547 }
1545 1548
1546 } // namespace disk_cache 1549 } // namespace disk_cache
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698