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

Unified Diff: storage/browser/blob/blob_storage_context.cc

Issue 1108083002: Create blobs from Disk Cache entries. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: omg, fix the correct base::Unretained... Created 5 years, 6 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: storage/browser/blob/blob_storage_context.cc
diff --git a/storage/browser/blob/blob_storage_context.cc b/storage/browser/blob/blob_storage_context.cc
index 66f67ea1d2f54726fe8510e65c0997eba2279e69..d08ccb368131fbe557af24a64c270b2817df552f 100644
--- a/storage/browser/blob/blob_storage_context.cc
+++ b/storage/browser/blob/blob_storage_context.cc
@@ -16,6 +16,7 @@
#include "base/thread_task_runner_handle.h"
#include "base/trace_event/trace_event.h"
#include "storage/browser/blob/blob_data_builder.h"
+#include "storage/browser/blob/shareable_file_reference.h"
#include "url/gurl.h"
namespace storage {
@@ -283,6 +284,9 @@ scoped_refptr<BlobDataItem> BlobStorageContext::AllocateBlobItem(
ipc_data.length());
blob_item = new BlobDataItem(element.Pass());
break;
+ case DataElement::TYPE_DISK_CACHE_ENTRY: // This type can't be sent by IPC.
+ NOTREACHED();
+ break;
default:
NOTREACHED();
break;
@@ -365,6 +369,13 @@ bool BlobStorageContext::AppendAllocatedBlobItem(
}
break;
}
+ case DataElement::TYPE_DISK_CACHE_ENTRY: {
+ UMA_HISTOGRAM_COUNTS("Storage.BlobItemSize.CacheEntry",
+ (length - offset) / 1024);
+ target_blob_builder->AppendSharedBlobItem(
+ new ShareableBlobDataItem(target_blob_uuid, blob_item));
+ break;
+ }
default:
NOTREACHED();
break;
@@ -440,7 +451,7 @@ bool BlobStorageContext::AppendBlob(
item.expected_modification_time());
target_blob_builder->AppendSharedBlobItem(new ShareableBlobDataItem(
target_blob_uuid,
- new BlobDataItem(element.Pass(), item.file_handle_)));
+ new BlobDataItem(element.Pass(), item.data_handle_)));
} break;
case DataElement::TYPE_FILE_FILESYSTEM: {
UMA_HISTOGRAM_COUNTS("Storage.BlobItemSize.BlobSlice.FileSystem",
@@ -452,6 +463,16 @@ bool BlobStorageContext::AppendBlob(
target_blob_builder->AppendSharedBlobItem(new ShareableBlobDataItem(
target_blob_uuid, new BlobDataItem(element.Pass())));
} break;
+ case DataElement::TYPE_DISK_CACHE_ENTRY: {
+ scoped_ptr<DataElement> element(new DataElement());
+ element->SetToDiskCacheEntryRange(item.offset() + offset,
+ new_length);
+ target_blob_builder->AppendSharedBlobItem(new ShareableBlobDataItem(
+ target_blob_uuid,
+ new BlobDataItem(element.Pass(), item.data_handle_,
+ item.disk_cache_entry(),
+ item.disk_cache_stream_index())));
+ } break;
default:
CHECK(false) << "Illegal blob item type: " << item.type();
}

Powered by Google App Engine
This is Rietveld 408576698