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