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 <vector> |
| 9 |
| 10 #include "base/memory/weak_ptr.h" |
| 11 #include "components/offline_pages/core/prefetch/prefetch_store.h" |
| 12 #include "components/offline_pages/core/prefetch/prefetch_types.h" |
| 13 #include "components/offline_pages/core/task.h" |
| 14 #include "url/gurl.h" |
| 15 |
| 16 namespace offline_pages { |
| 17 |
| 18 // Task that adds new URL suggestions to the pipeline. URLs are matched against |
| 19 // existing ones from any stage of the process so that only new, unique ones are |
| 20 // actually added. |
| 21 // Fully processed items are kept in the store in the PrefetchItemState::ZOMBIE |
| 22 // state until it is confirmed that the client for its namespace is not |
| 23 // recommending the same URL anymore to avoid processing it twice. So once the |
| 24 // step described above is done, all same namespace items in the ZOMBIE state |
| 25 // whose URL didn't match any of the just suggested ones are finally deleted |
| 26 // from the store. |
| 27 class AddUniqueUrlsTask : public Task { |
| 28 public: |
| 29 AddUniqueUrlsTask(PrefetchStore* store, |
| 30 const std::vector<PrefetchURL>& prefetch_urls); |
| 31 ~AddUniqueUrlsTask() override; |
| 32 |
| 33 void Run() override; |
| 34 |
| 35 private: |
| 36 PrefetchStore* prefetch_store_; |
| 37 std::vector<PrefetchURL> prefetch_urls_; |
| 38 |
| 39 base::WeakPtrFactory<AddUniqueUrlsTask> weak_ptr_factory_; |
| 40 DISALLOW_COPY_AND_ASSIGN(AddUniqueUrlsTask); |
| 41 }; |
| 42 |
| 43 } // namespace offline_pages |
| 44 |
| 45 #endif // COMPONENTS_OFFLINE_PAGES_CORE_PREFETCH_ADD_UNIQUE_URLS_TASK_H_ |
OLD | NEW |