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

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

Issue 7650022: Skip updating rank in OnExternalCacheHit if cache is uninitialized or disabled. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 4 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) 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/backend_impl.h" 5 #include "net/disk_cache/backend_impl.h"
6 6
7 #include "base/file_path.h" 7 #include "base/file_path.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/metrics/field_trial.h" 10 #include "base/metrics/field_trial.h"
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 *prev_entry = OpenPrevEntryImpl(iter); 676 *prev_entry = OpenPrevEntryImpl(iter);
677 return (*prev_entry) ? net::OK : net::ERR_FAILED; 677 return (*prev_entry) ? net::OK : net::ERR_FAILED;
678 } 678 }
679 679
680 void BackendImpl::SyncEndEnumeration(void* iter) { 680 void BackendImpl::SyncEndEnumeration(void* iter) {
681 scoped_ptr<Rankings::Iterator> iterator( 681 scoped_ptr<Rankings::Iterator> iterator(
682 reinterpret_cast<Rankings::Iterator*>(iter)); 682 reinterpret_cast<Rankings::Iterator*>(iter));
683 } 683 }
684 684
685 void BackendImpl::SyncOnExternalCacheHit(const std::string& key) { 685 void BackendImpl::SyncOnExternalCacheHit(const std::string& key) {
686 if (disabled_ || !data_)
rvargas (doing something else) 2011/08/15 20:45:39 nit: disabled_ should be enough (to be consistent
687 return;
688
686 uint32 hash = Hash(key); 689 uint32 hash = Hash(key);
687 bool error; 690 bool error;
688 EntryImpl* cache_entry = MatchEntry(key, hash, false, Addr(), &error); 691 EntryImpl* cache_entry = MatchEntry(key, hash, false, Addr(), &error);
689 if (cache_entry) { 692 if (cache_entry) {
690 if (ENTRY_NORMAL == cache_entry->entry()->Data()->state) { 693 if (ENTRY_NORMAL == cache_entry->entry()->Data()->state) {
691 UpdateRank(cache_entry, false); 694 UpdateRank(cache_entry, false);
692 } 695 }
693 cache_entry->Release(); 696 cache_entry->Release();
694 } 697 }
695 } 698 }
(...skipping 1416 matching lines...) Expand 10 before | Expand all | Expand 10 after
2112 if (total_memory > kMaxBuffersSize || total_memory <= 0) 2115 if (total_memory > kMaxBuffersSize || total_memory <= 0)
2113 total_memory = kMaxBuffersSize; 2116 total_memory = kMaxBuffersSize;
2114 2117
2115 done = true; 2118 done = true;
2116 } 2119 }
2117 2120
2118 return static_cast<int>(total_memory); 2121 return static_cast<int>(total_memory);
2119 } 2122 }
2120 2123
2121 } // namespace disk_cache 2124 } // 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