Index: chrome/browser/chromeos/file_system_provider/queue.cc |
diff --git a/chrome/browser/chromeos/file_system_provider/queue.cc b/chrome/browser/chromeos/file_system_provider/queue.cc |
index 883917f519b561a4b7e989d93e2ddef191ec8d2f..9e4573635d7c6be793cdd7034ac655829e9b3e47 100644 |
--- a/chrome/browser/chromeos/file_system_provider/queue.cc |
+++ b/chrome/browser/chromeos/file_system_provider/queue.cc |
@@ -36,7 +36,7 @@ size_t Queue::NewToken() { |
return next_token_++; |
} |
-AbortCallback Queue::Enqueue(size_t token, const AbortableCallback& callback) { |
+void Queue::Enqueue(size_t token, const AbortableCallback& callback) { |
#if !NDEBUG |
const auto it = executed_.find(token); |
DCHECK(it == executed_.end()); |
@@ -47,7 +47,6 @@ AbortCallback Queue::Enqueue(size_t token, const AbortableCallback& callback) { |
pending_.push_back(Task(token, callback)); |
base::ThreadTaskRunnerHandle::Get()->PostTask( |
FROM_HERE, base::Bind(&Queue::MaybeRun, weak_ptr_factory_.GetWeakPtr())); |
- return base::Bind(&Queue::Abort, weak_ptr_factory_.GetWeakPtr(), token); |
} |
void Queue::Complete(size_t token) { |
@@ -78,19 +77,15 @@ void Queue::MaybeRun() { |
executed_[task.token].abort_callback = task.callback.Run(); |
} |
-void Queue::Abort(size_t token, |
- const storage::AsyncFileUtil::StatusCallback& callback) { |
+void Queue::Abort(size_t token) { |
// Check if it's running. |
const auto it = executed_.find(token); |
if (it != executed_.end()) { |
const Task& task = it->second; |
// If the task is marked as completed, then it's impossible to abort it. |
- if (task.completed) { |
- callback.Run(base::File::FILE_ERROR_INVALID_OPERATION); |
- return; |
- } |
+ DCHECK(!task.completed); |
DCHECK(!task.abort_callback.is_null()); |
- it->second.abort_callback.Run(callback); |
+ it->second.abort_callback.Run(); |
executed_.erase(it); |
hirono
2015/01/14 05:36:06
Aborted task should not be removed from the queue.
mtomasz
2015/01/14 08:55:10
Good catch. Fixed + upgraded tests. Done.
|
base::ThreadTaskRunnerHandle::Get()->PostTask( |
FROM_HERE, |
@@ -102,7 +97,6 @@ void Queue::Abort(size_t token, |
for (auto it = pending_.begin(); it != pending_.end(); ++it) { |
if (token == it->token) { |
pending_.erase(it); |
hirono
2015/01/14 05:36:06
ditto
mtomasz
2015/01/14 08:55:09
Done.
|
- callback.Run(base::File::FILE_OK); |
base::ThreadTaskRunnerHandle::Get()->PostTask( |
FROM_HERE, |
base::Bind(&Queue::MaybeRun, weak_ptr_factory_.GetWeakPtr())); |
@@ -111,7 +105,7 @@ void Queue::Abort(size_t token, |
} |
// The task is already removed. |
- callback.Run(base::File::FILE_ERROR_INVALID_OPERATION); |
+ NOTREACHED(); |
} |
} // namespace file_system_provider |