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

Unified Diff: storage/browser/blob/blob_data_handle.h

Issue 1337153002: [Blob] BlobReader class & tests, and removal of all redundant reading. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: windows fix Created 5 years, 3 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: 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 30412415f76e68fb019f81a29b99743b51f8dd47..7fe5901a4c6ed17913f83fe2960f7b164cd1154d 100644
--- a/storage/browser/blob/blob_data_handle.h
+++ b/storage/browser/blob/blob_data_handle.h
@@ -8,18 +8,22 @@
#include <string>
#include "base/memory/ref_counted.h"
+#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/supports_user_data.h"
#include "storage/browser/storage_browser_export.h"
namespace base {
class SequencedTaskRunner;
+class SingleThreadTaskRunner;
}
namespace storage {
class BlobDataSnapshot;
+class BlobReader;
class BlobStorageContext;
+class FileSystemContext;
// BlobDataHandle ensures that the underlying blob (keyed by the uuid) remains
// in the BlobStorageContext's collection while this object is alive. Anything
@@ -36,15 +40,25 @@ class STORAGE_EXPORT BlobDataHandle
BlobDataHandle(const BlobDataHandle& other); // May be copied on any thread.
~BlobDataHandle() override; // May be deleted on any thread.
- // A BlobDataSnapshot is used to read the data from the blob. This object is
+ // A BlobReader is used to read the data from the blob. This object is
// intended to be transient and should not be stored for any extended period
// of time.
+ scoped_ptr<BlobReader> CreateReader(
+ FileSystemContext* file_system_context,
+ base::SingleThreadTaskRunner* file_task_runner) const;
michaeln 2015/09/17 00:45:37 Does this really need to be a SingleThreadTaskRunn
dmurph 2015/09/19 00:33:43 Sure.
+
+ // May be accessed on any thread.
+ const std::string& uuid() const;
+ // May be accessed on any thread.
+ const std::string& content_type() const;
+ // May be accessed on any thread.
+ const std::string& content_disposition() const;
+
// This call and the destruction of the returned snapshot must be called
// on the IO thread.
+ // TODO(dmurph): Make this protected, where only the BlobReader can call it.
scoped_ptr<BlobDataSnapshot> CreateSnapshot() const;
- const std::string& uuid() const; // May be accessed on any thread.
-
private:
// Internal class whose destructor is guarenteed to be called on the IO
// thread.
@@ -52,11 +66,11 @@ class STORAGE_EXPORT BlobDataHandle
: public base::RefCountedThreadSafe<BlobDataHandleShared> {
public:
BlobDataHandleShared(const std::string& uuid,
- BlobStorageContext* context,
- base::SequencedTaskRunner* task_runner);
+ const std::string& content_type,
+ const std::string& content_disposition,
+ BlobStorageContext* context);
scoped_ptr<BlobDataSnapshot> CreateSnapshot() const;
- const std::string& uuid() const;
private:
friend class base::DeleteHelper<BlobDataHandleShared>;
@@ -66,6 +80,8 @@ class STORAGE_EXPORT BlobDataHandle
virtual ~BlobDataHandleShared();
const std::string uuid_;
+ const std::string content_type_;
+ const std::string content_disposition_;
base::WeakPtr<BlobStorageContext> context_;
DISALLOW_COPY_AND_ASSIGN(BlobDataHandleShared);
@@ -73,6 +89,8 @@ class STORAGE_EXPORT BlobDataHandle
friend class BlobStorageContext;
BlobDataHandle(const std::string& uuid,
+ const std::string& content_type,
+ const std::string& content_disposition,
BlobStorageContext* context,
base::SequencedTaskRunner* task_runner);

Powered by Google App Engine
This is Rietveld 408576698