| 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..9e068a71610ed4db99e73e17e0fdcb100b712f10 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 { | 
| @@ -46,14 +47,17 @@ class BlobDataSnapshot; | 
| class ShareableBlobDataItem; | 
|  | 
| // This class handles the logistics of blob storage within the browser process. | 
| -// We are single threaded and should only be used on the IO thread. In Chromium | 
| -// there is one instance per profile. | 
| +// This class is not threadsafe, access on IO thread. In Chromium there is one | 
| +// instance per profile. | 
| class STORAGE_EXPORT BlobStorageContext { | 
| public: | 
| using TransportAllowedCallback = BlobEntry::TransportAllowedCallback; | 
|  | 
| // Initializes the context without disk support. | 
| BlobStorageContext(); | 
| +  // Disk support is enabled if |file_runner| isn't null. | 
| +  BlobStorageContext(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. | 
| @@ -152,6 +159,8 @@ class STORAGE_EXPORT BlobStorageContext { | 
| //   reference ourself. | 
| BlobStatus status = BlobStatus::ERR_INVALID_CONSTRUCTION_ARGUMENTS; | 
|  | 
| +    bool contains_unpopulated_transport_items = false; | 
| + | 
| // This is the total size of the blob, including all memory, files, etc. | 
| uint64_t total_size = 0; | 
| // Total memory size of the blob (not including files, etc). | 
| @@ -159,14 +168,19 @@ 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. | 
| +    // This happens when we do a partial slice from a pending data or file | 
| +    // item. | 
| std::vector<BlobEntry::ItemCopyEntry> copies; | 
|  | 
| private: | 
| @@ -235,7 +249,13 @@ class STORAGE_EXPORT BlobStorageContext { | 
| BlobEntry* entry, | 
| std::vector<BlobMemoryController::FileCreationInfo> files); | 
|  | 
| -  void OnEnoughSizeForMemory(const std::string& uuid, bool can_fit); | 
| +  // The files array is empty for memory quota request responses. | 
| +  void OnEnoughSpaceForTransport( | 
| +      const std::string& uuid, | 
| +      std::vector<BlobMemoryController::FileCreationInfo> files, | 
| +      bool can_fit); | 
| + | 
| +  void OnEnoughSpaceForCopies(const std::string& uuid, bool can_fit); | 
|  | 
| void OnDependentBlobFinished(const std::string& owning_blob_uuid, | 
| BlobStatus reason); | 
|  |