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(); |