blob: 58e554769bc1c1af2450e798dccdc87a9d774ec3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
// Copyright 2017 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.
#ifndef COMPONENTS_OFFLINE_PAGES_CORE_PREFETCH_TASKS_GET_OPERATION_TASK_H_
#define COMPONENTS_OFFLINE_PAGES_CORE_PREFETCH_TASKS_GET_OPERATION_TASK_H_
#include <memory>
#include <string>
#include <vector>
#include "base/memory/weak_ptr.h"
#include "components/offline_pages/core/prefetch/prefetch_types.h"
#include "components/offline_pages/task/task.h"
namespace offline_pages {
class PrefetchNetworkRequestFactory;
class PrefetchStore;
// Task that attempts to fetch results for a completed operation. Searches the
// URLs table for operations with rows in the appropriate state and fires off
// concurrent GetOperation requests.
class GetOperationTask : public Task {
public:
using OperationResultList = std::unique_ptr<std::vector<std::string>>;
GetOperationTask(PrefetchStore* store,
PrefetchNetworkRequestFactory* request_factory,
PrefetchRequestFinishedCallback callback);
~GetOperationTask() override;
// Task implementation.
void Run() override;
private:
void StartGetOperationRequests(OperationResultList list);
PrefetchStore* prefetch_store_;
PrefetchNetworkRequestFactory* request_factory_;
PrefetchRequestFinishedCallback callback_;
base::WeakPtrFactory<GetOperationTask> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(GetOperationTask);
};
} // namespace offline_pages
#endif // COMPONENTS_OFFLINE_PAGES_CORE_PREFETCH_TASKS_GET_OPERATION_TASK_H_
|