Chromium Code Reviews| Index: storage/browser/blob/blob_storage_context.h |
| diff --git a/storage/browser/blob/blob_storage_context.h b/storage/browser/blob/blob_storage_context.h |
| index c64581e91c7278109256607ecabe763e89761430..da6f0e8fd42ca31ed8e3021f4131cba7967614c3 100644 |
| --- a/storage/browser/blob/blob_storage_context.h |
| +++ b/storage/browser/blob/blob_storage_context.h |
| @@ -36,6 +36,7 @@ class TaskRunner; |
| namespace content { |
| class BlobDispatcherHost; |
| class BlobDispatcherHostTest; |
| +class BlobStorageBrowserTest; |
| } |
| namespace storage { |
| @@ -54,6 +55,9 @@ class STORAGE_EXPORT BlobStorageContext { |
| // Initializes the context without disk support. |
| BlobStorageContext(); |
| + // We enable disk support if |file_runner| isn't null. |
|
pwnall
2016/12/01 01:12:14
We enable disk support -> disk support is enabled.
dmurph
2016/12/01 20:40:59
Done.
|
| + BlobStorageContext(const base::FilePath& storage_directory, |
| + scoped_refptr<base::TaskRunner> file_runner); |
| ~BlobStorageContext(); |
| std::unique_ptr<BlobDataHandle> GetBlobDataFromUUID(const std::string& uuid); |
| @@ -125,6 +129,7 @@ class STORAGE_EXPORT BlobStorageContext { |
| protected: |
| friend class content::BlobDispatcherHost; |
| friend class content::BlobDispatcherHostTest; |
| + friend class content::BlobStorageBrowserTest; |
| friend class BlobTransportHost; |
| friend class BlobTransportHostTest; |
| friend class BlobDataHandle; |
| @@ -133,6 +138,8 @@ class STORAGE_EXPORT BlobStorageContext { |
| friend class BlobSliceTest; |
| friend class BlobStorageContextTest; |
| + enum class TransportQuotaType { MEMORY, FILE }; |
| + |
| // Transforms a BlobDataBuilder into a BlobEntry with no blob references. |
| // BlobSlice is used to flatten out these references. Records the total size |
| // and items for memory and file quota requests. |
| @@ -159,11 +166,16 @@ class STORAGE_EXPORT BlobStorageContext { |
| std::vector<std::pair<std::string, BlobEntry*>> dependent_blobs; |
| - uint64_t memory_quota_needed = 0; |
| - std::vector<scoped_refptr<ShareableBlobDataItem>> pending_memory_items; |
| - |
| + TransportQuotaType transport_quota_type = TransportQuotaType::MEMORY; |
| + uint64_t transport_quota_needed = 0; |
| + std::vector<scoped_refptr<ShareableBlobDataItem>> pending_transport_items; |
| + // Hold a separate vector of pointers to declare them as populated. |
| std::vector<ShareableBlobDataItem*> transport_items; |
| + // Copy quota is always memory quota. |
| + uint64_t copy_quota_needed = 0; |
| + std::vector<scoped_refptr<ShareableBlobDataItem>> pending_copy_items; |
| + |
| // These record all future copies we'll need to do from referenced blobs. |
| // This |
| // happens when we do a partial slice from a pending data or file item. |
| @@ -235,7 +247,14 @@ class STORAGE_EXPORT BlobStorageContext { |
| BlobEntry* entry, |
| std::vector<BlobMemoryController::FileCreationInfo> files); |
| - void OnEnoughSizeForMemory(const std::string& uuid, bool can_fit); |
| + void OnEnoughSpaceForTransportByFiles( |
| + const std::string& uuid, |
| + bool can_fit, |
| + std::vector<BlobMemoryController::FileCreationInfo> files); |
| + |
| + void OnEnoughSpaceForTransportByMemory(const std::string& uuid, bool can_fit); |
| + |
| + void OnEnoughSpaceForCopies(const std::string& uuid, bool can_fit); |
| void OnDependentBlobFinished(const std::string& owning_blob_uuid, |
| BlobStatus reason); |