OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef COMPONENTS_OFFLINE_PAGES_CORE_PREFETCH_ADD_UNIQUE_URLS_TASK_H_ | |
6 #define COMPONENTS_OFFLINE_PAGES_CORE_PREFETCH_ADD_UNIQUE_URLS_TASK_H_ | |
7 | |
8 #include <string> | |
9 #include <vector> | |
10 | |
11 #include "base/memory/weak_ptr.h" | |
12 #include "components/offline_pages/core/prefetch/prefetch_store.h" | |
13 #include "components/offline_pages/core/prefetch/prefetch_types.h" | |
14 #include "components/offline_pages/core/task.h" | |
15 #include "url/gurl.h" | |
16 | |
17 namespace offline_pages { | |
18 | |
19 // Task that adds new URL suggestions to the pipeline. URLs are matched against | |
20 // existing ones from any stage of the process so that only new, unique ones are | |
21 // actually added. | |
22 // Fully processed items are kept in the store in the PrefetchItemState::ZOMBIE | |
23 // state until it is confirmed that the client for its namespace is not | |
24 // recommending the same URL anymore to avoid processing it twice. So once the | |
25 // step described above is done, all same namespace items in the ZOMBIE state | |
fgorski
2017/05/30 17:21:45
Zombie clean up could be a separate task that is s
carlosk
2017/06/01 01:49:59
With the current design of using zombies as a dupl
| |
26 // whose URL didn't match any of the just suggested ones are finally deleted | |
27 // from the store. | |
28 class AddUniqueUrlsTask : public Task { | |
29 public: | |
30 AddUniqueUrlsTask(PrefetchStore* store, | |
31 const std::string& name_space, | |
32 const std::vector<PrefetchURL>& prefetch_urls); | |
33 ~AddUniqueUrlsTask() override; | |
34 | |
35 void Run() override; | |
36 | |
37 private: | |
38 PrefetchStore* store_; | |
Dmitry Titov
2017/05/26 23:05:06
Naming: I think it should be prefetch_store_.
carlosk
2017/06/01 01:49:59
Done.
| |
39 std::string name_space_; | |
40 std::vector<PrefetchURL> prefetch_urls_; | |
41 | |
42 base::WeakPtrFactory<AddUniqueUrlsTask> weak_ptr_factory_; | |
43 DISALLOW_COPY_AND_ASSIGN(AddUniqueUrlsTask); | |
44 }; | |
45 | |
46 } // namespace offline_pages | |
47 | |
48 #endif // COMPONENTS_OFFLINE_PAGES_CORE_PREFETCH_ADD_UNIQUE_URLS_TASK_H_ | |
OLD | NEW |