[core] Rename "onLowMemory" to "reduceMemoryUse".

Android still calls "reduceMemoryUse" only while handling a low memory event.
iOS, on the other hand, calls "reduceMemoryUse" every time it enters the background.
This commit is contained in:
Chris Loer
2018-02-14 10:11:45 -08:00
committed by Chris Loer
parent f721779963
commit a11b277bc1
25 changed files with 36 additions and 36 deletions

View File

@@ -48,7 +48,7 @@ public:
void dumpDebugLogs();
// Memory
void onLowMemory();
void reduceMemoryUse();
private:
class Impl;

View File

@@ -77,8 +77,8 @@ void AndroidRendererFrontend::update(std::shared_ptr<UpdateParameters> params) {
mapRenderer.requestRender();
}
void AndroidRendererFrontend::onLowMemory() {
mapRenderer.actor().invoke(&Renderer::onLowMemory);
void AndroidRendererFrontend::reduceMemoryUse() {
mapRenderer.actor().invoke(&Renderer::reduceMemoryUse);
}
std::vector<Feature> AndroidRendererFrontend::querySourceFeatures(const std::string& sourceID,

View File

@@ -39,7 +39,7 @@ public:
AnnotationIDs queryShapeAnnotations(const ScreenBox& box) const;
// Memory
void onLowMemory();
void reduceMemoryUse();
private:
MapRenderer& mapRenderer;

View File

@@ -450,7 +450,7 @@ jni::Array<jni::jlong> NativeMapView::addMarkers(jni::JNIEnv& env, jni::Array<jn
}
void NativeMapView::onLowMemory(JNIEnv&) {
rendererFrontend->onLowMemory();
rendererFrontend->reduceMemoryUse();
}
using DebugOptions = mbgl::MapDebugOptions;

View File

@@ -56,9 +56,9 @@ public:
return renderer.get();
}
void onLowMemory() {
void reduceMemoryUse() {
if (!renderer) return;
renderer->onLowMemory();
renderer->reduceMemoryUse();
}
private:

View File

@@ -716,7 +716,7 @@ public:
{
MGLAssertIsMainThread();
_rendererFrontend->onLowMemory();
_rendererFrontend->reduceMemoryUse();
}
#pragma mark - Layout -
@@ -2315,7 +2315,7 @@ public:
- (void)emptyMemoryCache
{
_rendererFrontend->onLowMemory();
_rendererFrontend->reduceMemoryUse();
}
- (void)setZoomEnabled:(BOOL)zoomEnabled

View File

@@ -73,8 +73,8 @@ std::vector<Feature> RenderAnnotationSource::querySourceFeatures(const SourceQue
return {};
}
void RenderAnnotationSource::onLowMemory() {
tilePyramid.onLowMemory();
void RenderAnnotationSource::reduceMemoryUse() {
tilePyramid.reduceMemoryUse();
}
void RenderAnnotationSource::dumpDebugLogs() const {

View File

@@ -33,7 +33,7 @@ public:
std::vector<Feature>
querySourceFeatures(const SourceQueryOptions&) const final;
void onLowMemory() final;
void reduceMemoryUse() final;
void dumpDebugLogs() const final;
private:

View File

@@ -70,7 +70,7 @@ public:
virtual std::vector<Feature>
querySourceFeatures(const SourceQueryOptions&) const = 0;
virtual void onLowMemory() = 0;
virtual void reduceMemoryUse() = 0;
virtual void dumpDebugLogs() const = 0;

View File

@@ -94,9 +94,9 @@ void Renderer::dumpDebugLogs() {
impl->dumDebugLogs();
}
void Renderer::onLowMemory() {
void Renderer::reduceMemoryUse() {
BackendScope guard { impl->backend };
impl->onLowMemory();
impl->reduceMemoryUse();
}
} // namespace mbgl

View File

@@ -722,10 +722,10 @@ std::vector<Feature> Renderer::Impl::querySourceFeatures(const std::string& sour
return source->querySourceFeatures(options);
}
void Renderer::Impl::onLowMemory() {
void Renderer::Impl::reduceMemoryUse() {
assert(BackendScope::exists());
for (const auto& entry : renderSources) {
entry.second->onLowMemory();
entry.second->reduceMemoryUse();
}
backend.getContext().performCleanup();
observer->onInvalidate();

View File

@@ -53,7 +53,7 @@ public:
std::vector<Feature> querySourceFeatures(const std::string& sourceID, const SourceQueryOptions&) const;
std::vector<Feature> queryShapeAnnotations(const ScreenLineString&) const;
void onLowMemory();
void reduceMemoryUse();
void dumDebugLogs();
private:

View File

@@ -76,8 +76,8 @@ std::vector<Feature> RenderCustomGeometrySource::querySourceFeatures(const Sourc
return tilePyramid.querySourceFeatures(options);
}
void RenderCustomGeometrySource::onLowMemory() {
tilePyramid.onLowMemory();
void RenderCustomGeometrySource::reduceMemoryUse() {
tilePyramid.reduceMemoryUse();
}
void RenderCustomGeometrySource::dumpDebugLogs() const {

View File

@@ -33,7 +33,7 @@ public:
std::vector<Feature>
querySourceFeatures(const SourceQueryOptions&) const final;
void onLowMemory() final;
void reduceMemoryUse() final;
void dumpDebugLogs() const final;
private:

View File

@@ -94,8 +94,8 @@ std::vector<Feature> RenderGeoJSONSource::querySourceFeatures(const SourceQueryO
return tilePyramid.querySourceFeatures(options);
}
void RenderGeoJSONSource::onLowMemory() {
tilePyramid.onLowMemory();
void RenderGeoJSONSource::reduceMemoryUse() {
tilePyramid.reduceMemoryUse();
}
void RenderGeoJSONSource::dumpDebugLogs() const {

View File

@@ -37,7 +37,7 @@ public:
std::vector<Feature>
querySourceFeatures(const SourceQueryOptions&) const final;
void onLowMemory() final;
void reduceMemoryUse() final;
void dumpDebugLogs() const final;
private:

View File

@@ -37,7 +37,7 @@ public:
std::vector<Feature> querySourceFeatures(const SourceQueryOptions&) const final;
void onLowMemory() final {
void reduceMemoryUse() final {
}
void dumpDebugLogs() const final;

View File

@@ -155,8 +155,8 @@ std::vector<Feature> RenderRasterDEMSource::querySourceFeatures(const SourceQuer
return {};
}
void RenderRasterDEMSource::onLowMemory() {
tilePyramid.onLowMemory();
void RenderRasterDEMSource::reduceMemoryUse() {
tilePyramid.reduceMemoryUse();
}
void RenderRasterDEMSource::dumpDebugLogs() const {

View File

@@ -33,7 +33,7 @@ public:
std::vector<Feature>
querySourceFeatures(const SourceQueryOptions&) const final;
void onLowMemory() final;
void reduceMemoryUse() final;
void dumpDebugLogs() const final;
private:

View File

@@ -85,8 +85,8 @@ std::vector<Feature> RenderRasterSource::querySourceFeatures(const SourceQueryOp
return {};
}
void RenderRasterSource::onLowMemory() {
tilePyramid.onLowMemory();
void RenderRasterSource::reduceMemoryUse() {
tilePyramid.reduceMemoryUse();
}
void RenderRasterSource::dumpDebugLogs() const {

View File

@@ -33,7 +33,7 @@ public:
std::vector<Feature>
querySourceFeatures(const SourceQueryOptions&) const final;
void onLowMemory() final;
void reduceMemoryUse() final;
void dumpDebugLogs() const final;
private:

View File

@@ -88,8 +88,8 @@ std::vector<Feature> RenderVectorSource::querySourceFeatures(const SourceQueryOp
return tilePyramid.querySourceFeatures(options);
}
void RenderVectorSource::onLowMemory() {
tilePyramid.onLowMemory();
void RenderVectorSource::reduceMemoryUse() {
tilePyramid.reduceMemoryUse();
}
void RenderVectorSource::dumpDebugLogs() const {

View File

@@ -33,7 +33,7 @@ public:
std::vector<Feature>
querySourceFeatures(const SourceQueryOptions&) const final;
void onLowMemory() final;
void reduceMemoryUse() final;
void dumpDebugLogs() const final;
private:

View File

@@ -303,7 +303,7 @@ void TilePyramid::setCacheSize(size_t size) {
cache.setSize(size);
}
void TilePyramid::onLowMemory() {
void TilePyramid::reduceMemoryUse() {
cache.clear();
}

View File

@@ -59,7 +59,7 @@ public:
std::vector<Feature> querySourceFeatures(const SourceQueryOptions&) const;
void setCacheSize(size_t);
void onLowMemory();
void reduceMemoryUse();
void setObserver(TileObserver*);
void dumpDebugLogs() const;