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

Side by Side Diff: components/offline_pages/core/background/mark_attempt_aborted_task.cc

Issue 2489443002: Move all components/offline_pages/ files into component/offline_pages/core (Closed)
Patch Set: rebase Created 4 years 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/offline_pages/background/mark_attempt_aborted_task.h" 5 #include "components/offline_pages/core/background/mark_attempt_aborted_task.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 8
9 namespace offline_pages { 9 namespace offline_pages {
10 10
11 MarkAttemptAbortedTask::MarkAttemptAbortedTask( 11 MarkAttemptAbortedTask::MarkAttemptAbortedTask(
12 RequestQueueStore* store, 12 RequestQueueStore* store,
13 int64_t request_id, 13 int64_t request_id,
14 const RequestQueueStore::UpdateCallback& callback) 14 const RequestQueueStore::UpdateCallback& callback)
15 : UpdateRequestTask(store, request_id, callback) {} 15 : UpdateRequestTask(store, request_id, callback) {}
16 16
17 MarkAttemptAbortedTask::~MarkAttemptAbortedTask() {} 17 MarkAttemptAbortedTask::~MarkAttemptAbortedTask() {}
18 18
19 void MarkAttemptAbortedTask::UpdateRequestImpl( 19 void MarkAttemptAbortedTask::UpdateRequestImpl(
20 std::unique_ptr<UpdateRequestsResult> read_result) { 20 std::unique_ptr<UpdateRequestsResult> read_result) {
21 if (!ValidateReadResult(read_result.get())) { 21 if (!ValidateReadResult(read_result.get())) {
22 CompleteWithResult(std::move(read_result)); 22 CompleteWithResult(std::move(read_result));
23 return; 23 return;
24 } 24 }
25 25
26 // It is perfectly fine to reuse the read_result->updated_items collection, as 26 // It is perfectly fine to reuse the read_result->updated_items collection, as
27 // it is owned by this callback and will be destroyed when out of scope. 27 // it is owned by this callback and will be destroyed when out of scope.
28 read_result->updated_items[0].MarkAttemptAborted(); 28 read_result->updated_items[0].MarkAttemptAborted();
29 store()->UpdateRequests( 29 store()->UpdateRequests(
30 read_result->updated_items, 30 read_result->updated_items,
31 base::Bind(&MarkAttemptAbortedTask::CompleteWithResult, GetWeakPtr())); 31 base::Bind(&MarkAttemptAbortedTask::CompleteWithResult, GetWeakPtr()));
32 } 32 }
33 33
34 } // namespace offline_pages 34 } // namespace offline_pages
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698