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

Unified Diff: third_party/WebKit/Source/platform/blob/BlobData.h

Issue 2717583003: [BlobStorage] Enforcing renderer constraints to prevent broken blobs (Closed)
Patch Set: added test Created 3 years, 9 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: third_party/WebKit/Source/platform/blob/BlobData.h
diff --git a/third_party/WebKit/Source/platform/blob/BlobData.h b/third_party/WebKit/Source/platform/blob/BlobData.h
index fe42093dfd2fa8dbd2ffd7b7192f20ba83ab456c..45b96392fdcf9902e09d6c245c11ac38fbf40bd2 100644
--- a/third_party/WebKit/Source/platform/blob/BlobData.h
+++ b/third_party/WebKit/Source/platform/blob/BlobData.h
@@ -152,10 +152,18 @@ class PLATFORM_EXPORT BlobData {
public:
static std::unique_ptr<BlobData> create();
- // Calling append* on the returned object will check-fail. The caller can only
- // have an unknown-length file if it is the only item in the blob.
+
+ // Calling append* on objects returned by createFor___WithUnknownSize will
+ // check-fail. The caller can only have an unknown-length file if it is the
+ // only item in the blob.
static std::unique_ptr<BlobData> createForFileWithUnknownSize(
const String& path);
+ static std::unique_ptr<BlobData> createForFileWithUnknownSize(
+ const String& path,
+ double expectedModificationTime);
+ static std::unique_ptr<BlobData> createForFileSystemURLWithUnknownSize(
+ const KURL& fileSystemURL,
+ double expectedModificationTime);
// Detaches from current thread so that it can be passed to another thread.
void detachFromCurrentThread();
@@ -171,6 +179,9 @@ class PLATFORM_EXPORT BlobData {
long long offset,
long long length,
double expectedModificationTime);
+
+ // The given blob must not be a file with unknown size. Please use the
+ // File::appendTo instead.
void appendBlob(PassRefPtr<BlobDataHandle>,
long long offset,
long long length);
@@ -185,6 +196,10 @@ class PLATFORM_EXPORT BlobData {
// determined.
long long length() const;
+ bool isSingleUnknownSizeFile() const {
+ return m_fileComposition == FileCompositionStatus::SINGLE_UNKNOWN_SIZE_FILE;
+ }
+
private:
FRIEND_TEST_ALL_PREFIXES(BlobDataTest, Consolidation);
@@ -228,6 +243,8 @@ class PLATFORM_EXPORT BlobDataHandle
String type() const { return m_type.isolatedCopy(); }
unsigned long long size() const { return m_size; }
+ bool isSingleUnknownSizeFile() const { return m_isSingleUnknownSizeFile; }
+
~BlobDataHandle();
private:
@@ -238,6 +255,7 @@ class PLATFORM_EXPORT BlobDataHandle
const String m_uuid;
const String m_type;
const long long m_size;
+ const bool m_isSingleUnknownSizeFile;
};
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/fileapi/FileTest.cpp ('k') | third_party/WebKit/Source/platform/blob/BlobData.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698