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

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

Issue 1846363002: [BlobAsync] Adding better error reporting and some new tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed switch statement 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
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 4778f3914a1d8736403b1e716b5c8a70293dc817..748142e3dfb06035ed80a88386bdce557d1b6e4f 100644
--- a/storage/browser/blob/blob_data_handle.cc
+++ b/storage/browser/blob/blob_data_handle.cc
@@ -72,15 +72,6 @@ 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 {
@@ -90,13 +81,6 @@ scoped_ptr<BlobReader> BlobDataHandle::CreateReader(
file_task_runner));
}
-scoped_ptr<BlobDataSnapshot>
-BlobDataHandle::BlobDataHandleShared::CreateSnapshot() const {
- if (!context_.get())
- return nullptr;
- return context_->CreateSnapshot(uuid_);
-}
-
BlobDataHandle::BlobDataHandleShared::~BlobDataHandleShared() {
if (context_.get())
context_->DecrementBlobRefCount(uuid_);
@@ -145,14 +129,20 @@ bool BlobDataHandle::IsBroken() const {
}
void BlobDataHandle::RunOnConstructionComplete(
- const base::Callback<void(bool)>& done) {
+ const BlobConstructedCallback& done) {
DCHECK(io_task_runner_->RunsTasksOnCurrentThread());
- shared_->RunOnConstructionComplete(done);
+ if (!shared_->context_.get()) {
+ done.Run(false, IPCBlobCreationCancelCode::UNKNOWN);
jsbell 2016/04/04 20:41:19 Add a code for this case?
dmurph 2016/04/04 22:17:42 This is a crazy edge case, where the context is ev
+ return;
+ }
+ shared_->context_->RunOnConstructionComplete(shared_->uuid_, done);
}
scoped_ptr<BlobDataSnapshot> BlobDataHandle::CreateSnapshot() const {
DCHECK(io_task_runner_->RunsTasksOnCurrentThread());
- return shared_->CreateSnapshot();
+ if (!shared_->context_.get())
+ return nullptr;
+ return shared_->context_->CreateSnapshot(shared_->uuid_);
}
const std::string& BlobDataHandle::uuid() const {

Powered by Google App Engine
This is Rietveld 408576698