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

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

Issue 325383002: Snapshot File metadata when serializing for IDB (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Try a safer approach Created 6 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
« no previous file with comments | « LayoutTests/storage/indexeddb/blob-basics-metadata.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/v8/SerializedScriptValue.cpp
diff --git a/Source/bindings/v8/SerializedScriptValue.cpp b/Source/bindings/v8/SerializedScriptValue.cpp
index 1179d32e29722eb61c393a984d0aac76b2240fb3..e11af11b6515e6b3ab29b28eba5bbed8754fd690 100644
--- a/Source/bindings/v8/SerializedScriptValue.cpp
+++ b/Source/bindings/v8/SerializedScriptValue.cpp
@@ -1310,7 +1310,7 @@ private:
return handleError(DataCloneError, "A File object has been closed, and could therefore not be cloned.", next);
int blobIndex = -1;
m_blobDataHandles.add(file->uuid(), file->blobDataHandle());
- if (appendFileInfo(file->uuid(), file->path(), file->name(), file->type(), &blobIndex)) {
+ if (appendFileInfo(file, &blobIndex)) {
ASSERT(blobIndex >= 0);
m_writer.writeFileIndex(blobIndex);
} else {
@@ -1332,7 +1332,7 @@ private:
if (file->hasBeenClosed())
return handleError(DataCloneError, "A File object has been closed, and could therefore not be cloned.", next);
m_blobDataHandles.add(file->uuid(), file->blobDataHandle());
- if (appendFileInfo(file->uuid(), file->path(), file->name(), file->type(), &blobIndex)) {
+ if (appendFileInfo(file, &blobIndex)) {
ASSERT(!i || blobIndex > 0);
ASSERT(blobIndex >= 0);
blobIndices.append(blobIndex);
@@ -1470,12 +1470,16 @@ private:
return true;
}
- bool appendFileInfo(const String& uuid, const String& filePath, const String& fileName, const String& type, int* index)
+ bool appendFileInfo(const File* file, int* index)
{
if (!m_blobInfo)
return false;
+
+ long long size = -1;
+ double lastModified = invalidFileTime();
+ file->captureSnapshot(size, lastModified);
*index = m_blobInfo->size();
- m_blobInfo->append(blink::WebBlobInfo(uuid, filePath, fileName, type));
+ m_blobInfo->append(blink::WebBlobInfo(file->uuid(), file->path(), file->name(), file->type(), lastModified, size));
return true;
}
« no previous file with comments | « LayoutTests/storage/indexeddb/blob-basics-metadata.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698