[core] Add runtime API for setting tile prefetch delta for Source

New setPrefetchZoomDelta(optional<uint8_t> delta) method allow overriding
default tile prefetch setting that is defined by the Map instance. The
method can be moved to generic style specification if found to be useful
for gl-js engine.
This commit is contained in:
Alexander Shalamov
2020-02-06 09:44:49 +02:00
parent a231005860
commit fce4129435
16 changed files with 77 additions and 2 deletions

View File

@@ -73,6 +73,8 @@ public:
SourceObserver* observer = nullptr;
virtual void loadDescription(FileSource&) = 0;
void setPrefetchZoomDelta(optional<uint8_t> delta) noexcept;
optional<uint8_t> getPrefetchZoomDelta() const noexcept;
void dumpDebugLogs() const;
virtual bool supportsLayerType(const mbgl::style::LayerTypeInfo*) const = 0;
@@ -85,6 +87,9 @@ public:
mapbox::base::TypeWrapper peer;
virtual mapbox::base::WeakPtr<Source> makeWeakPtr() = 0;
protected:
virtual Mutable<Impl> createMutable() const noexcept = 0;
};
} // namespace style

View File

@@ -50,6 +50,10 @@ public:
mapbox::base::WeakPtr<Source> makeWeakPtr() override {
return weakFactory.makeWeakPtr();
}
protected:
Mutable<Source::Impl> createMutable() const noexcept final;
private:
std::shared_ptr<ThreadPool> threadPool;
std::unique_ptr<Actor<CustomTileLoader>> loader;

View File

@@ -81,6 +81,9 @@ public:
return weakFactory.makeWeakPtr();
}
protected:
Mutable<Source::Impl> createMutable() const noexcept final;
private:
optional<std::string> url;
std::unique_ptr<AsyncRequest> req;

View File

@@ -33,6 +33,10 @@ public:
mapbox::base::WeakPtr<Source> makeWeakPtr() override {
return weakFactory.makeWeakPtr();
}
protected:
Mutable<Source::Impl> createMutable() const noexcept final;
private:
optional<std::string> url;
std::unique_ptr<AsyncRequest> req;

View File

@@ -31,6 +31,9 @@ public:
return weakFactory.makeWeakPtr();
}
protected:
Mutable<Source::Impl> createMutable() const noexcept final;
private:
const variant<std::string, Tileset> urlOrTileset;
std::unique_ptr<AsyncRequest> req;

View File

@@ -30,6 +30,9 @@ public:
return weakFactory.makeWeakPtr();
}
protected:
Mutable<Source::Impl> createMutable() const noexcept final;
private:
const variant<std::string, Tileset> urlOrTileset;
std::unique_ptr<AsyncRequest> req;