Index: content/child/webblobregistry_impl.cc |
diff --git a/content/child/webblobregistry_impl.cc b/content/child/webblobregistry_impl.cc |
index dc94eff94a10a526c75028440124aa25ec47e6c7..c2e71fd8e6ac1d6c97dd53aaede3632d56e1aa54 100644 |
--- a/content/child/webblobregistry_impl.cc |
+++ b/content/child/webblobregistry_impl.cc |
@@ -32,16 +32,16 @@ WebBlobRegistryImpl::~WebBlobRegistryImpl() { |
} |
void WebBlobRegistryImpl::SendData(const WebURL& url, |
- const WebThreadSafeData& data, |
- webkit_blob::BlobData::Item* item) { |
+ const WebThreadSafeData& data) { |
const size_t kLargeThresholdBytes = 250 * 1024; |
const size_t kMaxSharedMemoryBytes = 10 * 1024 * 1024; |
if (data.size() == 0) |
return; |
if (data.size() < kLargeThresholdBytes) { |
- item->SetToBytes(data.data(), data.size()); |
- sender_->Send(new BlobHostMsg_AppendBlobDataItem(url, *item)); |
+ webkit_blob::BlobData::Item item; |
+ item.SetToBytes(data.data(), data.size()); |
+ sender_->Send(new BlobHostMsg_AppendBlobDataItem(url, item)); |
} else { |
// We handle larger amounts of data via SharedMemory instead of |
// writing it directly to the IPC channel. |
@@ -72,16 +72,16 @@ void WebBlobRegistryImpl::registerBlobURL( |
size_t i = 0; |
WebBlobData::Item data_item; |
while (data.itemAt(i++, data_item)) { |
- webkit_blob::BlobData::Item item; |
switch (data_item.type) { |
case WebBlobData::Item::TypeData: { |
// WebBlobData does not allow partial data items. |
DCHECK(!data_item.offset && data_item.length == -1); |
- SendData(url, data_item.data, &item); |
+ SendData(url, data_item.data); |
break; |
} |
case WebBlobData::Item::TypeFile: |
if (data_item.length) { |
+ webkit_blob::BlobData::Item item; |
item.SetToFilePathRange( |
base::FilePath::FromUTF16Unsafe(data_item.filePath), |
static_cast<uint64>(data_item.offset), |
@@ -92,6 +92,7 @@ void WebBlobRegistryImpl::registerBlobURL( |
break; |
case WebBlobData::Item::TypeBlob: |
if (data_item.length) { |
+ webkit_blob::BlobData::Item item; |
item.SetToBlobUrlRange( |
data_item.blobURL, |
static_cast<uint64>(data_item.offset), |
@@ -103,6 +104,7 @@ void WebBlobRegistryImpl::registerBlobURL( |
if (data_item.length) { |
// We only support filesystem URL as of now. |
DCHECK(GURL(data_item.url).SchemeIsFileSystem()); |
+ webkit_blob::BlobData::Item item; |
item.SetToFileSystemUrlRange( |
data_item.url, |
static_cast<uint64>(data_item.offset), |
@@ -119,6 +121,13 @@ void WebBlobRegistryImpl::registerBlobURL( |
url, data.contentType().utf8().data())); |
} |
+void WebBlobRegistryImpl::registerStreamURL( |
+ const WebURL& url, const WebString& content_type) { |
+ DCHECK(ChildThread::current()->message_loop() == |
+ base::MessageLoop::current()); |
+ sender_->Send(new BlobHostMsg_StartBuildingStream(url, content_type.utf8())); |
+} |
+ |
void WebBlobRegistryImpl::registerBlobURL( |
const WebURL& url, const WebURL& src_url) { |
DCHECK(ChildThread::current()->message_loop() == |
@@ -126,6 +135,19 @@ void WebBlobRegistryImpl::registerBlobURL( |
sender_->Send(new BlobHostMsg_CloneBlob(url, src_url)); |
} |
+void WebBlobRegistryImpl::addDataToStream(const WebKit::WebURL& url, |
+ WebKit::WebThreadSafeData& data) { |
+ DCHECK(ChildThread::current()->message_loop() == |
+ base::MessageLoop::current()); |
+ SendData(url, data); |
+} |
+ |
+void WebBlobRegistryImpl::finalizeStream(const WebURL& url) { |
+ DCHECK(ChildThread::current()->message_loop() == |
+ base::MessageLoop::current()); |
+ sender_->Send(new BlobHostMsg_FinishBuildingBlob(url, "")); |
+} |
+ |
void WebBlobRegistryImpl::unregisterBlobURL(const WebURL& url) { |
DCHECK(ChildThread::current()->message_loop() == |
base::MessageLoop::current()); |