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

Side by Side Diff: net/disk_cache/blockfile/block_files.cc

Issue 885443002: Roll Chrome into Mojo. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Rebase to ToT mojo Created 5 years, 10 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
« no previous file with comments | « net/disk_cache/blockfile/backend_worker_v3.cc ('k') | net/disk_cache/blockfile/stats.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) 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/blockfile/block_files.h" 5 #include "net/disk_cache/blockfile/block_files.h"
6 6
7 #include "base/atomicops.h" 7 #include "base/atomicops.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
11 #include "base/strings/stringprintf.h" 11 #include "base/strings/stringprintf.h"
12 #include "base/threading/thread_checker.h" 12 #include "base/threading/thread_checker.h"
13 #include "base/time/time.h" 13 #include "base/time/time.h"
14 #include "net/disk_cache/blockfile/file_lock.h" 14 #include "net/disk_cache/blockfile/file_lock.h"
15 #include "net/disk_cache/blockfile/stress_support.h" 15 #include "net/disk_cache/blockfile/stress_support.h"
16 #include "net/disk_cache/blockfile/trace.h" 16 #include "net/disk_cache/blockfile/trace.h"
17 #include "net/disk_cache/cache_util.h" 17 #include "net/disk_cache/cache_util.h"
18 18
19 using base::TimeTicks; 19 using base::TimeTicks;
20 20
21 namespace { 21 namespace {
22 22
23 const char* kBlockName = "data_"; 23 const char kBlockName[] = "data_";
24 24
25 // This array is used to perform a fast lookup of the nibble bit pattern to the 25 // This array is used to perform a fast lookup of the nibble bit pattern to the
26 // type of entry that can be stored there (number of consecutive blocks). 26 // type of entry that can be stored there (number of consecutive blocks).
27 const char s_types[16] = {4, 3, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0}; 27 const char s_types[16] = {4, 3, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0};
28 28
29 // Returns the type of block (number of consecutive blocks that can be stored) 29 // Returns the type of block (number of consecutive blocks that can be stored)
30 // for a given nibble of the bitmap. 30 // for a given nibble of the bitmap.
31 inline int GetMapBlockType(uint32 value) { 31 inline int GetMapBlockType(uint32 value) {
32 value &= 0xf; 32 value &= 0xf;
33 return s_types[value]; 33 return s_types[value];
(...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after
722 } 722 }
723 723
724 base::FilePath BlockFiles::Name(int index) { 724 base::FilePath BlockFiles::Name(int index) {
725 // The file format allows for 256 files. 725 // The file format allows for 256 files.
726 DCHECK(index < 256 && index >= 0); 726 DCHECK(index < 256 && index >= 0);
727 std::string tmp = base::StringPrintf("%s%d", kBlockName, index); 727 std::string tmp = base::StringPrintf("%s%d", kBlockName, index);
728 return path_.AppendASCII(tmp); 728 return path_.AppendASCII(tmp);
729 } 729 }
730 730
731 } // namespace disk_cache 731 } // namespace disk_cache
OLDNEW
« no previous file with comments | « net/disk_cache/blockfile/backend_worker_v3.cc ('k') | net/disk_cache/blockfile/stats.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698