| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 STORAGE_BROWSER_BLOB_BLOB_MEMORY_CONTROLLER_H_ | 5 #ifndef STORAGE_BROWSER_BLOB_BLOB_MEMORY_CONTROLLER_H_ |
| 6 #define STORAGE_BROWSER_BLOB_BLOB_MEMORY_CONTROLLER_H_ | 6 #define STORAGE_BROWSER_BLOB_BLOB_MEMORY_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <list> | 10 #include <list> |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 | 96 |
| 97 protected: | 97 protected: |
| 98 virtual ~QuotaAllocationTask(); | 98 virtual ~QuotaAllocationTask(); |
| 99 }; | 99 }; |
| 100 | 100 |
| 101 // The bool argument is true if we successfully received memory quota. | 101 // The bool argument is true if we successfully received memory quota. |
| 102 using MemoryQuotaRequestCallback = base::Callback<void(bool)>; | 102 using MemoryQuotaRequestCallback = base::Callback<void(bool)>; |
| 103 // The bool argument is true if we successfully received file quota, and the | 103 // The bool argument is true if we successfully received file quota, and the |
| 104 // vector argument provides the file info. | 104 // vector argument provides the file info. |
| 105 using FileQuotaRequestCallback = | 105 using FileQuotaRequestCallback = |
| 106 base::Callback<void(std::vector<FileCreationInfo>, bool)>; | 106 base::Callback<void(bool, std::vector<FileCreationInfo>)>; |
| 107 | 107 |
| 108 // We enable file paging if |file_runner| isn't a nullptr. | 108 // We enable file paging if |file_runner| isn't a nullptr. |
| 109 BlobMemoryController(const base::FilePath& storage_directory, | 109 BlobMemoryController(const base::FilePath& storage_directory, |
| 110 scoped_refptr<base::TaskRunner> file_runner); | 110 scoped_refptr<base::TaskRunner> file_runner); |
| 111 ~BlobMemoryController(); | 111 ~BlobMemoryController(); |
| 112 | 112 |
| 113 // Disables file paging. This cancels all pending file creations and paging | 113 // Disables file paging. This cancels all pending file creations and paging |
| 114 // operations. Reason is recorded in UMA. | 114 // operations. Reason is recorded in UMA. |
| 115 void DisableFilePaging(base::File::Error reason); | 115 void DisableFilePaging(base::File::Error reason); |
| 116 | 116 |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 // another blob successfully grabs a ref, we can prevent it from adding the | 243 // another blob successfully grabs a ref, we can prevent it from adding the |
| 244 // item to the recent_item_cache_ above. | 244 // item to the recent_item_cache_ above. |
| 245 std::unordered_set<uint64_t> items_paging_to_file_; | 245 std::unordered_set<uint64_t> items_paging_to_file_; |
| 246 | 246 |
| 247 base::WeakPtrFactory<BlobMemoryController> weak_factory_; | 247 base::WeakPtrFactory<BlobMemoryController> weak_factory_; |
| 248 | 248 |
| 249 DISALLOW_COPY_AND_ASSIGN(BlobMemoryController); | 249 DISALLOW_COPY_AND_ASSIGN(BlobMemoryController); |
| 250 }; | 250 }; |
| 251 } // namespace storage | 251 } // namespace storage |
| 252 #endif // STORAGE_BROWSER_BLOB_BLOB_MEMORY_CONTROLLER_H_ | 252 #endif // STORAGE_BROWSER_BLOB_BLOB_MEMORY_CONTROLLER_H_ |
| OLD | NEW |