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

Unified Diff: content/browser/blob_storage/chrome_blob_storage_context.cc

Issue 2552153002: [BlobStorage] Enabling disk paging and direct storage. (Closed)
Patch Set: added comments to WebContentsImplTest Created 3 years, 11 months 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: content/browser/blob_storage/chrome_blob_storage_context.cc
diff --git a/content/browser/blob_storage/chrome_blob_storage_context.cc b/content/browser/blob_storage/chrome_blob_storage_context.cc
index bd02e5144b284e6ac7ed596ee767469e0210550d..3192cd0d2d9c26ac16ee2420094e35893de00d61 100644
--- a/content/browser/blob_storage/chrome_blob_storage_context.cc
+++ b/content/browser/blob_storage/chrome_blob_storage_context.cc
@@ -20,6 +20,7 @@
#include "content/public/browser/browser_thread.h"
#include "storage/browser/blob/blob_data_builder.h"
#include "storage/browser/blob/blob_data_handle.h"
+#include "storage/browser/blob/blob_memory_controller.h"
#include "storage/browser/blob/blob_storage_context.h"
using base::FilePath;
@@ -44,12 +45,15 @@ void RemoveOldBlobStorageDirectories(FilePath blob_storage_parent,
base::FileEnumerator enumerator(blob_storage_parent, false /* recursive */,
base::FileEnumerator::DIRECTORIES);
bool success = true;
+ bool cleanup_needed = false;
for (FilePath name = enumerator.Next(); !name.empty();
name = enumerator.Next()) {
+ cleanup_needed = true;
if (current_run_dir.empty() || name != current_run_dir)
success &= base::DeleteFile(name, true /* recursive */);
}
- LOCAL_HISTOGRAM_BOOLEAN("Storage.Blob.CleanupSuccess", success);
+ if (cleanup_needed)
+ UMA_HISTOGRAM_BOOLEAN("Storage.Blob.CleanupSuccess", success);
}
class BlobHandleImpl : public BlobHandle {
@@ -123,6 +127,12 @@ void ChromeBlobStorageContext::InitializeOnIOThread(
DCHECK_CURRENTLY_ON(BrowserThread::IO);
context_.reset(new BlobStorageContext(std::move(blob_storage_dir),
std::move(file_task_runner)));
+ // Signal the BlobMemoryController when it's appropriate to calculate its
+ // storage limits.
+ BrowserThread::PostAfterStartupTask(
+ FROM_HERE, BrowserThread::GetTaskRunnerForThread(BrowserThread::IO),
+ base::Bind(&storage::BlobMemoryController::CalculateBlobStorageLimits,
+ context_->mutable_memory_controller()->GetWeakPtr()));
}
std::unique_ptr<BlobHandle> ChromeBlobStorageContext::CreateMemoryBackedBlob(

Powered by Google App Engine
This is Rietveld 408576698