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

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

Issue 1234813004: [BlobAsync] Asynchronous Blob Construction Final Patch (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@blob-protocol-change
Patch Set: comments and rebase Created 4 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
« 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 7c5d83d19d77ba571af7fd3ae7b66a8a3a41949a..4778f3914a1d8736403b1e716b5c8a70293dc817 100644
--- a/storage/browser/blob/blob_data_handle.cc
+++ b/storage/browser/blob/blob_data_handle.cc
@@ -7,6 +7,7 @@
#include <stdint.h>
#include "base/bind.h"
+#include "base/callback.h"
#include "base/location.h"
#include "base/logging.h"
#include "base/macros.h"
@@ -22,13 +23,14 @@
#include "url/gurl.h"
namespace storage {
+using BlobState = BlobStorageRegistry::BlobState;
namespace {
class FileStreamReaderProviderImpl
: public BlobReader::FileStreamReaderProvider {
public:
- FileStreamReaderProviderImpl(FileSystemContext* file_system_context)
+ explicit FileStreamReaderProviderImpl(FileSystemContext* file_system_context)
: file_system_context_(file_system_context) {}
~FileStreamReaderProviderImpl() override {}
@@ -70,6 +72,15 @@ BlobDataHandle::BlobDataHandleShared::BlobDataHandleShared(
context_->IncrementBlobRefCount(uuid);
}
+void BlobDataHandle::BlobDataHandleShared::RunOnConstructionComplete(
+ const base::Callback<void(bool)>& done) {
+ if (!context_.get()) {
+ done.Run(false);
+ return;
+ }
+ context_->RunOnConstructionComplete(uuid_, done);
+}
+
scoped_ptr<BlobReader> BlobDataHandle::CreateReader(
FileSystemContext* file_system_context,
base::SequencedTaskRunner* file_task_runner) const {
@@ -81,6 +92,8 @@ scoped_ptr<BlobReader> BlobDataHandle::CreateReader(
scoped_ptr<BlobDataSnapshot>
BlobDataHandle::BlobDataHandleShared::CreateSnapshot() const {
+ if (!context_.get())
+ return nullptr;
return context_->CreateSnapshot(uuid_);
}
@@ -117,6 +130,26 @@ BlobDataHandle::~BlobDataHandle() {
}
}
+bool BlobDataHandle::IsBeingBuilt() const {
+ DCHECK(io_task_runner_->RunsTasksOnCurrentThread());
+ if (!shared_->context_)
+ return false;
+ return shared_->context_->IsBeingBuilt(shared_->uuid_);
+}
+
+bool BlobDataHandle::IsBroken() const {
+ DCHECK(io_task_runner_->RunsTasksOnCurrentThread());
+ if (!shared_->context_)
+ return true;
+ return shared_->context_->IsBroken(shared_->uuid_);
+}
+
+void BlobDataHandle::RunOnConstructionComplete(
+ const base::Callback<void(bool)>& done) {
+ DCHECK(io_task_runner_->RunsTasksOnCurrentThread());
+ shared_->RunOnConstructionComplete(done);
+}
+
scoped_ptr<BlobDataSnapshot> BlobDataHandle::CreateSnapshot() const {
DCHECK(io_task_runner_->RunsTasksOnCurrentThread());
return shared_->CreateSnapshot();
« 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