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

Unified Diff: components/offline_pages/core/prefetch/add_unique_urls_task.h

Issue 2879013002: Create skeleton for the Prefetching store and initial pipeline step. (Closed)
Patch Set: Made construction params a cost&. Created 3 years, 7 months 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 side-by-side diff with in-line comments
Download patch
Index: components/offline_pages/core/prefetch/add_unique_urls_task.h
diff --git a/components/offline_pages/core/prefetch/add_unique_urls_task.h b/components/offline_pages/core/prefetch/add_unique_urls_task.h
new file mode 100644
index 0000000000000000000000000000000000000000..c7a116131b057ad8ab9cf5f29e44cb57fc333c24
--- /dev/null
+++ b/components/offline_pages/core/prefetch/add_unique_urls_task.h
@@ -0,0 +1,45 @@
+// 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_ADD_UNIQUE_URLS_TASK_H_
+#define COMPONENTS_OFFLINE_PAGES_CORE_PREFETCH_ADD_UNIQUE_URLS_TASK_H_
+
+#include <vector>
+
+#include "base/memory/weak_ptr.h"
+#include "components/offline_pages/core/prefetch/prefetch_store.h"
+#include "components/offline_pages/core/prefetch/prefetch_types.h"
+#include "components/offline_pages/core/task.h"
+#include "url/gurl.h"
+
+namespace offline_pages {
+
+// Task that adds new URL suggestions to the pipeline. URLs are matched against
+// existing ones from any stage of the process so that only new, unique ones are
+// actually added.
+// Fully processed items are kept in the store in the PrefetchItemState::ZOMBIE
+// state until it is confirmed that the client for its namespace is not
+// recommending the same URL anymore to avoid processing it twice. So once the
+// step described above is done, all same namespace items in the ZOMBIE state
+// whose URL didn't match any of the just suggested ones are finally deleted
+// from the store.
+class AddUniqueUrlsTask : public Task {
+ public:
+ AddUniqueUrlsTask(PrefetchStore* store,
+ const std::vector<PrefetchURL>& prefetch_urls);
+ ~AddUniqueUrlsTask() override;
+
+ void Run() override;
+
+ private:
+ PrefetchStore* prefetch_store_;
+ std::vector<PrefetchURL> prefetch_urls_;
+
+ base::WeakPtrFactory<AddUniqueUrlsTask> weak_ptr_factory_;
+ DISALLOW_COPY_AND_ASSIGN(AddUniqueUrlsTask);
+};
+
+} // namespace offline_pages
+
+#endif // COMPONENTS_OFFLINE_PAGES_CORE_PREFETCH_ADD_UNIQUE_URLS_TASK_H_
« no previous file with comments | « components/offline_pages/core/prefetch/BUILD.gn ('k') | components/offline_pages/core/prefetch/add_unique_urls_task.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698