Change naming in some platform files (#2452)
This commit is contained in:
@@ -7,13 +7,13 @@
|
||||
namespace mbgl {
|
||||
namespace platform {
|
||||
|
||||
#define DECLARE_MAPBOX_SETTING(name, value) constexpr const char* name = "mapbox_" #value
|
||||
#define DECLARE_MAPLIBRE_SETTING(name, value) constexpr const char* name = "maplibre_" #value
|
||||
|
||||
// The value for EXPERIMENTAL_THREAD_PRIORITY_* keys, must be a double.
|
||||
DECLARE_MAPBOX_SETTING(EXPERIMENTAL_THREAD_PRIORITY_WORKER, thread_priority_worker);
|
||||
DECLARE_MAPBOX_SETTING(EXPERIMENTAL_THREAD_PRIORITY_FILE, thread_priority_file);
|
||||
DECLARE_MAPBOX_SETTING(EXPERIMENTAL_THREAD_PRIORITY_NETWORK, thread_priority_network);
|
||||
DECLARE_MAPBOX_SETTING(EXPERIMENTAL_THREAD_PRIORITY_DATABASE, thread_priority_database);
|
||||
DECLARE_MAPLIBRE_SETTING(EXPERIMENTAL_THREAD_PRIORITY_WORKER, thread_priority_worker);
|
||||
DECLARE_MAPLIBRE_SETTING(EXPERIMENTAL_THREAD_PRIORITY_FILE, thread_priority_file);
|
||||
DECLARE_MAPLIBRE_SETTING(EXPERIMENTAL_THREAD_PRIORITY_NETWORK, thread_priority_network);
|
||||
DECLARE_MAPLIBRE_SETTING(EXPERIMENTAL_THREAD_PRIORITY_DATABASE, thread_priority_database);
|
||||
|
||||
/// Settings class provides non-persistent, in-process key-value storage.
|
||||
class Settings final {
|
||||
|
||||
@@ -77,7 +77,7 @@ public:
|
||||
}
|
||||
|
||||
- (MLNLoggingBlockHandler)defaultBlockHandler {
|
||||
MLNLoggingBlockHandler mapboxHandler = ^(MLNLoggingLevel level, NSString *fileName, NSUInteger line, NSString *message) {
|
||||
MLNLoggingBlockHandler maplibreHandler = ^(MLNLoggingLevel level, NSString *fileName, NSUInteger line, NSString *message) {
|
||||
|
||||
if (@available(iOS 10.0, macOS 10.12.0, *)) {
|
||||
static dispatch_once_t once;
|
||||
@@ -94,31 +94,32 @@ public:
|
||||
#endif
|
||||
OS_LOG_TYPE_ERROR,
|
||||
OS_LOG_TYPE_FAULT };
|
||||
constexpr const char* const subsystem = "org.maplibre.Native";
|
||||
dispatch_once(&once, ^ {
|
||||
info_log = os_log_create("com.mapbox.Mapbox", "INFO");
|
||||
info_log = os_log_create(subsystem, "INFO");
|
||||
#if MLN_LOGGING_ENABLE_DEBUG
|
||||
debug_log = os_log_create("com.mapbox.Mapbox", "DEBUG");
|
||||
debug_log = os_log_create(subsystem, "DEBUG");
|
||||
#endif
|
||||
error_log = os_log_create("com.mapbox.Mapbox", "ERROR");
|
||||
fault_log = os_log_create("com.mapbox.Mapbox", "FAULT");
|
||||
error_log = os_log_create(subsystem, "ERROR");
|
||||
fault_log = os_log_create(subsystem, "FAULT");
|
||||
});
|
||||
|
||||
os_log_t mapbox_log;
|
||||
os_log_t maplibre_log;
|
||||
switch (level) {
|
||||
case MLNLoggingLevelInfo:
|
||||
case MLNLoggingLevelWarning:
|
||||
mapbox_log = info_log;
|
||||
maplibre_log = info_log;
|
||||
break;
|
||||
#if MLN_LOGGING_ENABLE_DEBUG
|
||||
case MLNLoggingLevelDebug:
|
||||
mapbox_log = debug_log;
|
||||
maplibre_log = debug_log;
|
||||
break;
|
||||
#endif
|
||||
case MLNLoggingLevelError:
|
||||
mapbox_log = error_log;
|
||||
maplibre_log = error_log;
|
||||
break;
|
||||
case MLNLoggingLevelFault:
|
||||
mapbox_log = fault_log;
|
||||
maplibre_log = fault_log;
|
||||
break;
|
||||
case MLNLoggingLevelNone:
|
||||
default:
|
||||
@@ -126,7 +127,7 @@ public:
|
||||
}
|
||||
|
||||
os_log_type_t logType = log_types[level];
|
||||
os_log_with_type(mapbox_log, logType, "%@ - %lu: %@", fileName, (unsigned long)line, message);
|
||||
os_log_with_type(maplibre_log, logType, "%@ - %lu: %@", fileName, (unsigned long)line, message);
|
||||
} else {
|
||||
NSString *category;
|
||||
switch (level) {
|
||||
@@ -154,7 +155,7 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
return mapboxHandler;
|
||||
return maplibreHandler;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -27,7 +27,7 @@ NSString * const kMLNDownloadPerformanceEvent = @"mobile.performance_trace";
|
||||
if (self = [super init]) {
|
||||
self.sessionConfiguration = nil;
|
||||
_events = [NSMutableDictionary dictionary];
|
||||
_eventsQueue = dispatch_queue_create("com.mapbox.network-configuration", DISPATCH_QUEUE_CONCURRENT);
|
||||
_eventsQueue = dispatch_queue_create("org.maplibre.network-configuration", DISPATCH_QUEUE_CONCURRENT);
|
||||
}
|
||||
|
||||
return self;
|
||||
|
||||
@@ -17,7 +17,7 @@ std::string getCurrentThreadName() {
|
||||
}
|
||||
|
||||
void setCurrentThreadName(const std::string& name) {
|
||||
std::string qualifiedName = "com.mapbox.mbgl." + name;
|
||||
std::string qualifiedName = "org.maplibre.mbgl." + name;
|
||||
pthread_setname_np(qualifiedName.c_str());
|
||||
}
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@
|
||||
|
||||
- (void)testSources {
|
||||
NSSet<MLNSource *> *initialSources = self.style.sources;
|
||||
if ([initialSources.anyObject.identifier isEqualToString:@"com.mapbox.annotations"]) {
|
||||
if ([initialSources.anyObject.identifier isEqualToString:@"org.maplibre.annotations"]) {
|
||||
XCTAssertEqual(self.style.sources.count, 1UL);
|
||||
} else {
|
||||
XCTAssertEqual(self.style.sources.count, 0UL);
|
||||
@@ -175,7 +175,7 @@
|
||||
|
||||
- (void)testLayers {
|
||||
NSArray<MLNStyleLayer *> *initialLayers = self.style.layers;
|
||||
if ([initialLayers.firstObject.identifier isEqualToString:@"com.mapbox.annotations.points"]) {
|
||||
if ([initialLayers.firstObject.identifier isEqualToString:@"org.maplibre.annotations.points"]) {
|
||||
XCTAssertEqual(self.style.layers.count, 1UL);
|
||||
} else {
|
||||
XCTAssertEqual(self.style.layers.count, 0UL);
|
||||
@@ -346,7 +346,7 @@
|
||||
|
||||
NSArray<MLNStyleLayer *> *layers = [self.style layers];
|
||||
NSUInteger startIndex = 0;
|
||||
if ([layers.firstObject.identifier isEqualToString:@"com.mapbox.annotations.points"]) {
|
||||
if ([layers.firstObject.identifier isEqualToString:@"org.maplibre.annotations.points"]) {
|
||||
startIndex++;
|
||||
}
|
||||
|
||||
|
||||
@@ -295,7 +295,7 @@ static NSString * const MLNInvisibleStyleMarkerSymbolName = @"invisible_marker";
|
||||
|
||||
/// Prefix that denotes a sprite installed by MLNMapView, to avoid collisions
|
||||
/// with style-defined sprites.
|
||||
NSString * const MLNAnnotationSpritePrefix = @"com.mapbox.sprites.";
|
||||
NSString * const MLNAnnotationSpritePrefix = @"org.maplibre.sprites.";
|
||||
|
||||
/// Slop area around the hit testing point, allowing for imprecise annotation selection.
|
||||
const CGFloat MLNAnnotationImagePaddingForHitTest = 5;
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
MLNNetworkConfiguration *configuration = [[MLNNetworkConfiguration alloc] init];
|
||||
|
||||
// Concurrent
|
||||
dispatch_queue_t queue = dispatch_queue_create("com.mapbox.testAccessingEventsFromMultipleThreads", DISPATCH_QUEUE_CONCURRENT);
|
||||
dispatch_queue_t queue = dispatch_queue_create("org.maplibre.testAccessingEventsFromMultipleThreads", DISPATCH_QUEUE_CONCURRENT);
|
||||
|
||||
NSUInteger numberOfConcurrentBlocks = 20;
|
||||
|
||||
|
||||
@@ -2,55 +2,55 @@
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleDisplayName</key>
|
||||
<string>${PRODUCT_NAME}</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>UnitTestsApp</string>
|
||||
<key>CFBundleGetInfoString</key>
|
||||
<string>com.mapbox.UnitTestsApp</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleLongVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>MBGL</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>7877</string>
|
||||
<key>CSResourcesFileMapped</key>
|
||||
<true/>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>© 2014–2020 Mapbox</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
<key>UILaunchStoryboardName</key>
|
||||
<string>LaunchScreen</string>
|
||||
<key>UIMainStoryboardFile</key>
|
||||
<string>Main</string>
|
||||
<key>UIBackgroundModes</key>
|
||||
<array>
|
||||
<string>fetch</string>
|
||||
<string>remote-notification</string>
|
||||
</array>
|
||||
<key>UIRequiredDeviceCapabilities</key>
|
||||
<array>
|
||||
<string>armv7</string>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>NSAppTransportSecurity</key>
|
||||
<dict>
|
||||
<key>NSAllowsArbitraryLoads</key>
|
||||
<true/>
|
||||
</dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleDisplayName</key>
|
||||
<string>${PRODUCT_NAME}</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>UnitTestsApp</string>
|
||||
<key>CFBundleGetInfoString</key>
|
||||
<string>org.maplibre.UnitTestsApp</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleLongVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>MBGL</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>7877</string>
|
||||
<key>CSResourcesFileMapped</key>
|
||||
<true/>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>© 2014–2020 Mapbox</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
<key>UILaunchStoryboardName</key>
|
||||
<string>LaunchScreen</string>
|
||||
<key>UIMainStoryboardFile</key>
|
||||
<string>Main</string>
|
||||
<key>UIBackgroundModes</key>
|
||||
<array>
|
||||
<string>fetch</string>
|
||||
<string>remote-notification</string>
|
||||
</array>
|
||||
<key>UIRequiredDeviceCapabilities</key>
|
||||
<array>
|
||||
<string>armv7</string>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>NSAppTransportSecurity</key>
|
||||
<dict>
|
||||
<key>NSAllowsArbitraryLoads</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
||||
</plist>
|
||||
|
||||
@@ -32,12 +32,12 @@ namespace mbgl {
|
||||
|
||||
using namespace style;
|
||||
|
||||
const std::string AnnotationManager::SourceID = "com.mapbox.annotations";
|
||||
const std::string AnnotationManager::PointLayerID = "com.mapbox.annotations.points";
|
||||
const std::string AnnotationManager::ShapeLayerID = "com.mapbox.annotations.shape.";
|
||||
const std::string AnnotationManager::SourceID = "org.maplibre.annotations";
|
||||
const std::string AnnotationManager::PointLayerID = "org.maplibre.annotations.points";
|
||||
const std::string AnnotationManager::ShapeLayerID = "org.maplibre.annotations.shape.";
|
||||
|
||||
AnnotationManager::AnnotationManager(Style& style_)
|
||||
: style(style_) {};
|
||||
: style(style_) {}
|
||||
|
||||
AnnotationManager::~AnnotationManager() = default;
|
||||
|
||||
@@ -235,7 +235,7 @@ void AnnotationManager::removeTile(AnnotationTile& tile) {
|
||||
}
|
||||
|
||||
// To ensure that annotation images do not collide with images from the style,
|
||||
// we prefix input image IDs with "com.mapbox.annotations".
|
||||
// we prefix input image IDs with "org.maplibre.annotations".
|
||||
static std::string prefixedImageID(const std::string& id) {
|
||||
return AnnotationManager::SourceID + "." + id;
|
||||
}
|
||||
|
||||
@@ -65,6 +65,8 @@ void TileSourceRenderItem::updateDebugDrawables(DebugLayerGroupMap& debugLayerGr
|
||||
if (!debugShader) {
|
||||
return;
|
||||
}
|
||||
|
||||
const auto drawableName = "debug-" + name;
|
||||
std::unique_ptr<gfx::DrawableBuilder> debugBuilder = [&]() -> std::unique_ptr<gfx::DrawableBuilder> {
|
||||
auto builder = context.createDrawableBuilder("debug-builder");
|
||||
builder->setShader(debugShader);
|
||||
@@ -73,6 +75,7 @@ void TileSourceRenderItem::updateDebugDrawables(DebugLayerGroupMap& debugLayerGr
|
||||
builder->setColorMode(gfx::ColorMode::unblended());
|
||||
builder->setCullFaceMode(gfx::CullFaceMode::disabled());
|
||||
builder->setVertexAttrId(idDebugPosVertexAttribute);
|
||||
builder->setDrawableName(drawableName);
|
||||
|
||||
return builder;
|
||||
}();
|
||||
@@ -102,19 +105,21 @@ void TileSourceRenderItem::updateDebugDrawables(DebugLayerGroupMap& debugLayerGr
|
||||
builder->setColorMode(gfx::ColorMode::alphaBlended());
|
||||
builder->setCullFaceMode(gfx::CullFaceMode::disabled());
|
||||
builder->setVertexAttrId(idLinePosNormalVertexAttribute);
|
||||
builder->setDrawableName(drawableName);
|
||||
|
||||
return builder;
|
||||
};
|
||||
#endif
|
||||
|
||||
// add or get the layer group for a debug type
|
||||
const auto addOrGetLayerGroupForType = [&debugLayerGroups, &context](
|
||||
DebugType type,
|
||||
const std::string&& layerName) -> DebugLayerGroupMap::const_iterator {
|
||||
const auto addOrGetLayerGroupForType =
|
||||
[&debugLayerGroups, &context](DebugType type, std::string&& layerName) -> DebugLayerGroupMap::const_iterator {
|
||||
auto it = debugLayerGroups.find(type);
|
||||
if (it == debugLayerGroups.end()) {
|
||||
auto inserted = debugLayerGroups.insert(std::make_pair(
|
||||
type, context.createTileLayerGroup(static_cast<int32_t>(type), /*initialCapacity=*/64, layerName)));
|
||||
auto inserted = debugLayerGroups.insert(
|
||||
std::make_pair(type,
|
||||
context.createTileLayerGroup(
|
||||
static_cast<int32_t>(type), /*initialCapacity=*/64, std::move(layerName))));
|
||||
assert(inserted.second);
|
||||
it = inserted.first;
|
||||
}
|
||||
@@ -223,6 +228,17 @@ void TileSourceRenderItem::updateDebugDrawables(DebugLayerGroupMap& debugLayerGr
|
||||
|
||||
// We would need to set up `idLineExpressionUBO` if the expression mask isn't empty
|
||||
assert(linePropertiesUBO.expressionMask == LineExpressionMask::None);
|
||||
|
||||
const LineExpressionUBO exprUBO = {
|
||||
/* color = */ nullptr,
|
||||
/* blur = */ nullptr,
|
||||
/* opacity = */ nullptr,
|
||||
/* gapwidth = */ nullptr,
|
||||
/* offset = */ nullptr,
|
||||
/* width = */ nullptr,
|
||||
/* floorWidth = */ nullptr,
|
||||
};
|
||||
drawableUniforms.createOrUpdate(idLineExpressionUBO, &exprUBO, parameters.context);
|
||||
};
|
||||
|
||||
private:
|
||||
@@ -271,7 +287,8 @@ void TileSourceRenderItem::updateDebugDrawables(DebugLayerGroupMap& debugLayerGr
|
||||
// erase drawables that are not in the current tile set
|
||||
for (auto& lg : {outlineLayerGroup, textLayerGroup}) {
|
||||
lg->removeDrawablesIf([&](gfx::Drawable& drawable) {
|
||||
return !(drawable.getTileID().has_value() && newTiles.count(*drawable.getTileID()) > 0);
|
||||
return drawable.getName() == drawableName &&
|
||||
!(drawable.getTileID().has_value() && newTiles.count(*drawable.getTileID()) > 0);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -326,7 +343,8 @@ void TileSourceRenderItem::updateDebugDrawables(DebugLayerGroupMap& debugLayerGr
|
||||
|
||||
// erase drawables that are not in the current tile set
|
||||
tileLayerGroup->removeDrawablesIf([&](gfx::Drawable& drawable) {
|
||||
return !(drawable.getTileID().has_value() && newTiles.count(*drawable.getTileID()) > 0);
|
||||
return drawable.getName() == drawableName &&
|
||||
!(drawable.getTileID().has_value() && newTiles.count(*drawable.getTileID()) > 0);
|
||||
});
|
||||
|
||||
// add new drawables and update existing ones
|
||||
|
||||
@@ -15,7 +15,7 @@ using namespace std::chrono_literals;
|
||||
|
||||
TEST(Actor, Construction) {
|
||||
struct TestActor {
|
||||
TestActor(ActorRef<TestActor>, bool& constructed) { constructed = true; };
|
||||
TestActor(ActorRef<TestActor>, bool& constructed) { constructed = true; }
|
||||
};
|
||||
|
||||
bool constructed = false;
|
||||
@@ -27,7 +27,7 @@ TEST(Actor, Construction) {
|
||||
TEST(Actor, Destruction) {
|
||||
struct TestActor {
|
||||
TestActor(ActorRef<TestActor>, bool& destructed_)
|
||||
: destructed(destructed_) {};
|
||||
: destructed(destructed_) {}
|
||||
~TestActor() { destructed = true; }
|
||||
|
||||
bool& destructed;
|
||||
@@ -136,7 +136,7 @@ TEST(Actor, DestructionAllowedInReceiveOnSameThread) {
|
||||
// allows for self-closing actors
|
||||
|
||||
struct TestActor {
|
||||
TestActor(ActorRef<TestActor>) {};
|
||||
TestActor(ActorRef<TestActor>) {}
|
||||
|
||||
void callMeBack(std::function<void()> callback) { callback(); }
|
||||
};
|
||||
@@ -162,7 +162,7 @@ TEST(Actor, SelfDestructionDoesntCrashWaitingReceivingThreads) {
|
||||
// callback
|
||||
|
||||
struct TestActor {
|
||||
TestActor(ActorRef<TestActor>) {};
|
||||
TestActor(ActorRef<TestActor>) {}
|
||||
|
||||
void callMeBack(std::function<void()> callback) { callback(); }
|
||||
};
|
||||
@@ -179,10 +179,8 @@ TEST(Actor, SelfDestructionDoesntCrashWaitingReceivingThreads) {
|
||||
// Queue up another message from another thread
|
||||
std::promise<void> messageQueuedPromise;
|
||||
waitingActor->self().invoke(&TestActor::callMeBack, [&]() {
|
||||
// This will be waiting on the mutex in
|
||||
// Mailbox::receive(), holding a lock
|
||||
// on the weak_ptr so the mailbox is not
|
||||
// destroyed
|
||||
// This will be waiting on the mutex in Mailbox::receive(),
|
||||
// holding a lock on the weak_ptr so the mailbox is not destroyed
|
||||
closingActor->self().invoke(&TestActor::callMeBack, [&]() { waitingMessageProcessed.store(true); });
|
||||
messageQueuedPromise.set_value();
|
||||
});
|
||||
@@ -334,7 +332,7 @@ TEST(Actor, TwoPhaseConstruction) {
|
||||
|
||||
struct TestActor {
|
||||
TestActor(ActorRef<TestActor>, std::shared_ptr<bool> destroyed_)
|
||||
: destroyed(std::move(destroyed_)) {};
|
||||
: destroyed(std::move(destroyed_)) {}
|
||||
|
||||
~TestActor() { *destroyed = true; }
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ TEST(Settings, SetAndGet) {
|
||||
settings.set(EXPERIMENTAL_THREAD_PRIORITY_WORKER, lowPrioValue);
|
||||
auto threadPriority = settings.get(EXPERIMENTAL_THREAD_PRIORITY_WORKER);
|
||||
EXPECT_EQ(lowPrioValue, threadPriority);
|
||||
EXPECT_EQ(lowPrioValue, settings.get("mapbox_thread_priority_worker"));
|
||||
EXPECT_EQ(lowPrioValue, settings.get("maplibre_thread_priority_worker"));
|
||||
|
||||
Value networkPrioValue{-20.0};
|
||||
Value databasePrioValue{-10.0};
|
||||
|
||||
Reference in New Issue
Block a user