@@ -28,6 +28,7 @@ namespace firebase {
28
28
namespace firestore {
29
29
30
30
using CoreCacheSettings = api::LocalCacheSettings;
31
+ using CoreMemoryGarbageCollectorSettings = api::MemoryGargabeCollectorSettings;
31
32
32
33
class PersistentCacheSettingsInternal ;
33
34
class MemoryCacheSettingsInternal ;
@@ -57,7 +58,6 @@ class PersistentCacheSettings final : public LocalCacheSettings {
57
58
friend class Settings ;
58
59
59
60
PersistentCacheSettings ();
60
- PersistentCacheSettings (const PersistentCacheSettingsInternal& other);
61
61
62
62
api::LocalCacheSettings::Kind kind () const override {
63
63
return api::LocalCacheSettings::Kind::kPersistent ;
@@ -68,57 +68,73 @@ class PersistentCacheSettings final : public LocalCacheSettings {
68
68
std::unique_ptr<PersistentCacheSettingsInternal> settings_internal_;
69
69
};
70
70
71
+ class MemoryGarbageCollectorSettings ;
72
+
73
+ class MemoryCacheSettings final : public LocalCacheSettings {
74
+ public:
75
+ static MemoryCacheSettings Create ();
76
+ MemoryCacheSettings (const MemoryCacheSettings& other);
77
+ ~MemoryCacheSettings ();
78
+
79
+ MemoryCacheSettings WithGarbageCollectorSettings (
80
+ const MemoryGarbageCollectorSettings& settings) const ;
81
+
82
+ private:
83
+ friend class Settings ;
84
+
85
+ MemoryCacheSettings ();
86
+
87
+ api::LocalCacheSettings::Kind kind () const override {
88
+ return api::LocalCacheSettings::Kind::kMemory ;
89
+ }
90
+
91
+ const CoreCacheSettings& core_cache_settings () const override ;
92
+
93
+ std::unique_ptr<MemoryCacheSettingsInternal> settings_internal_;
94
+ };
95
+
71
96
class MemoryGarbageCollectorSettings {
72
97
public:
73
98
virtual ~MemoryGarbageCollectorSettings () = default ;
74
99
75
100
private:
101
+ friend class MemoryCacheSettings ;
102
+ virtual const CoreMemoryGarbageCollectorSettings& core_gc_settings ()
103
+ const = 0;
76
104
};
77
105
78
- class MemoryEagerGCSettings final : MemoryGarbageCollectorSettings {
106
+ class MemoryEagerGCSettings final : public MemoryGarbageCollectorSettings {
107
+ public:
79
108
static MemoryEagerGCSettings Create ();
80
109
~MemoryEagerGCSettings ();
81
110
82
111
private:
112
+ friend class MemoryCacheSettings ;
83
113
MemoryEagerGCSettings ();
84
114
115
+ const CoreMemoryGarbageCollectorSettings& core_gc_settings () const override {
116
+ return settings_internal_->core_settings ();
117
+ }
118
+
85
119
std::unique_ptr<MemoryEagerGCSettingsInternal> settings_internal_;
86
120
};
87
121
88
- class MemoryLruGCSettings final : MemoryGarbageCollectorSettings {
122
+ class MemoryLruGCSettings final : public MemoryGarbageCollectorSettings {
123
+ public:
89
124
static MemoryLruGCSettings Create ();
90
125
~MemoryLruGCSettings ();
91
126
MemoryLruGCSettings WithSizeBytes (int64_t size);
92
127
93
128
private:
129
+ friend class MemoryCacheSettings ;
94
130
MemoryLruGCSettings ();
95
131
MemoryLruGCSettings (const MemoryLruGCSettingsInternal& other);
96
132
97
- std::unique_ptr<MemoryLruGCSettingsInternal> settings_internal_;
98
- };
99
-
100
- class MemoryCacheSettings final : public LocalCacheSettings {
101
- public:
102
- static MemoryCacheSettings Create ();
103
- MemoryCacheSettings (const MemoryCacheSettings& other);
104
- ~MemoryCacheSettings ();
105
-
106
- MemoryCacheSettings WithGarbageCollectorSettings (
107
- const MemoryGarbageCollectorSettings& settings);
108
-
109
- private:
110
- friend class Settings ;
111
-
112
- MemoryCacheSettings ();
113
- MemoryCacheSettings (const MemoryCacheSettingsInternal& other);
114
-
115
- api::LocalCacheSettings::Kind kind () const override {
116
- return api::LocalCacheSettings::Kind::kMemory ;
133
+ const CoreMemoryGarbageCollectorSettings& core_gc_settings () const override {
134
+ return settings_internal_->core_settings ();
117
135
}
118
136
119
- const CoreCacheSettings& core_cache_settings () const override ;
120
-
121
- std::unique_ptr<MemoryCacheSettingsInternal> settings_internal_;
137
+ std::unique_ptr<MemoryLruGCSettingsInternal> settings_internal_;
122
138
};
123
139
124
140
} // namespace firestore
0 commit comments