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

Side by Side Diff: components/precache/core/precache_session_table.h

Issue 2123813002: Report Precache.TimeSinceLastPrecache (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: gclient sync Created 4 years, 5 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
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef COMPONENTS_PRECACHE_CORE_PRECACHE_SESSION_TABLE_H_ 5 #ifndef COMPONENTS_PRECACHE_CORE_PRECACHE_SESSION_TABLE_H_
6 #define COMPONENTS_PRECACHE_CORE_PRECACHE_SESSION_TABLE_H_ 6 #define COMPONENTS_PRECACHE_CORE_PRECACHE_SESSION_TABLE_H_
7 7
8 #include <list> 8 #include <list>
9 #include <map> 9 #include <map>
10 #include <memory> 10 #include <memory>
(...skipping 11 matching lines...) Expand all
22 } 22 }
23 23
24 namespace precache { 24 namespace precache {
25 25
26 class PrecacheUnfinishedWork; 26 class PrecacheUnfinishedWork;
27 27
28 // Denotes the type of session information being stored. 28 // Denotes the type of session information being stored.
29 enum SessionDataType { 29 enum SessionDataType {
30 // Unfinished work to do sometime later. 30 // Unfinished work to do sometime later.
31 UNFINISHED_WORK = 0, 31 UNFINISHED_WORK = 0,
32 // Timestamp of the last precache.
33 LAST_PRECACHE_TIMESTAMP = 1,
32 }; 34 };
33 35
34 class PrecacheSessionTable { 36 class PrecacheSessionTable {
35 public: 37 public:
36 PrecacheSessionTable(); 38 PrecacheSessionTable();
37 virtual ~PrecacheSessionTable(); 39 virtual ~PrecacheSessionTable();
38 40
39 // Initializes the precache task URL table for use with the specified database 41 // 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. 42 // connection. The caller keeps ownership of |db|, and |db| must not be null.
41 // Init must be called before any other methods. 43 // Init must be called before any other methods.
42 bool Init(sql::Connection* db); 44 bool Init(sql::Connection* db);
43 45
46 // -- Time since last precache --
47
48 void SetLastPrecacheTimestamp(const base::Time& time);
49
50 // If none present, it will return base::Time(), so it can be checked via
51 // is_null().
52 base::Time GetLastPrecacheTimestamp();
53
54 void DeleteLastPrecacheTimestamp();
55
56 // -- Unfinished work --
57
44 // Stores unfinished work. 58 // Stores unfinished work.
45 void SaveUnfinishedWork( 59 void SaveUnfinishedWork(
46 std::unique_ptr<PrecacheUnfinishedWork> unfinished_work); 60 std::unique_ptr<PrecacheUnfinishedWork> unfinished_work);
47 61
48 // Retrieves unfinished work. 62 // Retrieves unfinished work.
49 std::unique_ptr<PrecacheUnfinishedWork> GetUnfinishedWork(); 63 std::unique_ptr<PrecacheUnfinishedWork> GetUnfinishedWork();
50 64
51 // Removes all unfinished work from the database. 65 // Removes all unfinished work from the database.
52 void DeleteUnfinishedWork(); 66 void DeleteUnfinishedWork();
53 67
54 private: 68 private:
55 bool CreateTableIfNonExistent(); 69 bool CreateTableIfNonExistent();
56 70
57 // Non-owned pointer. 71 // Non-owned pointer.
58 sql::Connection* db_; 72 sql::Connection* db_;
59 73
60 DISALLOW_COPY_AND_ASSIGN(PrecacheSessionTable); 74 DISALLOW_COPY_AND_ASSIGN(PrecacheSessionTable);
61 }; 75 };
62 76
63 } // namespace precache 77 } // namespace precache
64 #endif // COMPONENTS_PRECACHE_CORE_PRECACHE_SESSION_TABLE_H_ 78 #endif // COMPONENTS_PRECACHE_CORE_PRECACHE_SESSION_TABLE_H_
OLDNEW
« no previous file with comments | « components/precache/core/precache_database_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