Commit 56b45a93 authored by mtomasz's avatar mtomasz Committed by Commit bot

Change DCHECKs to CHECKs to investigate a crash when aborting in Files app.

This crash happens often, but I'm unable to reproduce it, so can't find the
root cause.

The suspects are corruption of memory which are protected with DCHECKs.

TEST=Not related.
BUG=454310

Review URL: https://codereview.chromium.org/957983002

Cr-Commit-Position: refs/heads/master@{#318217}
parent 9e0fa77f
...@@ -26,7 +26,7 @@ Queue::Queue(size_t max_in_parallel) ...@@ -26,7 +26,7 @@ Queue::Queue(size_t max_in_parallel)
: max_in_parallel_(max_in_parallel), : max_in_parallel_(max_in_parallel),
next_token_(1), next_token_(1),
weak_ptr_factory_(this) { weak_ptr_factory_(this) {
DCHECK_LT(0u, max_in_parallel); CHECK_LT(0u, max_in_parallel);
} }
Queue::~Queue() { Queue::~Queue() {
...@@ -38,9 +38,9 @@ size_t Queue::NewToken() { ...@@ -38,9 +38,9 @@ size_t Queue::NewToken() {
void Queue::Enqueue(size_t token, const AbortableCallback& callback) { void Queue::Enqueue(size_t token, const AbortableCallback& callback) {
#if !NDEBUG #if !NDEBUG
DCHECK(executed_.find(token) == executed_.end()); CHECK(executed_.find(token) == executed_.end());
for (auto& task : pending_) { for (auto& task : pending_) {
DCHECK(token != task.token); CHECK(token != task.token);
} }
#endif #endif
pending_.push_back(Task(token, callback)); pending_.push_back(Task(token, callback));
...@@ -50,7 +50,7 @@ void Queue::Enqueue(size_t token, const AbortableCallback& callback) { ...@@ -50,7 +50,7 @@ void Queue::Enqueue(size_t token, const AbortableCallback& callback) {
void Queue::Complete(size_t token) { void Queue::Complete(size_t token) {
const auto it = executed_.find(token); const auto it = executed_.find(token);
DCHECK(it != executed_.end()); CHECK(it != executed_.end());
completed_[token] = it->second; completed_[token] = it->second;
executed_.erase(it); executed_.erase(it);
} }
...@@ -67,7 +67,7 @@ void Queue::Remove(size_t token) { ...@@ -67,7 +67,7 @@ void Queue::Remove(size_t token) {
// If not completed, then it must have been aborted. // If not completed, then it must have been aborted.
const auto aborted_it = aborted_.find(token); const auto aborted_it = aborted_.find(token);
DCHECK(aborted_it != aborted_.end()); CHECK(aborted_it != aborted_.end());
aborted_.erase(aborted_it); aborted_.erase(aborted_it);
base::ThreadTaskRunnerHandle::Get()->PostTask( base::ThreadTaskRunnerHandle::Get()->PostTask(
...@@ -80,7 +80,7 @@ void Queue::MaybeRun() { ...@@ -80,7 +80,7 @@ void Queue::MaybeRun() {
return; return;
} }
DCHECK_GT(max_in_parallel_, executed_.size() + completed_.size()); CHECK_GT(max_in_parallel_, executed_.size() + completed_.size());
Task task = pending_.front(); Task task = pending_.front();
pending_.pop_front(); pending_.pop_front();
...@@ -101,7 +101,7 @@ void Queue::Abort(size_t token) { ...@@ -101,7 +101,7 @@ void Queue::Abort(size_t token) {
Task task = it->second; Task task = it->second;
aborted_[token] = task; aborted_[token] = task;
executed_.erase(it); executed_.erase(it);
DCHECK(!task.abort_callback.is_null()); CHECK(!task.abort_callback.is_null());
task.abort_callback.Run(); task.abort_callback.Run();
base::ThreadTaskRunnerHandle::Get()->PostTask( base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE, FROM_HERE,
......
...@@ -216,7 +216,7 @@ void ThrottledFileSystem::OnCloseFileCompleted( ...@@ -216,7 +216,7 @@ void ThrottledFileSystem::OnCloseFileCompleted(
// closed on the C++ side. Release the task from the queue, so other files // closed on the C++ side. Release the task from the queue, so other files
// which are enqueued can be opened. // which are enqueued can be opened.
const auto it = opened_files_.find(file_handle); const auto it = opened_files_.find(file_handle);
DCHECK(it != opened_files_.end()); CHECK(it != opened_files_.end());
const int queue_token = it->second; const int queue_token = it->second;
open_queue_->Remove(queue_token); open_queue_->Remove(queue_token);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment