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

Side by Side Diff: net/disk_cache/simple/simple_util.h

Issue 1535363003: Switch to standard integer types in net/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: stddef Created 5 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/simple/simple_test_util.h ('k') | net/disk_cache/simple/simple_util.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 #ifndef NET_DISK_CACHE_SIMPLE_SIMPLE_UTIL_H_ 5 #ifndef NET_DISK_CACHE_SIMPLE_SIMPLE_UTIL_H_
6 #define NET_DISK_CACHE_SIMPLE_SIMPLE_UTIL_H_ 6 #define NET_DISK_CACHE_SIMPLE_SIMPLE_UTIL_H_
7 7
8 #include <stdint.h>
9
8 #include <string> 10 #include <string>
9 11
10 #include "base/basictypes.h"
11 #include "base/strings/string_piece.h" 12 #include "base/strings/string_piece.h"
12 #include "net/base/net_export.h" 13 #include "net/base/net_export.h"
13 14
14 namespace base { 15 namespace base {
15 class FilePath; 16 class FilePath;
16 class Time; 17 class Time;
17 } 18 }
18 19
19 namespace disk_cache { 20 namespace disk_cache {
20 21
21 namespace simple_util { 22 namespace simple_util {
22 23
23 NET_EXPORT_PRIVATE std::string ConvertEntryHashKeyToHexString(uint64 hash_key); 24 NET_EXPORT_PRIVATE std::string ConvertEntryHashKeyToHexString(
25 uint64_t hash_key);
24 26
25 // |key| is the regular cache key, such as an URL. 27 // |key| is the regular cache key, such as an URL.
26 // Returns the Hex ascii representation of the uint64 hash_key. 28 // Returns the Hex ascii representation of the uint64_t hash_key.
27 NET_EXPORT_PRIVATE std::string GetEntryHashKeyAsHexString( 29 NET_EXPORT_PRIVATE std::string GetEntryHashKeyAsHexString(
28 const std::string& key); 30 const std::string& key);
29 31
30 // |key| is the regular HTTP Cache key, which is a URL. 32 // |key| is the regular HTTP Cache key, which is a URL.
31 // Returns the hash of the key as uint64. 33 // Returns the hash of the key as uint64_t.
32 NET_EXPORT_PRIVATE uint64 GetEntryHashKey(const std::string& key); 34 NET_EXPORT_PRIVATE uint64_t GetEntryHashKey(const std::string& key);
33 35
34 // Parses the |hash_key| string into a uint64 buffer. 36 // Parses the |hash_key| string into a uint64_t buffer.
35 // |hash_key| string must be of the form: FFFFFFFFFFFFFFFF . 37 // |hash_key| string must be of the form: FFFFFFFFFFFFFFFF .
36 NET_EXPORT_PRIVATE bool GetEntryHashKeyFromHexString( 38 NET_EXPORT_PRIVATE bool GetEntryHashKeyFromHexString(
37 const base::StringPiece& hash_key, 39 const base::StringPiece& hash_key,
38 uint64* hash_key_out); 40 uint64_t* hash_key_out);
39 41
40 // Given a |key| for a (potential) entry in the simple backend and the |index| 42 // Given a |key| for a (potential) entry in the simple backend and the |index|
41 // of a stream on that entry, returns the filename in which that stream would be 43 // of a stream on that entry, returns the filename in which that stream would be
42 // stored. 44 // stored.
43 NET_EXPORT_PRIVATE std::string GetFilenameFromKeyAndFileIndex( 45 NET_EXPORT_PRIVATE std::string GetFilenameFromKeyAndFileIndex(
44 const std::string& key, 46 const std::string& key,
45 int file_index); 47 int file_index);
46 48
47 // Same as |GetFilenameFromKeyAndIndex| above, but using a hex string. 49 // Same as |GetFilenameFromKeyAndIndex| above, but using a hex string.
48 std::string GetFilenameFromEntryHashAndFileIndex(uint64 entry_hash, 50 std::string GetFilenameFromEntryHashAndFileIndex(uint64_t entry_hash,
49 int file_index); 51 int file_index);
50 52
51 // Given a |key| for an entry, returns the name of the sparse data file. 53 // Given a |key| for an entry, returns the name of the sparse data file.
52 std::string GetSparseFilenameFromEntryHash(uint64 entry_hash); 54 std::string GetSparseFilenameFromEntryHash(uint64_t entry_hash);
53 55
54 // Given the size of a file holding a stream in the simple backend and the key 56 // Given the size of a file holding a stream in the simple backend and the key
55 // to an entry, returns the number of bytes in the stream. 57 // to an entry, returns the number of bytes in the stream.
56 NET_EXPORT_PRIVATE int32 GetDataSizeFromKeyAndFileSize(const std::string& key, 58 NET_EXPORT_PRIVATE int32_t GetDataSizeFromKeyAndFileSize(const std::string& key,
57 int64 file_size); 59 int64_t file_size);
58 60
59 // Given the size of a stream in the simple backend and the key to an entry, 61 // Given the size of a stream in the simple backend and the key to an entry,
60 // returns the number of bytes in the file. 62 // returns the number of bytes in the file.
61 NET_EXPORT_PRIVATE int64 GetFileSizeFromKeyAndDataSize(const std::string& key, 63 NET_EXPORT_PRIVATE int64_t GetFileSizeFromKeyAndDataSize(const std::string& key,
62 int32 data_size); 64 int32_t data_size);
63 65
64 // Given the stream index, returns the number of the file the stream is stored 66 // Given the stream index, returns the number of the file the stream is stored
65 // in. 67 // in.
66 NET_EXPORT_PRIVATE int GetFileIndexFromStreamIndex(int stream_index); 68 NET_EXPORT_PRIVATE int GetFileIndexFromStreamIndex(int stream_index);
67 69
68 // Fills |out_time| with the time the file last modified time. Unlike the 70 // Fills |out_time| with the time the file last modified time. Unlike the
69 // functions in file.h, the time resolution is milliseconds. 71 // functions in file.h, the time resolution is milliseconds.
70 NET_EXPORT_PRIVATE bool GetMTime(const base::FilePath& path, 72 NET_EXPORT_PRIVATE bool GetMTime(const base::FilePath& path,
71 base::Time* out_mtime); 73 base::Time* out_mtime);
72 74
73 // Deletes a file, insuring POSIX semantics. Provided that all open handles to 75 // Deletes a file, insuring POSIX semantics. Provided that all open handles to
74 // this file were opened with File::FLAG_SHARE_DELETE, it is possible to delete 76 // this file were opened with File::FLAG_SHARE_DELETE, it is possible to delete
75 // an open file and continue to use that file. After deleting an open file, it 77 // an open file and continue to use that file. After deleting an open file, it
76 // is possible to immediately create a new file with the same name. 78 // is possible to immediately create a new file with the same name.
77 NET_EXPORT_PRIVATE bool SimpleCacheDeleteFile(const base::FilePath& path); 79 NET_EXPORT_PRIVATE bool SimpleCacheDeleteFile(const base::FilePath& path);
78 80
79 } // namespace simple_util 81 } // namespace simple_util
80 82
81 } // namespace disk_cache 83 } // namespace disk_cache
82 84
83 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_UTIL_H_ 85 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_UTIL_H_
OLDNEW
« no previous file with comments | « net/disk_cache/simple/simple_test_util.h ('k') | net/disk_cache/simple/simple_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698