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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 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_PRECACHE_CORE_PRECACHE_SESSION_TABLE_H_
6 #define COMPONENTS_PRECACHE_CORE_PRECACHE_SESSION_TABLE_H_
7
8 #include <list>
9 #include <map>
10 #include <memory>
11
12 #include "base/macros.h"
13 #include "base/time/time.h"
14 #include "url/gurl.h"
15
16 namespace base {
17 class TimeTicks;
18 }
19
20 namespace sql {
21 class Connection;
22 }
23
24 namespace precache {
25
26 class PrecacheUnfinishedWork;
27
28 // Denotes the type of session information being stored.
29 enum SessionDataType {
30 // Unfinished work to do sometime later.
31 UNFINISHED_WORK = 0,
32 };
33
34 class PrecacheSessionTable {
35 public:
36 PrecacheSessionTable();
37 virtual ~PrecacheSessionTable();
38
39 // Initializes the precache task URL table for use with the specified database
40 // connection. The caller keeps ownership of |db|, and |db| must not be null.
41 // Init must be called before any other methods.
42 bool Init(sql::Connection* db);
43
44 // Stores unfinished work.
45 void SaveUnfinishedWork(
46 std::unique_ptr<PrecacheUnfinishedWork> unfinished_work);
47
48 // Retrieves unfinished work.
49 std::unique_ptr<PrecacheUnfinishedWork> GetUnfinishedWork();
50
51 // Removes all unfinished work from the database.
52 void DeleteUnfinishedWork();
53
54 private:
55 bool CreateTableIfNonExistent();
56
57 // Non-owned pointer.
58 sql::Connection* db_;
59
60 DISALLOW_COPY_AND_ASSIGN(PrecacheSessionTable);
61 };
62
63 } // namespace precache
64 #endif // COMPONENTS_PRECACHE_CORE_PRECACHE_SESSION_TABLE_H_
OLDNEW
« 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