Index: storage/browser/blob/blob_entry.h |
diff --git a/storage/browser/blob/blob_entry.h b/storage/browser/blob/blob_entry.h |
index 3c3869e89f4d9a8b8a382c74f59dd370f590c481..f0be7544578eff6e89d58ba4cb580957d74d8c24 100644 |
--- a/storage/browser/blob/blob_entry.h |
+++ b/storage/browser/blob/blob_entry.h |
@@ -24,16 +24,15 @@ class BlobDataHandle; |
class ShareableBlobDataItem; |
class ViewBlobInternalsJob; |
-// This class represents a blob in BlobStorageRegistry. We export this only for |
-// unit tests. |
+// Represents a blob in BlobStorageRegistry. Exported only for unit tests. |
class STORAGE_EXPORT BlobEntry { |
public: |
using TransportAllowedCallback = |
base::Callback<void(BlobStatus, |
std::vector<BlobMemoryController::FileCreationInfo>)>; |
- // This records a copy from a referenced blob. When we finish building our |
- // blob we perform all of these copies. |
+ // Records a copy from a referenced blob. Copies happen after referenced blobs |
+ // are complete & quota for the copies is granted. |
struct STORAGE_EXPORT ItemCopyEntry { |
ItemCopyEntry(scoped_refptr<ShareableBlobDataItem> source_item, |
size_t source_item_offset, |
@@ -50,11 +49,11 @@ class STORAGE_EXPORT BlobEntry { |
DISALLOW_COPY_AND_ASSIGN(ItemCopyEntry); |
}; |
- // This keeps track of our building state for our blob. While building, four |
- // things can be happening mostly simultaneously: |
- // 1. Waiting for quota to be reserved for memory needed (PENDING_QUOTA) |
+ // Building state for pending blobs. State can include: |
+ // 1. Waiting for quota to be granted for transport data (PENDING_QUOTA) |
// 2. Waiting for user population of data after quota (PENDING_TRANSPORT) |
- // 3. Waiting for blobs we reference to complete (PENDING_INTERNALS) |
+ // 3. Waiting for blobs we reference to complete & quota granted for possible |
+ // copies. (PENDING_INTERNALS) |
struct STORAGE_EXPORT BuildingState { |
// |transport_allowed_callback| is not null when data needs population. See |
// BlobStorageContext::BuildBlob for when the callback is called. |
@@ -75,7 +74,10 @@ class STORAGE_EXPORT BlobEntry { |
size_t num_building_dependent_blobs; |
base::WeakPtr<BlobMemoryController::QuotaAllocationTask> |
- memory_quota_request; |
+ transport_quota_request; |
+ |
+ // Copy quota is always memory. |
+ base::WeakPtr<BlobMemoryController::QuotaAllocationTask> copy_quota_request; |
// These are copies from a referenced blob item to our blob items. Some of |
// these entries may have changed from bytes to files if they were paged. |
@@ -97,7 +99,8 @@ class STORAGE_EXPORT BlobEntry { |
// Returns if we're a pending blob that can finish building. |
bool CanFinishBuilding() const { |
- return status_ == BlobStatus::PENDING_INTERNALS && |
+ return status_ == BlobStatus::PENDING_INTERNALS && building_state_ && |
+ !building_state_->copy_quota_request && |
building_state_->num_building_dependent_blobs == 0; |
} |