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

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: Fixed prod/debug flakiness 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
« no previous file with comments | « storage/browser/BUILD.gn ('k') | storage/browser/blob/blob_data_handle.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..8eba2c61fdaeb85f84ca1d6913450ad4d2158f28 100644
--- a/storage/browser/blob/blob_data_handle.h
+++ b/storage/browser/blob/blob_data_handle.h
@@ -8,6 +8,7 @@
#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"
@@ -19,7 +20,9 @@ class SequencedTaskRunner;
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 +39,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::SequencedTaskRunner* file_task_runner) const;
+
+ // 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 +65,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 +79,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,8 +88,10 @@ 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);
+ base::SequencedTaskRunner* io_task_runner);
scoped_refptr<base::SequencedTaskRunner> io_task_runner_;
scoped_refptr<BlobDataHandleShared> shared_;
« no previous file with comments | « storage/browser/BUILD.gn ('k') | storage/browser/blob/blob_data_handle.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698