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

Unified Diff: components/offline_pages/offline_page_storage_manager.h

Issue 1970953002: [Offline Pages] Adding more expiration logic. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@interface
Patch Set: Comments from Filip. 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
« no previous file with comments | « no previous file | components/offline_pages/offline_page_storage_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/offline_pages/offline_page_storage_manager.h
diff --git a/components/offline_pages/offline_page_storage_manager.h b/components/offline_pages/offline_page_storage_manager.h
index cf1dc7f6c9f4fb679194b374f91773d34302a0db..0a2cb660362e1d551c634f90637a8076d4b7c8d3 100644
--- a/components/offline_pages/offline_page_storage_manager.h
+++ b/components/offline_pages/offline_page_storage_manager.h
@@ -14,6 +14,10 @@
#include "base/memory/weak_ptr.h"
#include "components/offline_pages/offline_page_types.h"
+namespace base {
+class Clock;
+}
+
namespace offline_pages {
class ClientPolicyController;
@@ -57,6 +61,8 @@ class OfflinePageStorageManager {
void ClearPagesIfNeeded(const ClearPageCallback& callback);
private:
+ friend class OfflinePageStorageManagerTest;
+
// Selects and removes pages that need to be expired. Triggered as a callback
// to |GetAllPages|.
void ClearExpiredPages(const ClearPageCallback& callback,
@@ -74,8 +80,11 @@ class OfflinePageStorageManager {
// Determine if manager should clear pages.
bool ShouldClearPages();
- // Return true if |page| is expired.
- bool IsPageExpired(const OfflinePageItem& page);
+ // Return true if |page| is expired comparing to |now|.
+ bool ShouldBeExpired(const base::Time& now, const OfflinePageItem& page);
+
+ // Sets the clock for testing.
+ void SetClockForTesting(std::unique_ptr<base::Clock> clock);
fgorski 2016/05/12 22:34:25 make this public and don't friend the test class.
romax 2016/05/12 23:31:20 Done.
// Not owned.
Client* client_;
@@ -85,6 +94,9 @@ class OfflinePageStorageManager {
bool in_progress_;
+ // Clock for getting time.
+ std::unique_ptr<base::Clock> clock_;
+
base::WeakPtrFactory<OfflinePageStorageManager> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(OfflinePageStorageManager);
« no previous file with comments | « no previous file | components/offline_pages/offline_page_storage_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698