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

Unified Diff: components/offline_pages/offline_page_storage_manager.h

Issue 1965633002: [Offline Pages] Introducing StorageManagerClient interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebasing after extracting callbacks. 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/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 73901de71c233cc7990dbcdea6178727e06f2d89..3615583871c77a476d6ad1ee3e7e14c7a401b688 100644
--- a/components/offline_pages/offline_page_storage_manager.h
+++ b/components/offline_pages/offline_page_storage_manager.h
@@ -12,17 +12,11 @@
#include "base/callback.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
-#include "components/offline_pages/offline_page_model.h"
+#include "components/offline_pages/offline_page_types.h"
+#include "components/offline_pages/storage_manager_client.h"
namespace offline_pages {
-// TODO(romax): Keep this as a default value until I find a way to get
-// storage size in C++. (20MB)
-static const int64_t kDefaultStorageSize = 20 * (1 << 20);
-
-class ClientPolicyController;
-struct OfflinePageItem;
-
// This class is used for storage management of offline pages. It provides
// a ClearPagesIfNeeded method which is used to clear expired offline pages
// based on last_access_time and lifetime policy of its namespace.
@@ -36,10 +30,9 @@ class OfflinePageStorageManager {
// Callback used when calling ClearPagesIfNeeded.
// int: the number of deleted pages.
// DeletePageResult: result of deleting pages.
- typedef base::Callback<void(int, OfflinePageModel::DeletePageResult)>
- ClearPageCallback;
+ typedef base::Callback<void(int, DeletePageResult)> ClearPageCallback;
- explicit OfflinePageStorageManager(OfflinePageModel* model);
+ explicit OfflinePageStorageManager(StorageManagerClient* client);
~OfflinePageStorageManager();
@@ -48,21 +41,19 @@ class OfflinePageStorageManager {
void ClearPagesIfNeeded(const ClearPageCallback& callback);
private:
- // Selects and removes pages that need to be expired. Triggered as a callback
+ // Selects and removed pages that need to be expired. Triggered as a callback
fgorski 2016/05/11 22:39:00 why this change?
romax 2016/05/11 23:54:58 might be random edits. I think i should prevent th
// to |GetAllPages|.
- void ClearExpiredPages(
- const ClearPageCallback& callback,
- const OfflinePageModel::MultipleOfflinePageItemResult& pages);
+ void ClearExpiredPages(const ClearPageCallback& callback,
+ const MultipleOfflinePageItemResult& pages);
- // Gets offline IDs of all expired pages and return in |offline_ids|.
- void GetExpiredPageIds(
- const OfflinePageModel::MultipleOfflinePageItemResult& pages,
- std::vector<int64_t>& offline_ids);
+ // Get offline IDs of all expired pages and return in |offline_ids|.
fgorski 2016/05/11 22:39:00 why this change? the full sentence would be: this
romax 2016/05/11 23:54:58 same as above..
+ void GetExpiredPageIds(const MultipleOfflinePageItemResult& pages,
+ std::vector<int64_t>& offline_ids);
// Callback when expired pages has been deleted.
void OnExpiredPagesDeleted(const ClearPageCallback& callback,
int pages_to_clear,
- OfflinePageModel::DeletePageResult result);
+ DeletePageResult result);
// Determine if manager should clear pages.
bool ShouldClearPages();
@@ -71,7 +62,7 @@ class OfflinePageStorageManager {
bool IsPageExpired(const OfflinePageItem& page);
// Not owned.
- OfflinePageModel* model_;
+ StorageManagerClient* client_;
// Not owned.
ClientPolicyController* policy_controller_;

Powered by Google App Engine
This is Rietveld 408576698