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
content / browser / background_fetch / storage / cleanup_task.h [blame]
// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CONTENT_BROWSER_BACKGROUND_FETCH_STORAGE_CLEANUP_TASK_H_
#define CONTENT_BROWSER_BACKGROUND_FETCH_STORAGE_CLEANUP_TASK_H_
#include <string>
#include <utility>
#include <vector>
#include "content/browser/background_fetch/storage/database_task.h"
#include "third_party/blink/public/common/service_worker/service_worker_status_code.h"
namespace content {
namespace background_fetch {
// Deletes inactive registrations marked for deletion.
class CleanupTask : public background_fetch::DatabaseTask {
public:
explicit CleanupTask(DatabaseTaskHost* host);
CleanupTask(const CleanupTask&) = delete;
CleanupTask& operator=(const CleanupTask&) = delete;
~CleanupTask() override;
void Start() override;
private:
void DidGetRegistrations(
const std::vector<std::pair<int64_t, std::string>>& registration_data,
blink::ServiceWorkerStatusCode status);
void DidGetActiveUniqueIds(
const std::vector<std::pair<int64_t, std::string>>& registration_data,
const std::vector<std::pair<int64_t, std::string>>& active_unique_id_data,
blink::ServiceWorkerStatusCode status);
void FinishWithError(blink::mojom::BackgroundFetchError error) override;
base::WeakPtrFactory<CleanupTask> weak_factory_{this}; // Keep as last.
};
} // namespace background_fetch
} // namespace content
#endif // CONTENT_BROWSER_BACKGROUND_FETCH_STORAGE_CLEANUP_TASK_H_