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

Unified Diff: WebCore/bindings/v8/SerializedScriptValue.cpp

Issue 11192017: ********** WebCore blob hacking (Closed) Base URL: http://svn.webkit.org/repository/webkit/trunk/Source/
Patch Set: Created 8 years, 2 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: WebCore/bindings/v8/SerializedScriptValue.cpp
===================================================================
--- WebCore/bindings/v8/SerializedScriptValue.cpp (revision 132804)
+++ WebCore/bindings/v8/SerializedScriptValue.cpp (working copy)
@@ -392,7 +392,7 @@
doWriteUint32(length);
for (unsigned i = 0; i < length; ++i) {
doWriteWebCoreString(fileList.item(i)->path());
- doWriteWebCoreString(fileList.item(i)->url().string());
+ doWriteWebCoreString(fileList.item(i)->uuid());
doWriteWebCoreString(fileList.item(i)->type());
}
}
@@ -626,14 +626,14 @@
JSFailure
};
- Serializer(Writer& writer, MessagePortArray* messagePorts, ArrayBufferArray* arrayBuffers, Vector<String>& blobURLs, v8::TryCatch& tryCatch)
+ Serializer(Writer& writer, MessagePortArray* messagePorts, ArrayBufferArray* arrayBuffers, BlobDataHandleArray& blobDataHandles, v8::TryCatch& tryCatch)
: m_writer(writer)
, m_tryCatch(tryCatch)
, m_depth(0)
, m_execDepth(0)
, m_status(Success)
, m_nextObjectReference(0)
- , m_blobURLs(blobURLs)
+ , m_blobDataHandles(blobDataHandles)
{
ASSERT(!tryCatch.HasCaught());
if (messagePorts) {
@@ -997,8 +997,8 @@
Blob* blob = V8Blob::toNative(value.As<v8::Object>());
if (!blob)
return;
- m_writer.writeBlob(blob->url().string(), blob->type(), blob->size());
- m_blobURLs.append(blob->url().string());
+ m_writer.writeBlob(blob->uuid(), blob->type(), blob->size());
+ m_blobDataHandles.append(blob->blobDataHandle());
}
#if ENABLE(FILE_SYSTEM)
@@ -1019,8 +1019,8 @@
File* file = V8File::toNative(value.As<v8::Object>());
if (!file)
return;
- m_writer.writeFile(file->path(), file->url().string(), file->type());
- m_blobURLs.append(file->url().string());
+ m_writer.writeFile(file->path(), file->uuid(), file->type());
+ m_blobDataHandles.append(file->blobDataHandle());
}
void writeFileList(v8::Handle<v8::Value> value)
@@ -1031,7 +1031,7 @@
m_writer.writeFileList(*fileList);
unsigned length = fileList->length();
for (unsigned i = 0; i < length; ++i)
- m_blobURLs.append(fileList->item(i)->url().string());
+ m_blobDataHandles.append(fileList->item(i)->blobDataHandle());
}
void writeImageData(v8::Handle<v8::Value> value)
@@ -1150,7 +1150,7 @@
ObjectPool m_transferredMessagePorts;
ObjectPool m_transferredArrayBuffers;
uint32_t m_nextObjectReference;
- Vector<String>& m_blobURLs;
+ BlobDataHandleArray& m_blobDataHandles;
};
Serializer::StateBase* Serializer::doSerialize(v8::Handle<v8::Value> value, StateBase* next)
@@ -1758,16 +1758,16 @@
bool readBlob(v8::Handle<v8::Value>* value)
{
- String url;
+ String uuid;
String type;
uint64_t size;
- if (!readWebCoreString(&url))
+ if (!readWebCoreString(&uuid))
return false;
if (!readWebCoreString(&type))
return false;
if (!doReadUint64(&size))
return false;
- PassRefPtr<Blob> blob = Blob::create(KURL(ParsedURLString, url), type, size);
+ PassRefPtr<Blob> blob = Blob::create(BlobDataHandle::create(uuid, type, size));
*value = toV8(blob, v8::Handle<v8::Object>(), m_isolate);
return true;
}
@@ -1793,15 +1793,15 @@
bool readFile(v8::Handle<v8::Value>* value)
{
String path;
- String url;
+ String uuid;
String type;
if (!readWebCoreString(&path))
return false;
- if (!readWebCoreString(&url))
+ if (!readWebCoreString(&uuid))
return false;
if (!readWebCoreString(&type))
return false;
- PassRefPtr<File> file = File::create(path, KURL(ParsedURLString, url), type);
+ PassRefPtr<File> file = File::create(path, uuid, type);
*value = toV8(file, v8::Handle<v8::Object>(), m_isolate);
return true;
}
@@ -1814,15 +1814,15 @@
PassRefPtr<FileList> fileList = FileList::create();
for (unsigned i = 0; i < length; ++i) {
String path;
- String urlString;
+ String uuid;
String type;
if (!readWebCoreString(&path))
return false;
- if (!readWebCoreString(&urlString))
+ if (!readWebCoreString(&uuid))
return false;
if (!readWebCoreString(&type))
return false;
- fileList->append(File::create(path, KURL(ParsedURLString, urlString), type));
+ fileList->append(File::create(path, uuid, type));
}
*value = toV8(fileList, v8::Handle<v8::Object>(), m_isolate);
return true;
@@ -2261,7 +2261,7 @@
Serializer::Status status;
{
v8::TryCatch tryCatch;
- Serializer serializer(writer, messagePorts, arrayBuffers, m_blobURLs, tryCatch);
+ Serializer serializer(writer, messagePorts, arrayBuffers, m_blobDataHandles, tryCatch);
status = serializer.serialize(value);
if (status == Serializer::JSException) {
// If there was a JS exception thrown, re-throw it.

Powered by Google App Engine
This is Rietveld 408576698