-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #547 from CesiumGS/update-native
Update cesium-native, don't derive CesiumImpl from ReferenceCountedThreadSafe
- Loading branch information
Showing
9 changed files
with
76 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,56 @@ | ||
#pragma once | ||
|
||
#include <CesiumUtility/ReferenceCounted.h> | ||
#include <CesiumUtility/Assert.h> | ||
|
||
#include <atomic> | ||
#include <cstdint> | ||
#include <type_traits> | ||
|
||
namespace CesiumForUnityNative { | ||
|
||
template <typename TDerived> | ||
class CesiumImpl : public CesiumUtility::ReferenceCountedThreadSafe<TDerived> { | ||
template <typename TDerived> class CesiumImpl { | ||
public: | ||
CesiumImpl() = default; | ||
/** | ||
* @brief Adds a counted reference to this object. Use | ||
* {@link CesiumUtility::IntrusivePointer} instead of calling this method | ||
* directly. | ||
*/ | ||
void addReference() const /*noexcept*/ { ++this->_referenceCount; } | ||
|
||
/** | ||
* @brief Removes a counted reference from this object. When the last | ||
* reference is removed, this method will delete this instance. Use | ||
* {@link CesiumUtility::IntrusivePointer} instead of calling this method | ||
* directly. | ||
*/ | ||
void releaseReference() const /*noexcept*/ { | ||
CESIUM_ASSERT(this->_referenceCount > 0); | ||
const int32_t references = --this->_referenceCount; | ||
if (references == 0) { | ||
delete static_cast<const TDerived*>(this); | ||
} | ||
} | ||
|
||
/** | ||
* @brief Returns the current reference count of this instance. | ||
*/ | ||
std::int32_t getReferenceCount() const noexcept { | ||
return this->_referenceCount; | ||
} | ||
|
||
// Prevent copying of impl classes | ||
CesiumImpl(CesiumImpl&&) = delete; | ||
CesiumImpl(const CesiumImpl&) = delete; | ||
CesiumImpl& operator=(CesiumImpl&&) = delete; | ||
CesiumImpl& operator=(const CesiumImpl&) = delete; | ||
|
||
private: | ||
CesiumImpl() noexcept = default; | ||
~CesiumImpl() noexcept { CESIUM_ASSERT(this->_referenceCount == 0); } | ||
|
||
friend TDerived; | ||
|
||
mutable std::atomic<std::int32_t> _referenceCount{0}; | ||
}; | ||
|
||
} // namespace CesiumForUnityNative |
Submodule cesium-native
updated
515 files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
diff --git a/CMakeLists.txt b/CMakeLists.txt | ||
index e99fb143..072ea889 100644 | ||
--- a/CMakeLists.txt | ||
+++ b/CMakeLists.txt | ||
@@ -489,7 +489,7 @@ macro(common_libktx_settings target enable_write library_type) | ||
CXX_STANDARD_REQUIRED YES | ||
|
||
) | ||
- if(IOS) | ||
+ if(0) | ||
set_target_properties(${target} PROPERTIES | ||
FRAMEWORK TRUE | ||
) | ||
@@ -1145,7 +1145,7 @@ endif() | ||
# Use of this to install KHR/khr_df.h is due to CMake's failure to | ||
# preserve the include source folder hierarchy. | ||
# See https://gitlab.kitware.com/cmake/cmake/-/issues/16739. | ||
-if (IOS) | ||
+if (0) | ||
set_source_files_properties( | ||
include/KHR/khr_df.h | ||
PROPERTIES MACOSX_PACKAGE_LOCATION Headers/KHR |
This file was deleted.
Oops, something went wrong.
30 changes: 0 additions & 30 deletions
30
native~/vcpkg/ports/ktx/CESIUM-0003-ios-normal-header-path.patch
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters