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

Unified Diff: components/offline_pages/core/archive_manager.h

Issue 2889663004: [DO NOT COMMIT][Offline Pages] Moving Offline Page Cache to cache directory.
Patch Set: again? Created 3 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/core/archive_manager.h
diff --git a/components/offline_pages/core/archive_manager.h b/components/offline_pages/core/archive_manager.h
index dc92e7de79b415b282573ff7ba10a0471314d012..ea25ffee7dc8bf476face8a04ec49825f4896929 100644
--- a/components/offline_pages/core/archive_manager.h
+++ b/components/offline_pages/core/archive_manager.h
@@ -5,12 +5,14 @@
#ifndef COMPONENTS_OFFLINE_PAGES_CORE_ARCHIVE_MANAGER_H_
#define COMPONENTS_OFFLINE_PAGES_CORE_ARCHIVE_MANAGER_H_
+#include <map>
#include <set>
#include <vector>
#include "base/callback_forward.h"
#include "base/files/file_path.h"
#include "base/memory/ref_counted.h"
+#include "components/offline_pages/core/offline_page_client_policy.h"
namespace base {
class SequencedTaskRunner;
@@ -18,8 +20,11 @@ class SequencedTaskRunner;
namespace offline_pages {
-// Class that manages all archive files for offline pages. They are all stored
-// in a specific archive directory.
+typedef std::map<LifetimePolicy::LifetimeType, base::FilePath>
+ ArchiveDirectories;
+
+// Class that manages all archive files for offline pages. They are stored in
+// different archive directories separated by their lifetime types.
// All tasks are performed using |task_runner_|.
class ArchiveManager {
public:
@@ -28,7 +33,7 @@ class ArchiveManager {
int64_t total_archives_size;
};
- ArchiveManager(const base::FilePath& archives_dir,
+ ArchiveManager(const ArchiveDirectories& archive_dirs,
const scoped_refptr<base::SequencedTaskRunner>& task_runner);
virtual ~ArchiveManager();
@@ -52,14 +57,15 @@ class ArchiveManager {
const std::vector<base::FilePath>& archive_paths,
const base::Callback<void(bool)>& callback);
- // Lists all archive files in the archive directory.
+ // Lists all archive files in all the archive directories.
virtual void GetAllArchives(
const base::Callback<void(const std::set<base::FilePath>&)>& callback)
const;
// Gets stats about archive storage, i.e. total archive sizes and free disk
- // space.
+ // space for all clients with specified lifetime types.
virtual void GetStorageStats(
+ const std::set<LifetimePolicy::LifetimeType>& lifetime_types,
const base::Callback<void(const StorageStats& storage_sizes)>& callback)
const;
@@ -67,8 +73,8 @@ class ArchiveManager {
ArchiveManager();
private:
- // Path under which all of the managed archives should be stored.
- base::FilePath archives_dir_;
+ // A map of archive directories by lifetime type of archives.
+ ArchiveDirectories archive_dirs_;
// Task runner for running file operations.
scoped_refptr<base::SequencedTaskRunner> task_runner_;
};

Powered by Google App Engine
This is Rietveld 408576698