diff --git a/include/mbgl/platform/settings.hpp b/include/mbgl/platform/settings.hpp index 3b5a57d0a..d7c15d2d8 100644 --- a/include/mbgl/platform/settings.hpp +++ b/include/mbgl/platform/settings.hpp @@ -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 { diff --git a/platform/darwin/src/MLNLoggingConfiguration.mm b/platform/darwin/src/MLNLoggingConfiguration.mm index e9cd41eb1..273dd287f 100644 --- a/platform/darwin/src/MLNLoggingConfiguration.mm +++ b/platform/darwin/src/MLNLoggingConfiguration.mm @@ -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 diff --git a/platform/darwin/src/MLNNetworkConfiguration.mm b/platform/darwin/src/MLNNetworkConfiguration.mm index 5091b5328..6cedb5e85 100644 --- a/platform/darwin/src/MLNNetworkConfiguration.mm +++ b/platform/darwin/src/MLNNetworkConfiguration.mm @@ -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; diff --git a/platform/darwin/src/nsthread.mm b/platform/darwin/src/nsthread.mm index 8a3ed1743..19170f9a3 100644 --- a/platform/darwin/src/nsthread.mm +++ b/platform/darwin/src/nsthread.mm @@ -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()); } diff --git a/platform/darwin/test/MLNStyleTests.mm b/platform/darwin/test/MLNStyleTests.mm index 4c9371997..b0c6523c6 100644 --- a/platform/darwin/test/MLNStyleTests.mm +++ b/platform/darwin/test/MLNStyleTests.mm @@ -65,7 +65,7 @@ - (void)testSources { NSSet *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 *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 *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++; } diff --git a/platform/ios/src/MLNMapView.mm b/platform/ios/src/MLNMapView.mm index c4fe65cd3..3f7eb8e70 100644 --- a/platform/ios/src/MLNMapView.mm +++ b/platform/ios/src/MLNMapView.mm @@ -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; diff --git a/platform/ios/test/MLNNetworkConfigurationTests.m b/platform/ios/test/MLNNetworkConfigurationTests.m index 58c3a02dd..3569e3102 100644 --- a/platform/ios/test/MLNNetworkConfigurationTests.m +++ b/platform/ios/test/MLNNetworkConfigurationTests.m @@ -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; diff --git a/platform/ios/test/core/Info.plist b/platform/ios/test/core/Info.plist index 2fb1694c1..b55b053e5 100644 --- a/platform/ios/test/core/Info.plist +++ b/platform/ios/test/core/Info.plist @@ -2,55 +2,55 @@ - CFBundleDevelopmentRegion - en - CFBundleDisplayName - ${PRODUCT_NAME} - CFBundleExecutable - UnitTestsApp - CFBundleGetInfoString - com.mapbox.UnitTestsApp - CFBundleInfoDictionaryVersion - 1.0 - CFBundleLongVersionString - 1.0 - CFBundlePackageType - APPL - CFBundleShortVersionString - 1.0 - CFBundleSignature - MBGL - CFBundleVersion - 7877 - CSResourcesFileMapped - - NSHumanReadableCopyright - © 2014–2020 Mapbox - LSRequiresIPhoneOS - - UILaunchStoryboardName - LaunchScreen - UIMainStoryboardFile - Main - UIBackgroundModes - - fetch - remote-notification - - UIRequiredDeviceCapabilities - - armv7 - - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - NSAppTransportSecurity - - NSAllowsArbitraryLoads - - + CFBundleDevelopmentRegion + en + CFBundleDisplayName + ${PRODUCT_NAME} + CFBundleExecutable + UnitTestsApp + CFBundleGetInfoString + org.maplibre.UnitTestsApp + CFBundleInfoDictionaryVersion + 1.0 + CFBundleLongVersionString + 1.0 + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleSignature + MBGL + CFBundleVersion + 7877 + CSResourcesFileMapped + + NSHumanReadableCopyright + © 2014–2020 Mapbox + LSRequiresIPhoneOS + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UIBackgroundModes + + fetch + remote-notification + + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + NSAppTransportSecurity + + NSAllowsArbitraryLoads + + - \ No newline at end of file + diff --git a/src/mbgl/annotation/annotation_manager.cpp b/src/mbgl/annotation/annotation_manager.cpp index 2c6dd2218..31f088907 100644 --- a/src/mbgl/annotation/annotation_manager.cpp +++ b/src/mbgl/annotation/annotation_manager.cpp @@ -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; } diff --git a/src/mbgl/renderer/sources/render_tile_source.cpp b/src/mbgl/renderer/sources/render_tile_source.cpp index 61761204c..ae44ff3f7 100644 --- a/src/mbgl/renderer/sources/render_tile_source.cpp +++ b/src/mbgl/renderer/sources/render_tile_source.cpp @@ -65,6 +65,8 @@ void TileSourceRenderItem::updateDebugDrawables(DebugLayerGroupMap& debugLayerGr if (!debugShader) { return; } + + const auto drawableName = "debug-" + name; std::unique_ptr debugBuilder = [&]() -> std::unique_ptr { 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(type), /*initialCapacity=*/64, layerName))); + auto inserted = debugLayerGroups.insert( + std::make_pair(type, + context.createTileLayerGroup( + static_cast(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 diff --git a/test/actor/actor.test.cpp b/test/actor/actor.test.cpp index e0558f280..681930079 100644 --- a/test/actor/actor.test.cpp +++ b/test/actor/actor.test.cpp @@ -15,7 +15,7 @@ using namespace std::chrono_literals; TEST(Actor, Construction) { struct TestActor { - TestActor(ActorRef, bool& constructed) { constructed = true; }; + TestActor(ActorRef, bool& constructed) { constructed = true; } }; bool constructed = false; @@ -27,7 +27,7 @@ TEST(Actor, Construction) { TEST(Actor, Destruction) { struct TestActor { TestActor(ActorRef, 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(ActorRef) {} void callMeBack(std::function callback) { callback(); } }; @@ -162,7 +162,7 @@ TEST(Actor, SelfDestructionDoesntCrashWaitingReceivingThreads) { // callback struct TestActor { - TestActor(ActorRef) {}; + TestActor(ActorRef) {} void callMeBack(std::function callback) { callback(); } }; @@ -179,10 +179,8 @@ TEST(Actor, SelfDestructionDoesntCrashWaitingReceivingThreads) { // Queue up another message from another thread std::promise 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, std::shared_ptr destroyed_) - : destroyed(std::move(destroyed_)) {}; + : destroyed(std::move(destroyed_)) {} ~TestActor() { *destroyed = true; } diff --git a/test/platform/settings.test.cpp b/test/platform/settings.test.cpp index 46a8fc7ef..28a57c126 100644 --- a/test/platform/settings.test.cpp +++ b/test/platform/settings.test.cpp @@ -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};