Index: storage/browser/blob/blob_data_handle.h |
diff --git a/storage/browser/blob/blob_data_handle.h b/storage/browser/blob/blob_data_handle.h |
index 3f4529346b103cc0149d0a507494011e867153dc..a174a1b355b6d9543563598d2fb70ce32ca75246 100644 |
--- a/storage/browser/blob/blob_data_handle.h |
+++ b/storage/browser/blob/blob_data_handle.h |
@@ -5,6 +5,7 @@ |
#ifndef STORAGE_BROWSER_BLOB_BLOB_DATA_HANDLE_H_ |
#define STORAGE_BROWSER_BLOB_BLOB_DATA_HANDLE_H_ |
+#include <limits> |
#include <memory> |
#include <string> |
@@ -39,6 +40,8 @@ class FileSystemContext; |
class STORAGE_EXPORT BlobDataHandle |
: public base::SupportsUserData::Data { |
public: |
+ static constexpr uint64_t kUnknownSize = std::numeric_limits<uint64_t>::max(); |
+ |
// True means the blob was constructed successfully, and false means that |
// there was an error, which is reported in the second argument. |
using BlobConstructedCallback = |
@@ -77,6 +80,9 @@ class STORAGE_EXPORT BlobDataHandle |
const std::string& content_type() const; |
// May be accessed on any thread. |
const std::string& content_disposition() const; |
+ // May be accessed on any thread. In rare cases where the blob is created |
+ // as a file from javascript, this will be kUnknownSize. |
+ uint64_t size() const; |
// This call and the destruction of the returned snapshot must be called |
// on the IO thread. If the blob is broken, then we return a nullptr here. |
@@ -94,6 +100,7 @@ class STORAGE_EXPORT BlobDataHandle |
BlobDataHandleShared(const std::string& uuid, |
const std::string& content_type, |
const std::string& content_disposition, |
+ uint64_t size, |
BlobStorageContext* context); |
private: |
@@ -106,6 +113,7 @@ class STORAGE_EXPORT BlobDataHandle |
const std::string uuid_; |
const std::string content_type_; |
const std::string content_disposition_; |
+ const uint64_t size_; |
base::WeakPtr<BlobStorageContext> context_; |
DISALLOW_COPY_AND_ASSIGN(BlobDataHandleShared); |
@@ -115,6 +123,7 @@ class STORAGE_EXPORT BlobDataHandle |
BlobDataHandle(const std::string& uuid, |
const std::string& content_type, |
const std::string& content_disposition, |
+ uint64_t size, |
BlobStorageContext* context, |
base::SequencedTaskRunner* io_task_runner); |