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

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

Issue 1376123002: Revert of [Blob] BlobReader class & tests, and removal of all redundant reading. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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/blob/blob_data_handle.h ('k') | storage/browser/blob/blob_data_snapshot.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: storage/browser/blob/blob_data_handle.cc
diff --git a/storage/browser/blob/blob_data_handle.cc b/storage/browser/blob/blob_data_handle.cc
index 3e864fa1cdf9bcdb0caba7096522b16a0c32193d..e3a4be944fe36eeedaed8cfb16cdf5a159f595c0 100644
--- a/storage/browser/blob/blob_data_handle.cc
+++ b/storage/browser/blob/blob_data_handle.cc
@@ -8,81 +8,26 @@
#include "base/location.h"
#include "base/logging.h"
#include "base/sequenced_task_runner.h"
-#include "base/task_runner.h"
-#include "base/time/time.h"
#include "storage/browser/blob/blob_data_snapshot.h"
-#include "storage/browser/blob/blob_reader.h"
#include "storage/browser/blob/blob_storage_context.h"
-#include "storage/browser/fileapi/file_stream_reader.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/file_system_url.h"
-#include "url/gurl.h"
namespace storage {
-namespace {
-
-class FileStreamReaderProviderImpl
- : public BlobReader::FileStreamReaderProvider {
- public:
- FileStreamReaderProviderImpl(FileSystemContext* file_system_context)
- : file_system_context_(file_system_context) {}
- ~FileStreamReaderProviderImpl() override {}
-
- scoped_ptr<FileStreamReader> CreateForLocalFile(
- base::TaskRunner* task_runner,
- const base::FilePath& file_path,
- int64_t initial_offset,
- const base::Time& expected_modification_time) override {
- return make_scoped_ptr(FileStreamReader::CreateForLocalFile(
- task_runner, file_path, initial_offset, expected_modification_time));
- }
-
- scoped_ptr<FileStreamReader> CreateFileStreamReader(
- const GURL& filesystem_url,
- int64_t offset,
- int64_t max_bytes_to_read,
- const base::Time& expected_modification_time) override {
- return file_system_context_->CreateFileStreamReader(
- storage::FileSystemURL(
- file_system_context_->CrackURL(
- filesystem_url)),
- offset, max_bytes_to_read,
- expected_modification_time)
- .Pass();
- }
-
- private:
- scoped_refptr<FileSystemContext> file_system_context_;
- DISALLOW_COPY_AND_ASSIGN(FileStreamReaderProviderImpl);
-};
-
-} // namespace
-
BlobDataHandle::BlobDataHandleShared::BlobDataHandleShared(
const std::string& uuid,
- const std::string& content_type,
- const std::string& content_disposition,
- BlobStorageContext* context)
- : uuid_(uuid),
- content_type_(content_type),
- content_disposition_(content_disposition),
- context_(context->AsWeakPtr()) {
+ BlobStorageContext* context,
+ base::SequencedTaskRunner* task_runner)
+ : uuid_(uuid), context_(context->AsWeakPtr()) {
context_->IncrementBlobRefCount(uuid);
-}
-
-scoped_ptr<BlobReader> BlobDataHandle::CreateReader(
- FileSystemContext* file_system_context,
- base::SequencedTaskRunner* file_task_runner) const {
- return scoped_ptr<BlobReader>(new BlobReader(
- this, scoped_ptr<BlobReader::FileStreamReaderProvider>(
- new FileStreamReaderProviderImpl(file_system_context)),
- file_task_runner));
}
scoped_ptr<BlobDataSnapshot>
BlobDataHandle::BlobDataHandleShared::CreateSnapshot() const {
return context_->CreateSnapshot(uuid_).Pass();
+}
+
+const std::string& BlobDataHandle::BlobDataHandleShared::uuid() const {
+ return uuid_;
}
BlobDataHandle::BlobDataHandleShared::~BlobDataHandleShared() {
@@ -91,15 +36,10 @@
}
BlobDataHandle::BlobDataHandle(const std::string& uuid,
- const std::string& content_type,
- const std::string& content_disposition,
BlobStorageContext* context,
- base::SequencedTaskRunner* io_task_runner)
- : io_task_runner_(io_task_runner),
- shared_(new BlobDataHandleShared(uuid,
- content_type,
- content_disposition,
- context)) {
+ base::SequencedTaskRunner* task_runner)
+ : io_task_runner_(task_runner),
+ shared_(new BlobDataHandleShared(uuid, context, task_runner)) {
DCHECK(io_task_runner_.get());
DCHECK(io_task_runner_->RunsTasksOnCurrentThread());
}
@@ -122,15 +62,7 @@
}
const std::string& BlobDataHandle::uuid() const {
- return shared_->uuid_;
-}
-
-const std::string& BlobDataHandle::content_type() const {
- return shared_->content_type_;
-}
-
-const std::string& BlobDataHandle::content_disposition() const {
- return shared_->content_disposition_;
+ return shared_->uuid();
}
} // namespace storage
« no previous file with comments | « storage/browser/blob/blob_data_handle.h ('k') | storage/browser/blob/blob_data_snapshot.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698