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

Side by Side Diff: net/disk_cache/simple/simple_backend_impl.cc

Issue 761903003: Update from https://crrev.com/306655 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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
« no previous file with comments | « net/disk_cache/blockfile/block_files.cc ('k') | net/disk_cache/simple/simple_entry_impl.cc » ('j') | 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/simple/simple_backend_impl.h" 5 #include "net/disk_cache/simple/simple_backend_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cstdlib> 8 #include <cstdlib>
9 #include <functional> 9 #include <functional>
10 10
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 FROM_HERE, 264 FROM_HERE,
265 base::Bind( 265 base::Bind(
266 &SimpleBackendImpl::InitCacheStructureOnDisk, path_, orig_max_size_), 266 &SimpleBackendImpl::InitCacheStructureOnDisk, path_, orig_max_size_),
267 base::Bind(&SimpleBackendImpl::InitializeIndex, 267 base::Bind(&SimpleBackendImpl::InitializeIndex,
268 AsWeakPtr(), 268 AsWeakPtr(),
269 completion_callback)); 269 completion_callback));
270 return net::ERR_IO_PENDING; 270 return net::ERR_IO_PENDING;
271 } 271 }
272 272
273 bool SimpleBackendImpl::SetMaxSize(int max_bytes) { 273 bool SimpleBackendImpl::SetMaxSize(int max_bytes) {
274 if (max_bytes < 0)
275 return false;
274 orig_max_size_ = max_bytes; 276 orig_max_size_ = max_bytes;
275 return index_->SetMaxSize(max_bytes); 277 index_->SetMaxSize(max_bytes);
278 return true;
276 } 279 }
277 280
278 int SimpleBackendImpl::GetMaxFileSize() const { 281 int SimpleBackendImpl::GetMaxFileSize() const {
279 return index_->max_size() / kMaxFileRatio; 282 return static_cast<int>(index_->max_size() / kMaxFileRatio);
280 } 283 }
281 284
282 void SimpleBackendImpl::OnDoomStart(uint64 entry_hash) { 285 void SimpleBackendImpl::OnDoomStart(uint64 entry_hash) {
283 DCHECK_EQ(0u, entries_pending_doom_.count(entry_hash)); 286 DCHECK_EQ(0u, entries_pending_doom_.count(entry_hash));
284 entries_pending_doom_.insert( 287 entries_pending_doom_.insert(
285 std::make_pair(entry_hash, std::vector<Closure>())); 288 std::make_pair(entry_hash, std::vector<Closure>()));
286 } 289 }
287 290
288 void SimpleBackendImpl::OnDoomComplete(uint64 entry_hash) { 291 void SimpleBackendImpl::OnDoomComplete(uint64 entry_hash) {
289 DCHECK_EQ(1u, entries_pending_doom_.count(entry_hash)); 292 DCHECK_EQ(1u, entries_pending_doom_.count(entry_hash));
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
729 this)); 732 this));
730 callback.Run(result); 733 callback.Run(result);
731 } 734 }
732 735
733 void SimpleBackendImpl::FlushWorkerPoolForTesting() { 736 void SimpleBackendImpl::FlushWorkerPoolForTesting() {
734 if (g_sequenced_worker_pool) 737 if (g_sequenced_worker_pool)
735 g_sequenced_worker_pool->FlushForTesting(); 738 g_sequenced_worker_pool->FlushForTesting();
736 } 739 }
737 740
738 } // namespace disk_cache 741 } // namespace disk_cache
OLDNEW
« no previous file with comments | « net/disk_cache/blockfile/block_files.cc ('k') | net/disk_cache/simple/simple_entry_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698