OLD | NEW |
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 #ifndef WEBKIT_BLOB_BLOB_STORAGE_CONTROLLER_H_ | 5 #ifndef WEBKIT_BLOB_BLOB_STORAGE_CONTROLLER_H_ |
6 #define WEBKIT_BLOB_BLOB_STORAGE_CONTROLLER_H_ | 6 #define WEBKIT_BLOB_BLOB_STORAGE_CONTROLLER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 typedef base::hash_map<std::string, scoped_refptr<BlobData> > BlobMap; | 43 typedef base::hash_map<std::string, scoped_refptr<BlobData> > BlobMap; |
44 typedef std::map<BlobData*, int> BlobDataUsageMap; | 44 typedef std::map<BlobData*, int> BlobDataUsageMap; |
45 | 45 |
46 void AppendStorageItems(BlobData* target_blob_data, | 46 void AppendStorageItems(BlobData* target_blob_data, |
47 BlobData* src_blob_data, | 47 BlobData* src_blob_data, |
48 uint64 offset, | 48 uint64 offset, |
49 uint64 length); | 49 uint64 length); |
50 void AppendFileItem(BlobData* target_blob_data, | 50 void AppendFileItem(BlobData* target_blob_data, |
51 const FilePath& file_path, uint64 offset, uint64 length, | 51 const FilePath& file_path, uint64 offset, uint64 length, |
52 const base::Time& expected_modification_time); | 52 const base::Time& expected_modification_time); |
| 53 void AppendFileSystemFileItem( |
| 54 BlobData* target_blob_data, |
| 55 const GURL& url, uint64 offset, uint64 length, |
| 56 const base::Time& expected_modification_time); |
53 | 57 |
54 bool RemoveFromMapHelper(BlobMap* map, const GURL& url); | 58 bool RemoveFromMapHelper(BlobMap* map, const GURL& url); |
55 | 59 |
56 void IncrementBlobDataUsage(BlobData* blob_data); | 60 void IncrementBlobDataUsage(BlobData* blob_data); |
57 // Returns true if no longer in use. | 61 // Returns true if no longer in use. |
58 bool DecrementBlobDataUsage(BlobData* blob_data); | 62 bool DecrementBlobDataUsage(BlobData* blob_data); |
59 | 63 |
60 BlobMap blob_map_; | 64 BlobMap blob_map_; |
61 BlobMap unfinalized_blob_map_; | 65 BlobMap unfinalized_blob_map_; |
62 | 66 |
63 // Used to keep track of how much memory is being utitlized for blob data, | 67 // Used to keep track of how much memory is being utitlized for blob data, |
64 // we count only the items of TYPE_DATA which are held in memory and not | 68 // we count only the items of TYPE_DATA which are held in memory and not |
65 // items of TYPE_FILE. | 69 // items of TYPE_FILE. |
66 int64 memory_usage_; | 70 int64 memory_usage_; |
67 | 71 |
68 // Multiple urls can refer to the same blob data, this map keeps track of | 72 // Multiple urls can refer to the same blob data, this map keeps track of |
69 // how many urls refer to a BlobData. | 73 // how many urls refer to a BlobData. |
70 BlobDataUsageMap blob_data_usage_count_; | 74 BlobDataUsageMap blob_data_usage_count_; |
71 | 75 |
72 DISALLOW_COPY_AND_ASSIGN(BlobStorageController); | 76 DISALLOW_COPY_AND_ASSIGN(BlobStorageController); |
73 }; | 77 }; |
74 | 78 |
75 } // namespace webkit_blob | 79 } // namespace webkit_blob |
76 | 80 |
77 #endif // WEBKIT_BLOB_BLOB_STORAGE_CONTROLLER_H_ | 81 #endif // WEBKIT_BLOB_BLOB_STORAGE_CONTROLLER_H_ |
OLD | NEW |