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

Unified Diff: components/precache/core/precache_session_table.h

Issue 1961153003: Add pause/resume functionality to precache (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: test fix Created 4 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/precache/core/precache_session_table.h
diff --git a/components/precache/core/precache_session_table.h b/components/precache/core/precache_session_table.h
new file mode 100644
index 0000000000000000000000000000000000000000..e4be3238107b612c86c52de6a835066c706b21cf
--- /dev/null
+++ b/components/precache/core/precache_session_table.h
@@ -0,0 +1,64 @@
+// Copyright 2016 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_PRECACHE_CORE_PRECACHE_SESSION_TABLE_H_
+#define COMPONENTS_PRECACHE_CORE_PRECACHE_SESSION_TABLE_H_
+
+#include <list>
+#include <map>
+#include <memory>
+
+#include "base/macros.h"
+#include "base/time/time.h"
+#include "url/gurl.h"
+
+namespace base {
+class TimeTicks;
+}
+
+namespace sql {
+class Connection;
+}
+
+namespace precache {
+
+class PrecacheUnfinishedWork;
+
+// Denotes the type of session information being stored.
+enum SessionDataType {
+ // Unfinished work to do sometime later.
+ UNFINISHED_WORK = 0,
+};
+
+class PrecacheSessionTable {
+ public:
+ PrecacheSessionTable();
+ virtual ~PrecacheSessionTable();
+
+ // Initializes the precache task URL table for use with the specified database
+ // connection. The caller keeps ownership of |db|, and |db| must not be null.
+ // Init must be called before any other methods.
+ bool Init(sql::Connection* db);
+
+ // Stores unfinished work.
+ void SaveUnfinishedWork(
+ std::unique_ptr<PrecacheUnfinishedWork> unfinished_work);
+
+ // Retrieves unfinished work.
+ std::unique_ptr<PrecacheUnfinishedWork> GetUnfinishedWork();
+
+ // Removes all unfinished work from the database.
+ void DeleteUnfinishedWork();
+
+ private:
+ bool CreateTableIfNonExistent();
+
+ // Non-owned pointer.
+ sql::Connection* db_;
+
+ DISALLOW_COPY_AND_ASSIGN(PrecacheSessionTable);
+};
+
+} // namespace precache
+#endif // COMPONENTS_PRECACHE_CORE_PRECACHE_SESSION_TABLE_H_
« no previous file with comments | « components/precache/core/precache_fetcher_unittest.cc ('k') | components/precache/core/precache_session_table.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698