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

Unified Diff: storage/browser/blob/blob_memory_controller.h

Issue 2552153002: [BlobStorage] Enabling disk paging and direct storage. (Closed)
Patch Set: Added detection for getting close to disk full, and disk usage freezing Created 4 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 side-by-side diff with in-line comments
Download patch
Index: storage/browser/blob/blob_memory_controller.h
diff --git a/storage/browser/blob/blob_memory_controller.h b/storage/browser/blob/blob_memory_controller.h
index 865d3e01ab580a460364d62375a136ff24e54aa8..14f031697fb229e652c5207e1401d68a5bd4f28a 100644
--- a/storage/browser/blob/blob_memory_controller.h
+++ b/storage/browser/blob/blob_memory_controller.h
@@ -16,7 +16,7 @@
#include <utility>
#include <vector>
-#include "base/callback.h"
+#include "base/callback_forward.h"
#include "base/callback_helpers.h"
#include "base/containers/mru_cache.h"
#include "base/files/file.h"
@@ -157,8 +157,14 @@ class STORAGE_EXPORT BlobMemoryController {
size_t memory_usage() const { return blob_memory_used_; }
uint64_t disk_usage() const { return disk_used_; }
+ // Schedules a task on the file runner to calculate blob storage quota limits.
+ void CalculateBlobStorageLimits();
+
+ base::WeakPtr<BlobMemoryController> GetWeakPtr();
+
const BlobStorageLimits& limits() const { return limits_; }
void set_limits_for_testing(const BlobStorageLimits& limits) {
+ manual_limits_set_ = true;
limits_ = limits;
}
@@ -171,6 +177,10 @@ class STORAGE_EXPORT BlobMemoryController {
using PendingFileQuotaTaskList =
std::list<std::unique_ptr<FileQuotaAllocationTask>>;
+ void OnStorageLimitsCalculated(BlobStorageLimits limits);
+
+ void FreezeDiskUsage(uint64_t avail_disk_space);
+
base::WeakPtr<QuotaAllocationTask> AppendMemoryTask(
uint64_t total_bytes_needed,
std::vector<scoped_refptr<ShareableBlobDataItem>> unreserved_memory_items,
@@ -190,7 +200,7 @@ class STORAGE_EXPORT BlobMemoryController {
scoped_refptr<ShareableFileReference> file_reference,
std::vector<scoped_refptr<ShareableBlobDataItem>> items,
size_t total_items_size,
- FileCreationInfo result);
+ std::pair<FileCreationInfo, int64_t> result);
size_t GetAvailableMemoryForBlobs() const;
uint64_t GetAvailableFileSpaceForBlobs() const;
@@ -210,6 +220,9 @@ class STORAGE_EXPORT BlobMemoryController {
// changes.
void RecordTracingCounters() const;
+ // Store that we set manual limits so we don't accidentally override them with
+ // our configuration task.
+ bool manual_limits_set_ = false;
BlobStorageLimits limits_;
// Memory bookkeeping. These numbers are all disjoint.

Powered by Google App Engine
This is Rietveld 408576698