| Index: components/offline_pages/background/mark_attempt_aborted_task.cc
|
| diff --git a/components/offline_pages/background/mark_attempt_aborted_task.cc b/components/offline_pages/background/mark_attempt_aborted_task.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..150baac40628b01df2c4a3a64f68e6668c1b07fd
|
| --- /dev/null
|
| +++ b/components/offline_pages/background/mark_attempt_aborted_task.cc
|
| @@ -0,0 +1,34 @@
|
| +// Copyright 2016 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "components/offline_pages/background/mark_attempt_aborted_task.h"
|
| +
|
| +#include "base/bind.h"
|
| +
|
| +namespace offline_pages {
|
| +
|
| +MarkAttemptAbortedTask::MarkAttemptAbortedTask(
|
| + RequestQueueStore* store,
|
| + int64_t request_id,
|
| + const RequestQueueStore::UpdateCallback& callback)
|
| + : UpdateRequestTask(store, request_id, callback) {}
|
| +
|
| +MarkAttemptAbortedTask::~MarkAttemptAbortedTask() {}
|
| +
|
| +void MarkAttemptAbortedTask::UpdateRequestImpl(
|
| + std::unique_ptr<UpdateRequestsResult> read_result) {
|
| + if (!ValidateReadResult(read_result.get())) {
|
| + CompleteWithResult(std::move(read_result));
|
| + return;
|
| + }
|
| +
|
| + // It is perfectly fine to reuse the read_result->updated_items collection, as
|
| + // it is owned by this callback and will be destroyed when out of scope.
|
| + read_result->updated_items[0].MarkAttemptAborted();
|
| + store()->UpdateRequests(
|
| + read_result->updated_items,
|
| + base::Bind(&MarkAttemptAbortedTask::CompleteWithResult, GetWeakPtr()));
|
| +}
|
| +
|
| +} // namespace offline_pages
|
|
|