From ccc84b06b6c3c7b59ae8440acbfe650655502f33 Mon Sep 17 00:00:00 2001 From: minggo Date: Wed, 23 Mar 2022 16:44:06 +0800 Subject: [PATCH] replace std::unordered_map with ccstd::unordered_map (#10459) * replace std::unordered_map with ccstd::unordered_map --- native/CMakeLists.txt | 2 + native/cocos/3d/assets/Mesh.h | 2 +- .../SkeletalAnimationUtils.h | 10 ++--- native/cocos/audio/AudioEngine.cpp | 6 +-- .../cocos/audio/android/AudioEngine-inl.cpp | 1 - native/cocos/audio/android/AudioEngine-inl.h | 9 ++-- .../cocos/audio/android/AudioPlayerProvider.h | 6 +-- native/cocos/audio/apple/AudioEngine-inl.h | 6 +-- native/cocos/audio/include/AudioEngine.h | 8 ++-- native/cocos/audio/oalsoft/AudioEngine-soft.h | 9 ++-- native/cocos/base/CoreStd.h | 1 - native/cocos/base/RefMap.h | 10 ++--- native/cocos/base/Scheduler.h | 4 +- native/cocos/base/TypeDef.h | 4 +- native/cocos/base/Value.h | 5 ++- native/cocos/base/ZipUtils.cpp | 4 +- native/cocos/base/memory/MemoryHook.h | 4 +- native/cocos/base/memory/StlAlloc.h | 8 +--- native/cocos/base/std/container/map.h | 8 ++-- .../cocos/base/std/container/unordered_map.h | 44 +++++++++++++++++++ .../cocos/bindings/event/EventDispatcher.cpp | 2 +- native/cocos/bindings/event/EventDispatcher.h | 4 +- .../cocos/bindings/jswrapper/MappingUtils.h | 4 +- native/cocos/bindings/jswrapper/jsc/Base.h | 2 +- native/cocos/bindings/jswrapper/jsc/Class.cpp | 2 +- native/cocos/bindings/jswrapper/jsc/Object.h | 2 +- native/cocos/bindings/jswrapper/v8/Base.h | 2 +- native/cocos/bindings/jswrapper/v8/Class.cpp | 2 +- native/cocos/bindings/jswrapper/v8/Object.cpp | 6 +-- native/cocos/bindings/jswrapper/v8/Object.h | 4 +- .../bindings/jswrapper/v8/ScriptEngine.h | 2 +- .../cocos/bindings/manual/jsb_classtype.cpp | 2 +- native/cocos/bindings/manual/jsb_classtype.h | 2 +- .../cocos/bindings/manual/jsb_conversions.h | 12 ++--- .../bindings/manual/jsb_conversions_spec.cpp | 2 +- .../bindings/manual/jsb_conversions_spec.h | 4 +- native/cocos/bindings/manual/jsb_global.cpp | 2 +- native/cocos/bindings/manual/jsb_platform.h | 4 +- .../bindings/manual/jsb_platform_android.cpp | 4 +- .../bindings/manual/jsb_platform_ohos.cpp | 4 +- .../bindings/manual/jsb_platfrom_apple.mm | 4 +- .../bindings/manual/jsb_platfrom_linux.cpp | 4 +- .../bindings/manual/jsb_platfrom_qnx.cpp | 4 +- .../bindings/manual/jsb_platfrom_win32.cpp | 4 +- native/cocos/bindings/manual/jsb_socketio.cpp | 2 +- .../bindings/manual/jsb_xmlhttprequest.cpp | 8 ++-- native/cocos/core/DataView.cpp | 4 +- native/cocos/core/DataView.h | 4 +- native/cocos/core/Types.h | 2 +- .../core/animation/SkeletalAnimationUtils.cpp | 2 +- native/cocos/core/assets/EffectAsset.h | 10 ++--- native/cocos/core/assets/Font.h | 8 ++-- native/cocos/core/assets/Material.h | 2 +- native/cocos/core/builtin/DebugInfos.cpp | 2 +- native/cocos/core/builtin/DebugInfos.cpp.in | 2 +- native/cocos/core/builtin/DebugInfos.h | 4 +- .../cocos/core/builtin/ShaderSourceAssembly.h | 6 +-- native/cocos/core/event/CallbacksInvoker.h | 4 +- native/cocos/network/Downloader-curl.cpp | 2 +- native/cocos/network/Downloader-java.cpp | 2 +- native/cocos/network/Downloader-java.h | 2 +- native/cocos/network/DownloaderImpl.h | 2 +- native/cocos/network/SocketIO.h | 4 +- native/cocos/network/WebSocketServer.h | 4 +- native/cocos/physics/physx/PhysXUtils.h | 10 ++--- .../cocos/physics/physx/shapes/PhysXShape.cpp | 2 +- native/cocos/platform/FileUtils.h | 6 +-- .../java/jni/JniCocosKeyCodeHandler.cpp | 4 +- native/cocos/platform/java/jni/JniHelper.cpp | 2 +- native/cocos/platform/java/jni/JniHelper.h | 4 +- native/cocos/platform/linux/LinuxPlatform.cpp | 4 +- native/cocos/platform/mac/cocos2d-prefix.pch | 2 +- native/cocos/platform/qnx/QNXPlatform.cpp | 4 +- .../cocos/platform/win32/WindowsPlatform.cpp | 4 +- native/cocos/primitive/Transform.cpp | 2 +- native/cocos/profiler/GameStats.h | 8 ++-- native/cocos/profiler/Profiler.cpp | 2 +- native/cocos/renderer/core/PassUtils.cpp | 4 +- native/cocos/renderer/core/PassUtils.h | 4 +- native/cocos/renderer/core/ProgramLib.h | 2 +- .../cocos/renderer/frame-graph/Blackboard.h | 4 +- .../frame-graph/DevicePassResourceTable.h | 4 +- .../cocos/renderer/frame-graph/FrameGraph.cpp | 2 +- .../renderer/frame-graph/ResourceAllocator.h | 6 +-- native/cocos/renderer/gfx-base/GFXDevice.h | 6 +-- native/cocos/renderer/gfx-base/GFXQueryPool.h | 4 +- .../renderer/gfx-gles2/GLES2Commands.cpp | 2 +- .../renderer/gfx-gles2/GLES2GPUObjects.h | 8 ++-- .../renderer/gfx-gles3/GLES3Commands.cpp | 4 +- .../renderer/gfx-gles3/GLES3GPUObjects.h | 10 ++--- .../cocos/renderer/gfx-gles3/GLES3QueryPool.h | 2 +- native/cocos/renderer/gfx-metal/MTLDevice.mm | 2 +- .../cocos/renderer/gfx-metal/MTLGPUObjects.h | 4 +- .../renderer/gfx-metal/MTLPipelineState.mm | 2 +- .../gfx-metal/MTLRenderCommandEncoder.h | 14 +++--- native/cocos/renderer/gfx-metal/MTLShader.h | 4 +- native/cocos/renderer/gfx-metal/MTLUtils.h | 2 +- native/cocos/renderer/gfx-metal/MTLUtils.mm | 4 +- .../gfx-validator/TextureValidator.cpp | 2 +- .../renderer/gfx-validator/ValidationUtils.h | 2 +- .../cocos/renderer/gfx-vulkan/VKCommands.cpp | 2 +- native/cocos/renderer/gfx-vulkan/VKDevice.cpp | 2 +- .../cocos/renderer/gfx-vulkan/VKGPUObjects.h | 20 ++++----- .../cocos/renderer/gfx-vulkan/vk_mem_alloc.h | 8 ++-- .../gfx-wgpu/WGPUDescriptorSetLayout.cpp | 2 +- .../cocos/renderer/gfx-wgpu/WGPUQueryPool.h | 2 +- native/cocos/renderer/pipeline/Define.cpp | 2 +- native/cocos/renderer/pipeline/Define.h | 6 +-- .../pipeline/GlobalDescriptorSetManager.h | 4 +- .../renderer/pipeline/PipelineSceneData.h | 4 +- .../pipeline/PipelineStateManager.cpp | 2 +- .../renderer/pipeline/PipelineStateManager.h | 2 +- .../cocos/renderer/pipeline/RenderPipeline.h | 6 +-- .../pipeline/deferred/DeferredPipeline.h | 2 +- .../renderer/pipeline/shadow/ShadowFlow.cpp | 2 +- .../renderer/pipeline/shadow/ShadowFlow.h | 2 +- native/cocos/scene/Pass.h | 2 +- native/cocos/scene/RenderWindow.cpp | 2 +- .../cocos/ui/videoplayer/VideoPlayer-java.cpp | 4 +- .../cocos/ui/webview/WebViewImpl-android.cpp | 4 +- native/cocos/ui/webview/WebViewImpl-ohos.cpp | 4 +- 121 files changed, 291 insertions(+), 256 deletions(-) create mode 100644 native/cocos/base/std/container/unordered_map.h diff --git a/native/CMakeLists.txt b/native/CMakeLists.txt index 0bd53bdd7a..33ba95bf1a 100644 --- a/native/CMakeLists.txt +++ b/native/CMakeLists.txt @@ -329,8 +329,10 @@ cocos_source_files( cocos/base/TypeDef.h cocos/base/Variant.h cocos/base/std/container/deque.h + cocos/base/std/container/map.h cocos/base/std/container/queue.h cocos/base/std/container/set.h + cocos/base/std/container/unordered_map.h cocos/base/std/container/vector.h cocos/base/std/container/unordered_set.h ) diff --git a/native/cocos/3d/assets/Mesh.h b/native/cocos/3d/assets/Mesh.h index 3fbe69eeea..1033ee41be 100644 --- a/native/cocos/3d/assets/Mesh.h +++ b/native/cocos/3d/assets/Mesh.h @@ -439,7 +439,7 @@ private: RenderingSubMeshList _renderingSubMeshes; - std::unordered_map _boneSpaceBounds; + ccstd::unordered_map _boneSpaceBounds; JointBufferIndicesType _jointBufferIndices; diff --git a/native/cocos/3d/skeletal-animation/SkeletalAnimationUtils.h b/native/cocos/3d/skeletal-animation/SkeletalAnimationUtils.h index 1e63c58f95..16153daaee 100644 --- a/native/cocos/3d/skeletal-animation/SkeletalAnimationUtils.h +++ b/native/cocos/3d/skeletal-animation/SkeletalAnimationUtils.h @@ -24,7 +24,7 @@ ****************************************************************************/ #pragma once -#include +#include "base/std/container/unordered_map.h" #include "cocos/base/Optional.h" #include "3d/assets/Skeleton.h" @@ -66,7 +66,7 @@ public: uint64_t skeletonHash{0}; bool readyToBeDeleted{false}; ITextureBufferHandle handle; - std::unordered_map> bounds; + ccstd::unordered_map> bounds; cc::optional> animInfos; static IJointTextureHandle *createJoinTextureHandle() { @@ -116,11 +116,11 @@ private: gfx::Device * _device{nullptr}; IntrusivePtr _pool; - std::unordered_map _textureBuffers; + ccstd::unordered_map _textureBuffers; uint32_t _formatSize{0}; uint32_t _pixelsPerJoint{0}; IntrusivePtr _customPool; - std::unordered_map _chunkIdxMap; // hash -> chunkIdx + ccstd::unordered_map _chunkIdxMap; // hash -> chunkIdx CC_DISALLOW_COPY_MOVE_ASSIGN(JointTexturePool); }; @@ -146,7 +146,7 @@ public: void clear(); private: - std::unordered_map _pool; // pre node + ccstd::unordered_map _pool; // pre node gfx::Device * _device{nullptr}; CC_DISALLOW_COPY_MOVE_ASSIGN(JointAnimationInfo); diff --git a/native/cocos/audio/AudioEngine.cpp b/native/cocos/audio/AudioEngine.cpp index 5fca19a902..0b9a951598 100644 --- a/native/cocos/audio/AudioEngine.cpp +++ b/native/cocos/audio/AudioEngine.cpp @@ -59,12 +59,12 @@ const int AudioEngine::INVALID_AUDIO_ID = -1; const float AudioEngine::TIME_UNKNOWN = -1.0F; //audio file path,audio IDs -std::unordered_map> AudioEngine::sAudioPathIDMap; +ccstd::unordered_map> AudioEngine::sAudioPathIDMap; //profileName,ProfileHelper -std::unordered_map AudioEngine::sAudioPathProfileHelperMap; +ccstd::unordered_map AudioEngine::sAudioPathProfileHelperMap; unsigned int AudioEngine::sMaxInstances = MAX_AUDIOINSTANCES; AudioEngine::ProfileHelper * AudioEngine::sDefaultProfileHelper = nullptr; -std::unordered_map AudioEngine::sAudioIDInfoMap; +ccstd::unordered_map AudioEngine::sAudioIDInfoMap; AudioEngineImpl * AudioEngine::sAudioEngineImpl = nullptr; float AudioEngine::sVolumeFactor = 1.0F; diff --git a/native/cocos/audio/android/AudioEngine-inl.cpp b/native/cocos/audio/android/AudioEngine-inl.cpp index 34ac3995dd..57ff7b7733 100644 --- a/native/cocos/audio/android/AudioEngine-inl.cpp +++ b/native/cocos/audio/android/AudioEngine-inl.cpp @@ -34,7 +34,6 @@ #include #include #include -#include #include "application/ApplicationManager.h" #include "audio/include/AudioEngine.h" diff --git a/native/cocos/audio/android/AudioEngine-inl.h b/native/cocos/audio/android/AudioEngine-inl.h index bdd28b4a6b..cb9e52f306 100644 --- a/native/cocos/audio/android/AudioEngine-inl.h +++ b/native/cocos/audio/android/AudioEngine-inl.h @@ -28,8 +28,7 @@ #include #include #include -#include - +#include "base/std/container/unordered_map.h" #include "base/RefCounted.h" #include "base/Utils.h" @@ -83,11 +82,11 @@ private: SLObjectItf _outputMixObject; //audioID,AudioInfo - std::unordered_map _audioPlayers; - std::unordered_map> _callbackMap; + ccstd::unordered_map _audioPlayers; + ccstd::unordered_map> _callbackMap; // UrlAudioPlayers which need to resumed while entering foreground - std::unordered_map _urlAudioPlayersNeedResume; + ccstd::unordered_map _urlAudioPlayersNeedResume; AudioPlayerProvider *_audioPlayerProvider; diff --git a/native/cocos/audio/android/AudioPlayerProvider.h b/native/cocos/audio/android/AudioPlayerProvider.h index 9ab5316247..cb90afe62e 100644 --- a/native/cocos/audio/android/AudioPlayerProvider.h +++ b/native/cocos/audio/android/AudioPlayerProvider.h @@ -28,10 +28,10 @@ THE SOFTWARE. #include "audio/android/IAudioPlayer.h" #include "audio/android/OpenSLHelper.h" #include "audio/android/PcmData.h" +#include "base/std/container/unordered_map.h" #include #include -#include namespace cc { // Manage PcmAudioPlayer& UrlAudioPlayer @@ -99,7 +99,7 @@ private: FdGetterCallback _fdGetterCallback; ICallerThreadUtils *_callerThreadUtils; - std::unordered_map _pcmCache; + ccstd::unordered_map _pcmCache; std::mutex _pcmCacheMutex; struct PreloadCallbackParam { @@ -107,7 +107,7 @@ private: bool isPreloadInPlay2d; }; - std::unordered_map> _preloadCallbackMap; + ccstd::unordered_map> _preloadCallbackMap; std::mutex _preloadCallbackMutex; std::mutex _preloadWaitMutex; diff --git a/native/cocos/audio/apple/AudioEngine-inl.h b/native/cocos/audio/apple/AudioEngine-inl.h index 2ba4eb643b..9241412498 100644 --- a/native/cocos/audio/apple/AudioEngine-inl.h +++ b/native/cocos/audio/apple/AudioEngine-inl.h @@ -28,7 +28,7 @@ #define __AUDIO_ENGINE_INL_H_ #include -#include +#include "base/std/container/unordered_map.h" #include "audio/apple/AudioCache.h" #include "audio/apple/AudioPlayer.h" @@ -76,10 +76,10 @@ private: std::list _unusedSourcesPool; //filePath,bufferInfo - std::unordered_map _audioCaches; + ccstd::unordered_map _audioCaches; //audioID,AudioInfo - std::unordered_map _audioPlayers; + ccstd::unordered_map _audioPlayers; std::mutex _threadMutex; bool _lazyInitLoop; diff --git a/native/cocos/audio/include/AudioEngine.h b/native/cocos/audio/include/AudioEngine.h index aee4b345cb..3961dcf8b9 100644 --- a/native/cocos/audio/include/AudioEngine.h +++ b/native/cocos/audio/include/AudioEngine.h @@ -36,7 +36,7 @@ #include #include #include -#include +#include "base/std/container/unordered_map.h" #ifdef ERROR #undef ERROR @@ -353,13 +353,13 @@ protected: }; //audioID,audioAttribute - static std::unordered_map sAudioIDInfoMap; + static ccstd::unordered_map sAudioIDInfoMap; //audio file path,audio IDs - static std::unordered_map> sAudioPathIDMap; + static ccstd::unordered_map> sAudioPathIDMap; //profileName,ProfileHelper - static std::unordered_map sAudioPathProfileHelperMap; + static ccstd::unordered_map sAudioPathProfileHelperMap; static unsigned int sMaxInstances; diff --git a/native/cocos/audio/oalsoft/AudioEngine-soft.h b/native/cocos/audio/oalsoft/AudioEngine-soft.h index 6a24a2b2d9..366ffb93e7 100644 --- a/native/cocos/audio/oalsoft/AudioEngine-soft.h +++ b/native/cocos/audio/oalsoft/AudioEngine-soft.h @@ -26,8 +26,7 @@ #pragma once -#include - +#include "base/std/container/unordered_map.h" #include "audio/oalsoft/AudioCache.h" #include "audio/oalsoft/AudioPlayer.h" #include "cocos/base/RefCounted.h" @@ -69,13 +68,13 @@ private: ALuint _alSources[MAX_AUDIOINSTANCES]; //source,used - std::unordered_map _alSourceUsed; + ccstd::unordered_map _alSourceUsed; //filePath,bufferInfo - std::unordered_map _audioCaches; + ccstd::unordered_map _audioCaches; //audioID,AudioInfo - std::unordered_map _audioPlayers; + ccstd::unordered_map _audioPlayers; std::mutex _threadMutex; bool _lazyInitLoop; diff --git a/native/cocos/base/CoreStd.h b/native/cocos/base/CoreStd.h index c9225edab1..2d829abcee 100644 --- a/native/cocos/base/CoreStd.h +++ b/native/cocos/base/CoreStd.h @@ -48,7 +48,6 @@ #include #include #include -#include #include "base/CachedArray.h" #include "base/Log.h" diff --git a/native/cocos/base/RefMap.h b/native/cocos/base/RefMap.h index 8318508374..c965264a53 100644 --- a/native/cocos/base/RefMap.h +++ b/native/cocos/base/RefMap.h @@ -26,16 +26,16 @@ #pragma once -#include #include "base/Log.h" #include "base/Random.h" #include "base/RefCounted.h" +#include "base/std/container/unordered_map.h" #include "base/std/container/vector.h" namespace cc { /** - * Similar to std::unordered_map, but it will manage reference count automatically internally. + * Similar to ccstd::unordered_map, but it will manage reference count automatically internally. * Which means it will invoke RefCounted::addRef() when adding an element, and invoke RefCounted::release() when removing an element. * @warning The element should be `RefCounted` or its sub-class. */ @@ -47,9 +47,9 @@ public: // ------------------------------------------ /** Iterator, can be used to loop the Map. */ - using iterator = typename std::unordered_map::iterator; + using iterator = typename ccstd::unordered_map::iterator; /** Const iterator, can be used to loop the Map. */ - using const_iterator = typename std::unordered_map::const_iterator; + using const_iterator = typename ccstd::unordered_map::const_iterator; /** Return iterator to beginning. */ iterator begin() { return _data.begin(); } @@ -306,7 +306,7 @@ private: } } - std::unordered_map _data; + ccstd::unordered_map _data; }; } // namespace cc diff --git a/native/cocos/base/Scheduler.h b/native/cocos/base/Scheduler.h index 4176cf61ec..7aec24fd27 100644 --- a/native/cocos/base/Scheduler.h +++ b/native/cocos/base/Scheduler.h @@ -31,10 +31,10 @@ #include #include -#include #include "base/RefCounted.h" #include "base/std/container/set.h" +#include "base/std/container/unordered_map.h" #include "base/std/container/vector.h" namespace cc { @@ -288,7 +288,7 @@ private: // update specific // Used for "selectors with interval" - std::unordered_map _hashForTimers; + ccstd::unordered_map _hashForTimers; struct HashTimerEntry * _currentTarget = nullptr; bool _currentTargetSalvaged = false; // If true unschedule will not remove anything from a hash. Elements will only be marked for deletion. diff --git a/native/cocos/base/TypeDef.h b/native/cocos/base/TypeDef.h index b4e9a27100..2eafbd20d5 100644 --- a/native/cocos/base/TypeDef.h +++ b/native/cocos/base/TypeDef.h @@ -26,8 +26,8 @@ #pragma once #include -#include #include "base/Macros.h" +#include "base/std/container/unordered_map.h" using uint = std::uint32_t; using ushort = std::uint16_t; @@ -40,7 +40,7 @@ using FlagBits = std::uint32_t; using index_t = int32_t; #define CC_INVALID_INDEX (-1) -#define Record std::unordered_map // NOLINT(readability-identifier-naming) +#define Record ccstd::unordered_map // NOLINT(readability-identifier-naming) #define CC_ENUM_CONVERSION_OPERATOR(T) \ inline std::underlying_type::type toNumber(const T v) { return static_cast::type>(v); } diff --git a/native/cocos/base/Value.h b/native/cocos/base/Value.h index 6ad6ac33b8..1680fba1dc 100644 --- a/native/cocos/base/Value.h +++ b/native/cocos/base/Value.h @@ -28,6 +28,7 @@ #include "base/Macros.h" #include "base/memory/StlAlloc.h" +#include "base/std/container/unordered_map.h" #include "base/std/container/vector.h" namespace cc { @@ -35,8 +36,8 @@ namespace cc { class Value; using ValueVector = ccstd::vector; -using ValueMap = unordered_map; -using ValueMapIntKey = unordered_map; +using ValueMap = ccstd::unordered_map; +using ValueMapIntKey = ccstd::unordered_map; CC_DLL extern const ValueVector VALUE_VECTOR_NULL; CC_DLL extern const ValueMap VALUE_MAP_NULL; diff --git a/native/cocos/base/ZipUtils.cpp b/native/cocos/base/ZipUtils.cpp index b9476c2e90..a1cf317614 100644 --- a/native/cocos/base/ZipUtils.cpp +++ b/native/cocos/base/ZipUtils.cpp @@ -460,8 +460,8 @@ public: Locked zipFile; std::unique_ptr memfs; - // std::unordered_map is faster if available on the platform - using FileListContainer = std::unordered_map; + // ccstd::unordered_map is faster if available on the platform + using FileListContainer = ccstd::unordered_map; FileListContainer fileList; }; diff --git a/native/cocos/base/memory/MemoryHook.h b/native/cocos/base/memory/MemoryHook.h index bce4b507f7..8bf8d3317a 100644 --- a/native/cocos/base/memory/MemoryHook.h +++ b/native/cocos/base/memory/MemoryHook.h @@ -30,9 +30,9 @@ #include "../Macros.h" #include "CallStack.h" + #include "base/std/container/unordered_map.h" #include - #include typedef void *(*MallocType)(size_t size); typedef void (*FreeType)(void *ptr); @@ -56,7 +56,7 @@ public: /** * RecordMap's key is memory address. */ - using RecordMap = std::unordered_map; + using RecordMap = ccstd::unordered_map; void addRecord(uint64_t address, size_t size); void removeRecord(uint64_t address); diff --git a/native/cocos/base/memory/StlAlloc.h b/native/cocos/base/memory/StlAlloc.h index 39bbeceeca..d1c20e9f75 100644 --- a/native/cocos/base/memory/StlAlloc.h +++ b/native/cocos/base/memory/StlAlloc.h @@ -27,16 +27,10 @@ THE SOFTWARE. #pragma once #include -#include +#include namespace cc { -template , typename P = std::equal_to> -using unordered_map = std::unordered_map; - -template , typename P = std::equal_to> -using unordered_multimap = std::unordered_multimap; - using String = std::string; using WString = std::wstring; using StringArray = std::vector; diff --git a/native/cocos/base/std/container/map.h b/native/cocos/base/std/container/map.h index fffaffc912..b76be537e8 100644 --- a/native/cocos/base/std/container/map.h +++ b/native/cocos/base/std/container/map.h @@ -26,16 +26,14 @@ #pragma once #include +#include #include "boost/container/pmr/polymorphic_allocator.hpp" namespace ccstd { using std::map; namespace pmr { -template < - class Key, - class T, - class Compare = std::less> -using map = std::map>; +template > +using map = std::map>>; } } // namespace ccstd diff --git a/native/cocos/base/std/container/unordered_map.h b/native/cocos/base/std/container/unordered_map.h new file mode 100644 index 0000000000..4d802b23f4 --- /dev/null +++ b/native/cocos/base/std/container/unordered_map.h @@ -0,0 +1,44 @@ +/**************************************************************************** + Copyright (c) 2022 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + +#pragma once + +#include +#include +#include "boost/container/pmr/polymorphic_allocator.hpp" + +namespace ccstd { +using std::unordered_map; + +namespace pmr { +template < +class Key, +class T, +class Hash = std::hash, +class Pred = std::equal_to> +using unordered_map = std::unordered_map>>; +} +} // namespace ccstd + diff --git a/native/cocos/bindings/event/EventDispatcher.cpp b/native/cocos/bindings/event/EventDispatcher.cpp index a19f7422ea..011781ba78 100644 --- a/native/cocos/bindings/event/EventDispatcher.cpp +++ b/native/cocos/bindings/event/EventDispatcher.cpp @@ -44,7 +44,7 @@ bool inited = false; namespace cc { -std::unordered_map EventDispatcher::listeners; +ccstd::unordered_map EventDispatcher::listeners; uint32_t EventDispatcher::hashListenerId = 1; bool EventDispatcher::initialized() { diff --git a/native/cocos/bindings/event/EventDispatcher.h b/native/cocos/bindings/event/EventDispatcher.h index cc315574d1..b1d55fd489 100644 --- a/native/cocos/bindings/event/EventDispatcher.h +++ b/native/cocos/bindings/event/EventDispatcher.h @@ -27,7 +27,7 @@ #include #include -#include +#include "base/std/container/unordered_map.h" #include "base/std/container/vector.h" namespace se { @@ -300,7 +300,7 @@ private: uint32_t listenerID; struct Node * next = nullptr; }; - static std::unordered_map listeners; + static ccstd::unordered_map listeners; static uint32_t hashListenerId; //simple increment hash }; diff --git a/native/cocos/bindings/jswrapper/MappingUtils.h b/native/cocos/bindings/jswrapper/MappingUtils.h index 79f91552f4..163971dab5 100644 --- a/native/cocos/bindings/jswrapper/MappingUtils.h +++ b/native/cocos/bindings/jswrapper/MappingUtils.h @@ -26,7 +26,7 @@ #pragma once -#include +#include "base/std/container/unordered_map.h" namespace se { @@ -35,7 +35,7 @@ class Object; class NativePtrToObjectMap { public: // key: native ptr, value: se::Object - using Map = std::unordered_map; + using Map = ccstd::unordered_map; static bool init(); static void destroy(); diff --git a/native/cocos/bindings/jswrapper/jsc/Base.h b/native/cocos/bindings/jswrapper/jsc/Base.h index dd3142d638..f4e8840655 100644 --- a/native/cocos/bindings/jswrapper/jsc/Base.h +++ b/native/cocos/bindings/jswrapper/jsc/Base.h @@ -31,7 +31,7 @@ #include #include #include -#include +#include "base/std/container/unordered_map.h" #include #include diff --git a/native/cocos/bindings/jswrapper/jsc/Class.cpp b/native/cocos/bindings/jswrapper/jsc/Class.cpp index 54e843b9e3..38ea3e4ab8 100644 --- a/native/cocos/bindings/jswrapper/jsc/Class.cpp +++ b/native/cocos/bindings/jswrapper/jsc/Class.cpp @@ -43,7 +43,7 @@ namespace se { #define JS_PS_END JS_PSGS(0, 0, 0, 0) namespace { -// std::unordered_map __clsMap; +// ccstd::unordered_map __clsMap; JSContextRef __cx = nullptr; ccstd::vector __allClasses; diff --git a/native/cocos/bindings/jswrapper/jsc/Object.h b/native/cocos/bindings/jswrapper/jsc/Object.h index f27882ec72..dba9fd2e40 100644 --- a/native/cocos/bindings/jswrapper/jsc/Object.h +++ b/native/cocos/bindings/jswrapper/jsc/Object.h @@ -252,7 +252,7 @@ public: /** * @brief Sets a pointer to private data on an object. * @param[in] data A void* to set as the object's private data. - * @note This method will associate private data with se::Object by std::unordered_map::emplace. + * @note This method will associate private data with se::Object by ccstd::unordered_map::emplace. * It's used for search a se::Object via a void* private data. */ void setPrivateData(void *data); diff --git a/native/cocos/bindings/jswrapper/v8/Base.h b/native/cocos/bindings/jswrapper/v8/Base.h index 002a58da0c..61fbdf0c59 100644 --- a/native/cocos/bindings/jswrapper/v8/Base.h +++ b/native/cocos/bindings/jswrapper/v8/Base.h @@ -40,7 +40,7 @@ #include #include #include -#include +#include "base/std/container/unordered_map.h" #include "../PrivateObject.h" #include "HelperMacros.h" diff --git a/native/cocos/bindings/jswrapper/v8/Class.cpp b/native/cocos/bindings/jswrapper/v8/Class.cpp index aad5d6d7a9..3baa90263e 100644 --- a/native/cocos/bindings/jswrapper/v8/Class.cpp +++ b/native/cocos/bindings/jswrapper/v8/Class.cpp @@ -40,7 +40,7 @@ namespace se { // ------------------------------------------------------- Object namespace { -// std::unordered_map __clsMap; +// ccstd::unordered_map __clsMap; v8::Isolate * __isolate = nullptr; // NOLINT ccstd::vector __allClasses; // NOLINT diff --git a/native/cocos/bindings/jswrapper/v8/Object.cpp b/native/cocos/bindings/jswrapper/v8/Object.cpp index 80d365a145..51cf3240db 100644 --- a/native/cocos/bindings/jswrapper/v8/Object.cpp +++ b/native/cocos/bindings/jswrapper/v8/Object.cpp @@ -28,6 +28,7 @@ #include "v8/HelperMacros.h" #if SCRIPT_ENGINE_TYPE == SCRIPT_ENGINE_V8 + #include "base/std/container/unordered_map.h" #include "../MappingUtils.h" #include "Class.h" #include "ScriptEngine.h" @@ -36,13 +37,12 @@ #include #include #include - #include #define JSB_FUNC_DEFAULT_MAX_ARG_COUNT (10) namespace se { //NOLINTNEXTLINE -std::unique_ptr> __objectMap; // Currently, the value `void*` is always nullptr +std::unique_ptr> __objectMap; // Currently, the value `void*` is always nullptr namespace { v8::Isolate *__isolate = nullptr; //NOLINT @@ -99,7 +99,7 @@ void Object::setIsolate(v8::Isolate *isolate) { } void Object::setup() { - __objectMap = std::make_unique>(); + __objectMap = std::make_unique>(); } void Object::cleanup() { diff --git a/native/cocos/bindings/jswrapper/v8/Object.h b/native/cocos/bindings/jswrapper/v8/Object.h index 979245e2ca..f1b889df5c 100644 --- a/native/cocos/bindings/jswrapper/v8/Object.h +++ b/native/cocos/bindings/jswrapper/v8/Object.h @@ -310,7 +310,7 @@ public: /** * @brief Sets a pointer to private data on an object. * @param[in] data A void* to set as the object's private data. - * @note This method will associate private data with se::Object by std::unordered_map::emplace. + * @note This method will associate private data with se::Object by ccstd::unordered_map::emplace. * It's used for search a se::Object via a void* private data. */ template @@ -472,7 +472,7 @@ private: friend class ScriptEngine; }; // NOLINTNEXTLINE -extern std::unique_ptr> __objectMap; // Currently, the value `void*` is always nullptr +extern std::unique_ptr> __objectMap; // Currently, the value `void*` is always nullptr } // namespace se diff --git a/native/cocos/bindings/jswrapper/v8/ScriptEngine.h b/native/cocos/bindings/jswrapper/v8/ScriptEngine.h index 0eeb159319..25525a658a 100644 --- a/native/cocos/bindings/jswrapper/v8/ScriptEngine.h +++ b/native/cocos/bindings/jswrapper/v8/ScriptEngine.h @@ -335,7 +335,7 @@ public: void clear(); private: - std::unordered_map *> _vmStringPoolMap; + ccstd::unordered_map *> _vmStringPoolMap; }; inline VMStringPool & _getStringPool() { return _stringPool; } // NOLINT(readability-identifier-naming) diff --git a/native/cocos/bindings/manual/jsb_classtype.cpp b/native/cocos/bindings/manual/jsb_classtype.cpp index 9614b1a0e9..4a94ca60bb 100644 --- a/native/cocos/bindings/manual/jsb_classtype.cpp +++ b/native/cocos/bindings/manual/jsb_classtype.cpp @@ -25,4 +25,4 @@ #include "jsb_classtype.h" -std::unordered_map JSBClassType::jsbClassTypeMap; +ccstd::unordered_map JSBClassType::jsbClassTypeMap; diff --git a/native/cocos/bindings/manual/jsb_classtype.h b/native/cocos/bindings/manual/jsb_classtype.h index 412a7eba86..580e13f695 100644 --- a/native/cocos/bindings/manual/jsb_classtype.h +++ b/native/cocos/bindings/manual/jsb_classtype.h @@ -60,5 +60,5 @@ public: } private: - static std::unordered_map jsbClassTypeMap; + static ccstd::unordered_map jsbClassTypeMap; }; diff --git a/native/cocos/bindings/manual/jsb_conversions.h b/native/cocos/bindings/manual/jsb_conversions.h index ca55421d7e..b5d5b75493 100644 --- a/native/cocos/bindings/manual/jsb_conversions.h +++ b/native/cocos/bindings/manual/jsb_conversions.h @@ -705,9 +705,9 @@ bool sevalue_to_native(const se::Value &from, cc::variant *to, se::Obje template bool sevalue_to_native(const se::Value &from, cc::optional *to, se::Object *ctx); // NOLINT(readability-identifier-naming) -/// std::unordered_map +/// ccstd::unordered_map template -bool sevalue_to_native(const se::Value &from, std::unordered_map *to, se::Object *ctx); //NOLINT(readability-identifier-naming) +bool sevalue_to_native(const se::Value &from, ccstd::unordered_map *to, se::Object *ctx); //NOLINT(readability-identifier-naming) // std::tuple template bool sevalue_to_native(const se::Value &from, std::tuple *to, se::Object *ctx); // NOLINT(readability-identifier-naming) @@ -1105,9 +1105,9 @@ bool sevalue_to_native(const se::Value &from, std::tuple *to, se::Objec return result; } -////////////// std::unordered_map +////////////// ccstd::unordered_map template -bool sevalue_to_native(const se::Value &from, std::unordered_map *to, se::Object *ctx) { //NOLINT +bool sevalue_to_native(const se::Value &from, ccstd::unordered_map *to, se::Object *ctx) { //NOLINT se::Object * jsmap = from.toObject(); ccstd::vector allKeys; jsmap->getAllKeys(&allKeys); @@ -1231,7 +1231,7 @@ template inline bool nativevalue_to_se(const ccstd::vector &from, se::Value &to, se::Object *ctx); // NOLINT template -inline bool nativevalue_to_se(const std::unordered_map &from, se::Value &to, se::Object *ctx); // NOLINT +inline bool nativevalue_to_se(const ccstd::unordered_map &from, se::Value &to, se::Object *ctx); // NOLINT template inline bool nativevalue_to_se(const cc::TypedArrayTemp &typedArray, se::Value &to, se::Object *ctx); // NOLINT @@ -1283,7 +1283,7 @@ typename std::enable_if::value, void>::type } template -inline bool nativevalue_to_se(const std::unordered_map &from, se::Value &to, se::Object *ctx) { // NOLINT +inline bool nativevalue_to_se(const ccstd::unordered_map &from, se::Value &to, se::Object *ctx) { // NOLINT se::Object *ret = se::Object::createPlainObject(); se::Value value; bool ok = true; diff --git a/native/cocos/bindings/manual/jsb_conversions_spec.cpp b/native/cocos/bindings/manual/jsb_conversions_spec.cpp index fb01df1a44..440c6c5940 100644 --- a/native/cocos/bindings/manual/jsb_conversions_spec.cpp +++ b/native/cocos/bindings/manual/jsb_conversions_spec.cpp @@ -1448,7 +1448,7 @@ bool nativevalue_to_se(const cc::Value &from, se::Value &to, se::Object * /*unus } // NOLINTNEXTLINE(readability-identifier-naming) -bool nativevalue_to_se(const std::unordered_map &from, se::Value &to, se::Object * /*unused*/) { +bool nativevalue_to_se(const ccstd::unordered_map &from, se::Value &to, se::Object * /*unused*/) { return ccvaluemap_to_seval(from, &to); } diff --git a/native/cocos/bindings/manual/jsb_conversions_spec.h b/native/cocos/bindings/manual/jsb_conversions_spec.h index 056e5e86b4..5437df58d9 100644 --- a/native/cocos/bindings/manual/jsb_conversions_spec.h +++ b/native/cocos/bindings/manual/jsb_conversions_spec.h @@ -21,7 +21,7 @@ #pragma once -#include +#include "base/std/container/unordered_map.h" #include "base/Ptr.h" #include "base/Value.h" #include "bindings/jswrapper/SeApi.h" @@ -473,7 +473,7 @@ bool nativevalue_to_se(const cc::Data &from, se::Value &to, se::Object *ctx); // bool nativevalue_to_se(const cc::Value &from, se::Value &to, se::Object *ctx); // NOLINT(readability-identifier-naming) -bool nativevalue_to_se(const std::unordered_map &from, se::Value &to, se::Object *ctx); // NOLINT(readability-identifier-naming) +bool nativevalue_to_se(const ccstd::unordered_map &from, se::Value &to, se::Object *ctx); // NOLINT(readability-identifier-naming) bool nativevalue_to_se(const cc::Vec2 &from, se::Value &to, se::Object *ctx); // NOLINT(readability-identifier-naming) diff --git a/native/cocos/bindings/manual/jsb_global.cpp b/native/cocos/bindings/manual/jsb_global.cpp index 353b7995ee..bed5c2a057 100644 --- a/native/cocos/bindings/manual/jsb_global.cpp +++ b/native/cocos/bindings/manual/jsb_global.cpp @@ -121,7 +121,7 @@ bool jsb_set_extend_property(const char *ns, const char *clsName) { //NOLINT namespace { -std::unordered_map gModuleCache; +ccstd::unordered_map gModuleCache; static bool require(se::State &s) { //NOLINT const auto &args = s.args(); diff --git a/native/cocos/bindings/manual/jsb_platform.h b/native/cocos/bindings/manual/jsb_platform.h index 420472c8e3..eddd3051fc 100644 --- a/native/cocos/bindings/manual/jsb_platform.h +++ b/native/cocos/bindings/manual/jsb_platform.h @@ -25,11 +25,11 @@ #pragma once #include -#include +#include "base/std/container/unordered_map.h" namespace se { class Object; } bool register_platform_bindings(se::Object *obj); // NOLINT[readability-identifier-naming] -const std::unordered_map &getFontFamilyNameMap(); +const ccstd::unordered_map &getFontFamilyNameMap(); diff --git a/native/cocos/bindings/manual/jsb_platform_android.cpp b/native/cocos/bindings/manual/jsb_platform_android.cpp index 34aaf6b5ae..c31f74992b 100644 --- a/native/cocos/bindings/manual/jsb_platform_android.cpp +++ b/native/cocos/bindings/manual/jsb_platform_android.cpp @@ -39,9 +39,9 @@ using namespace cc; -static std::unordered_map _fontFamilyNameMap; +static ccstd::unordered_map _fontFamilyNameMap; -const std::unordered_map &getFontFamilyNameMap() { +const ccstd::unordered_map &getFontFamilyNameMap() { return _fontFamilyNameMap; } diff --git a/native/cocos/bindings/manual/jsb_platform_ohos.cpp b/native/cocos/bindings/manual/jsb_platform_ohos.cpp index a187848503..cf9f3e10a7 100644 --- a/native/cocos/bindings/manual/jsb_platform_ohos.cpp +++ b/native/cocos/bindings/manual/jsb_platform_ohos.cpp @@ -39,9 +39,9 @@ using namespace cc; //NOLINT -static std::unordered_map gFontFamilyNameMap; +static ccstd::unordered_map gFontFamilyNameMap; -const std::unordered_map &getFontFamilyNameMap() { +const ccstd::unordered_map &getFontFamilyNameMap() { return gFontFamilyNameMap; } diff --git a/native/cocos/bindings/manual/jsb_platfrom_apple.mm b/native/cocos/bindings/manual/jsb_platfrom_apple.mm index b9b357abce..98649f06e5 100644 --- a/native/cocos/bindings/manual/jsb_platfrom_apple.mm +++ b/native/cocos/bindings/manual/jsb_platfrom_apple.mm @@ -36,9 +36,9 @@ using namespace cc; -static std::unordered_map _fontFamilyNameMap; +static ccstd::unordered_map _fontFamilyNameMap; -const std::unordered_map &getFontFamilyNameMap() { +const ccstd::unordered_map &getFontFamilyNameMap() { return _fontFamilyNameMap; } diff --git a/native/cocos/bindings/manual/jsb_platfrom_linux.cpp b/native/cocos/bindings/manual/jsb_platfrom_linux.cpp index 36b12b7a92..6daff3c98f 100644 --- a/native/cocos/bindings/manual/jsb_platfrom_linux.cpp +++ b/native/cocos/bindings/manual/jsb_platfrom_linux.cpp @@ -34,9 +34,9 @@ using namespace cc; -static std::unordered_map _fontFamilyNameMap; +static ccstd::unordered_map _fontFamilyNameMap; -const std::unordered_map &getFontFamilyNameMap() { +const ccstd::unordered_map &getFontFamilyNameMap() { return _fontFamilyNameMap; } diff --git a/native/cocos/bindings/manual/jsb_platfrom_qnx.cpp b/native/cocos/bindings/manual/jsb_platfrom_qnx.cpp index 1ef7164534..93e6199d4b 100644 --- a/native/cocos/bindings/manual/jsb_platfrom_qnx.cpp +++ b/native/cocos/bindings/manual/jsb_platfrom_qnx.cpp @@ -34,9 +34,9 @@ using namespace cc; -static std::unordered_map _fontFamilyNameMap; +static ccstd::unordered_map _fontFamilyNameMap; -const std::unordered_map &getFontFamilyNameMap() { +const ccstd::unordered_map &getFontFamilyNameMap() { return _fontFamilyNameMap; } diff --git a/native/cocos/bindings/manual/jsb_platfrom_win32.cpp b/native/cocos/bindings/manual/jsb_platfrom_win32.cpp index e53fe75519..6f6800a72c 100644 --- a/native/cocos/bindings/manual/jsb_platfrom_win32.cpp +++ b/native/cocos/bindings/manual/jsb_platfrom_win32.cpp @@ -34,9 +34,9 @@ using namespace cc; -static std::unordered_map _fontFamilyNameMap; +static ccstd::unordered_map _fontFamilyNameMap; -const std::unordered_map &getFontFamilyNameMap() { +const ccstd::unordered_map &getFontFamilyNameMap() { return _fontFamilyNameMap; } diff --git a/native/cocos/bindings/manual/jsb_socketio.cpp b/native/cocos/bindings/manual/jsb_socketio.cpp index de55d1eebd..7bb70a5de7 100644 --- a/native/cocos/bindings/manual/jsb_socketio.cpp +++ b/native/cocos/bindings/manual/jsb_socketio.cpp @@ -40,7 +40,7 @@ se::Class *__jsb_SocketIO_class = nullptr; // NOLINT class JSB_SocketIODelegate : public cc::RefCounted, public cc::network::SocketIO::SIODelegate { public: //c++11 map to callbacks - using JSB_SIOCallbackRegistry = std::unordered_map; + using JSB_SIOCallbackRegistry = ccstd::unordered_map; JSB_SocketIODelegate() = default; diff --git a/native/cocos/bindings/manual/jsb_xmlhttprequest.cpp b/native/cocos/bindings/manual/jsb_xmlhttprequest.cpp index 5678a8a0b1..379097cb38 100644 --- a/native/cocos/bindings/manual/jsb_xmlhttprequest.cpp +++ b/native/cocos/bindings/manual/jsb_xmlhttprequest.cpp @@ -35,7 +35,7 @@ #include #include #include -#include +#include "base/std/container/unordered_map.h" #include "base/Config.h" #include "cocos/base/Data.h" #include "cocos/base/DeferredReleasePool.h" @@ -50,7 +50,7 @@ using namespace cc::network; //NOLINT namespace { // NOLINTNEXTLINE(readability-identifier-naming) -std::unordered_map _httpStatusCodeMap = { +ccstd::unordered_map _httpStatusCodeMap = { {100, "Continue"}, {101, "Switching Protocols"}, {102, "Processing"}, @@ -183,8 +183,8 @@ private: void sendRequest(); void setHttpRequestHeader(); - std::unordered_map _httpHeader; - std::unordered_map _requestHeader; + ccstd::unordered_map _httpHeader; + ccstd::unordered_map _requestHeader; std::string _url; std::string _method; diff --git a/native/cocos/core/DataView.cpp b/native/cocos/core/DataView.cpp index 5f59ee831c..bbd2da5025 100644 --- a/native/cocos/core/DataView.cpp +++ b/native/cocos/core/DataView.cpp @@ -30,7 +30,7 @@ namespace cc { #include "base/Macros.h" #include "core/ArrayBuffer.h" -std::unordered_map DataView::intReaderMap{ +ccstd::unordered_map DataView::intReaderMap{ {"getUint8", &DataView::getUint8}, {"getUint16", &DataView::getUint16}, {"getUint32", &DataView::getUint32}, @@ -39,7 +39,7 @@ std::unordered_map DataView::intReaderMap{ {"getInt32", &DataView::getInt32}, }; -std::unordered_map DataView::intWritterMap{ +ccstd::unordered_map DataView::intWritterMap{ {"setUint8", reinterpret_cast(&DataView::setUint8)}, {"setUint16", reinterpret_cast(&DataView::setUint16)}, {"setUint32", reinterpret_cast(&DataView::setUint32)}, diff --git a/native/cocos/core/DataView.h b/native/cocos/core/DataView.h index 71e0dd051a..35647a3aef 100644 --- a/native/cocos/core/DataView.h +++ b/native/cocos/core/DataView.h @@ -74,11 +74,11 @@ public: using Int8Reader = int8_t (DataView::*)(uint32_t) const; using UInt8Reader = uint8_t (DataView::*)(uint32_t) const; using ReaderVariant = cc::variant; - static std::unordered_map intReaderMap; + static ccstd::unordered_map intReaderMap; int32_t readInt(ReaderVariant &readerVariant, uint32_t offset); using IntWritter = void (DataView::*)(uint32_t, uint32_t); - static std::unordered_map intWritterMap; + static ccstd::unordered_map intWritterMap; private: ArrayBuffer::Ptr _buffer; diff --git a/native/cocos/core/Types.h b/native/cocos/core/Types.h index dde4de04c7..c2f48eef0f 100644 --- a/native/cocos/core/Types.h +++ b/native/cocos/core/Types.h @@ -26,7 +26,7 @@ #pragma once #include -#include +#include "base/std/container/unordered_map.h" #include #include "cocos/base/Optional.h" diff --git a/native/cocos/core/animation/SkeletalAnimationUtils.cpp b/native/cocos/core/animation/SkeletalAnimationUtils.cpp index fbc15aa878..ce254f5f42 100644 --- a/native/cocos/core/animation/SkeletalAnimationUtils.cpp +++ b/native/cocos/core/animation/SkeletalAnimationUtils.cpp @@ -30,7 +30,7 @@ namespace cc { namespace { ccstd::vector stack; //cjh TODO: how to release ? -std::unordered_map pool; +ccstd::unordered_map pool; } // namespace Mat4 getWorldMatrix(IJointTransform *transform, int32_t stamp) { diff --git a/native/cocos/core/assets/EffectAsset.h b/native/cocos/core/assets/EffectAsset.h index c1d22cc9f2..228f864060 100644 --- a/native/cocos/core/assets/EffectAsset.h +++ b/native/cocos/core/assets/EffectAsset.h @@ -27,7 +27,7 @@ #include #include -#include +#include "base/std/container/unordered_map.h" #include "cocos/base/Optional.h" #include "base/Value.h" @@ -347,7 +347,7 @@ struct IPassStates { }; using PassOverrides = IPassStates; -using PassPropertyInfoMap = std::unordered_map; +using PassPropertyInfoMap = ccstd::unordered_map; struct IPassInfoFull final { //cjh } : public IPassInfo { // IPassStates @@ -483,7 +483,7 @@ struct IBuiltinInfo { ccstd::vector images; }; -using BuiltinsStatisticsType = std::unordered_map; +using BuiltinsStatisticsType = ccstd::unordered_map; struct IBuiltins { IBuiltinInfo globals; @@ -522,7 +522,7 @@ struct IShaderInfo { }; using IPreCompileInfoValueType = cc::variant, ccstd::vector, ccstd::vector>; -using IPreCompileInfo = std::unordered_map; +using IPreCompileInfo = ccstd::unordered_map; class EffectAsset final : public Asset { public: @@ -549,7 +549,7 @@ public: */ static EffectAsset *get(const std::string &name); - using RegisteredEffectAssetMap = std::unordered_map>; + using RegisteredEffectAssetMap = ccstd::unordered_map>; /** * @en Get all registered effect assets. * @zh 获取所有已注册的 effect 资源。 diff --git a/native/cocos/core/assets/Font.h b/native/cocos/core/assets/Font.h index bbb880fc63..a5980b7536 100644 --- a/native/cocos/core/assets/Font.h +++ b/native/cocos/core/assets/Font.h @@ -24,7 +24,7 @@ ****************************************************************************/ #pragma once -#include +#include "base/std/container/unordered_map.h" #include "base/std/container/vector.h" #include "core/assets/Asset.h" @@ -119,8 +119,8 @@ protected: Font * _font{nullptr}; uint32_t _fontSize{1U}; uint32_t _lineHeight{0U}; - std::unordered_map _glyphs; - std::unordered_map _kernings; + ccstd::unordered_map _glyphs; + ccstd::unordered_map _kernings; ccstd::vector _textures; uint32_t _textureWidth{0U}; uint32_t _textureHeight{0U}; @@ -152,7 +152,7 @@ protected: FontType _type{FontType::INVALID}; std::string _path; ccstd::vector _data; - std::unordered_map _faces; + ccstd::unordered_map _faces; }; } // namespace cc diff --git a/native/cocos/core/assets/Material.h b/native/cocos/core/assets/Material.h index c20d53363b..498495a3d3 100644 --- a/native/cocos/core/assets/Material.h +++ b/native/cocos/core/assets/Material.h @@ -26,7 +26,7 @@ #pragma once #include -#include +#include "base/std/container/unordered_map.h" #include "base/Ptr.h" #include "cocos/base/Optional.h" #include "cocos/base/Variant.h" diff --git a/native/cocos/core/builtin/DebugInfos.cpp b/native/cocos/core/builtin/DebugInfos.cpp index 01a22f3957..c237a2b6ac 100644 --- a/native/cocos/core/builtin/DebugInfos.cpp +++ b/native/cocos/core/builtin/DebugInfos.cpp @@ -28,7 +28,7 @@ namespace cc { -std::unordered_map debugInfos = { +ccstd::unordered_map debugInfos = { { 0100, "%s not yet implemented." }, { 0200, "You should specify a valid DOM canvas element." }, { 1006, "[Action step]. override me" }, diff --git a/native/cocos/core/builtin/DebugInfos.cpp.in b/native/cocos/core/builtin/DebugInfos.cpp.in index 7d2dfd26bc..38642efb87 100644 --- a/native/cocos/core/builtin/DebugInfos.cpp.in +++ b/native/cocos/core/builtin/DebugInfos.cpp.in @@ -28,7 +28,7 @@ namespace cc { -std::unordered_map debugInfos = { +ccstd::unordered_map debugInfos = { ${PLACE_HOLDER} }; }//namespace cc diff --git a/native/cocos/core/builtin/DebugInfos.h b/native/cocos/core/builtin/DebugInfos.h index ae9bfb56a3..4871ecfca6 100644 --- a/native/cocos/core/builtin/DebugInfos.h +++ b/native/cocos/core/builtin/DebugInfos.h @@ -25,11 +25,11 @@ #pragma once -#include +#include "base/std/container/unordered_map.h" #include namespace cc { -extern std::unordered_map debugInfos; +extern ccstd::unordered_map debugInfos; } diff --git a/native/cocos/core/builtin/ShaderSourceAssembly.h b/native/cocos/core/builtin/ShaderSourceAssembly.h index 44723b88c2..75cc7a3977 100644 --- a/native/cocos/core/builtin/ShaderSourceAssembly.h +++ b/native/cocos/core/builtin/ShaderSourceAssembly.h @@ -26,14 +26,14 @@ #pragma once #include -#include +#include "base/std/container/unordered_map.h" #include "base/StringUtil.h" #include "base/std/container/vector.h" namespace cc { -using ShaderInfo = std::unordered_map; +using ShaderInfo = ccstd::unordered_map; using ShaderSource = ccstd::vector>; -using ShaderSourceMap = std::unordered_map; +using ShaderSourceMap = ccstd::unordered_map; class ShaderSourceAssembly final { public: diff --git a/native/cocos/core/event/CallbacksInvoker.h b/native/cocos/core/event/CallbacksInvoker.h index 4810d466b3..24429ee7b2 100644 --- a/native/cocos/core/event/CallbacksInvoker.h +++ b/native/cocos/core/event/CallbacksInvoker.h @@ -28,7 +28,7 @@ #include #include #include -#include +#include "base/std/container/unordered_map.h" #include "base/Log.h" #include "base/Macros.h" @@ -285,7 +285,7 @@ public: } private: - std::unordered_map _callbackTable; + ccstd::unordered_map _callbackTable; static CallbackInfoBase::ID cbIDCounter; }; diff --git a/native/cocos/network/Downloader-curl.cpp b/native/cocos/network/Downloader-curl.cpp index 42c5b4c644..6c4201bd1e 100644 --- a/native/cocos/network/Downloader-curl.cpp +++ b/native/cocos/network/Downloader-curl.cpp @@ -415,7 +415,7 @@ private: uint32_t countOfMaxProcessingTasks = this->hints.countOfMaxProcessingTasks; // init curl content CURLM * curlmHandle = curl_multi_init(); - unordered_map coTaskMap; + ccstd::unordered_map coTaskMap; int runningHandles = 0; CURLMcode mcode = CURLM_OK; int rc = 0; // select return code diff --git a/native/cocos/network/Downloader-java.cpp b/native/cocos/network/Downloader-java.cpp index cfc6499534..352eecb9ff 100644 --- a/native/cocos/network/Downloader-java.cpp +++ b/native/cocos/network/Downloader-java.cpp @@ -43,7 +43,7 @@ #endif #define JNI_DOWNLOADER(FUNC) JNI_METHOD1(ORG_DOWNLOADER_CLASS_NAME, FUNC) -std::unordered_map sDownloaderMap; +ccstd::unordered_map sDownloaderMap; std::mutex sDownloaderMutex; static void insertDownloaderJava(int id, cc::network::DownloaderJava *downloaderPtr) { diff --git a/native/cocos/network/Downloader-java.h b/native/cocos/network/Downloader-java.h index 8c9e2613f3..1bd9208500 100644 --- a/native/cocos/network/Downloader-java.h +++ b/native/cocos/network/Downloader-java.h @@ -51,7 +51,7 @@ public: protected: int _id; _jobject * _impl; - std::unordered_map _taskMap; + ccstd::unordered_map _taskMap; }; } // namespace network } // namespace cc diff --git a/native/cocos/network/DownloaderImpl.h b/native/cocos/network/DownloaderImpl.h index 0b3ba3833c..f8dc0f532d 100644 --- a/native/cocos/network/DownloaderImpl.h +++ b/native/cocos/network/DownloaderImpl.h @@ -29,7 +29,7 @@ #include #include #include -#include +#include "base/std/container/unordered_map.h" #include "base/Macros.h" #include "base/std/container/vector.h" diff --git a/native/cocos/network/SocketIO.h b/native/cocos/network/SocketIO.h index 0f266d0ca3..9406bc807a 100644 --- a/native/cocos/network/SocketIO.h +++ b/native/cocos/network/SocketIO.h @@ -29,7 +29,7 @@ #include #include -#include +#include "base/std/container/unordered_map.h" #include "base/Macros.h" #include "base/RefMap.h" @@ -158,7 +158,7 @@ private: //c++11 style callbacks entities will be created using CC_CALLBACK (which uses std::bind) using SIOEvent = std::function; //c++11 map to callbacks -using EventRegistry = std::unordered_map; +using EventRegistry = ccstd::unordered_map; /** * A single connection to a socket.io endpoint. diff --git a/native/cocos/network/WebSocketServer.h b/native/cocos/network/WebSocketServer.h index 06aae65343..0705852785 100644 --- a/native/cocos/network/WebSocketServer.h +++ b/native/cocos/network/WebSocketServer.h @@ -41,7 +41,7 @@ #include #include #include - #include + #include "base/std/container/unordered_map.h" #if CC_PLATFORM == CC_PLATFORM_OHOS #include "libwebsockets.h" @@ -271,7 +271,7 @@ private: uv_async_t _async = {0}; mutable std::mutex _connsMtx; - std::unordered_map> _conns; + ccstd::unordered_map> _conns; // Attention: do not reference **this** in callbacks std::function _onlistening; diff --git a/native/cocos/physics/physx/PhysXUtils.h b/native/cocos/physics/physx/PhysXUtils.h index b2a043c655..203951c2fa 100644 --- a/native/cocos/physics/physx/PhysXUtils.h +++ b/native/cocos/physics/physx/PhysXUtils.h @@ -25,7 +25,7 @@ #pragma once -#include +#include "base/std/container/unordered_map.h" #include "base/Macros.h" #include "base/std/container/vector.h" #include "math/Vec3.h" @@ -124,13 +124,13 @@ inline T pxAbsMax(const T &a, const T &b) { void pxSetFromTwoVectors(physx::PxQuat &out, const physx::PxVec3 &a, const physx::PxVec3 &b); -inline std::unordered_map &getPxShapeMap() { - static std::unordered_map m; +inline ccstd::unordered_map &getPxShapeMap() { + static ccstd::unordered_map m; return m; } -inline std::unordered_map &getPxMaterialMap() { - static std::unordered_map m; +inline ccstd::unordered_map &getPxMaterialMap() { + static ccstd::unordered_map m; return m; } diff --git a/native/cocos/physics/physx/shapes/PhysXShape.cpp b/native/cocos/physics/physx/shapes/PhysXShape.cpp index 39bb2e9cc5..3104ae32f1 100644 --- a/native/cocos/physics/physx/shapes/PhysXShape.cpp +++ b/native/cocos/physics/physx/shapes/PhysXShape.cpp @@ -24,7 +24,7 @@ ****************************************************************************/ #include "physics/physx/shapes/PhysXShape.h" -#include +#include "base/std/container/unordered_map.h" #include "physics/physx/PhysXSharedBody.h" #include "physics/physx/PhysXUtils.h" #include "physics/physx/PhysXWorld.h" diff --git a/native/cocos/platform/FileUtils.h b/native/cocos/platform/FileUtils.h index a9c6a6391b..617c016555 100644 --- a/native/cocos/platform/FileUtils.h +++ b/native/cocos/platform/FileUtils.h @@ -27,7 +27,7 @@ #include #include -#include +#include "base/std/container/unordered_map.h" #include "base/Data.h" #include "base/Macros.h" #include "base/Value.h" @@ -542,7 +542,7 @@ public: virtual long getFileSize(const std::string &filepath); //NOLINT(google-runtime-int) /** Returns the full path cache. */ - const std::unordered_map &getFullPathCache() const { return _fullPathCache; } + const ccstd::unordered_map &getFullPathCache() const { return _fullPathCache; } static std::string normalizePath(const std::string &path); static std::string getFileDir(const std::string &path); @@ -622,7 +622,7 @@ protected: * The full path cache. When a file is found, it will be added into this cache. * This variable is used for improving the performance of file search. */ - mutable std::unordered_map _fullPathCache; + mutable ccstd::unordered_map _fullPathCache; /** * Writable path. diff --git a/native/cocos/platform/java/jni/JniCocosKeyCodeHandler.cpp b/native/cocos/platform/java/jni/JniCocosKeyCodeHandler.cpp index 05990710df..92b69278fc 100644 --- a/native/cocos/platform/java/jni/JniCocosKeyCodeHandler.cpp +++ b/native/cocos/platform/java/jni/JniCocosKeyCodeHandler.cpp @@ -40,7 +40,7 @@ struct cc::KeyboardEvent keyboardEvent; // key values in web, refer to http://docs.cocos.com/creator/api/en/enums/KEY.html #if CC_PLATFORM == CC_PLATFORM_ANDROID -std::unordered_map keyCodeMap = { +ccstd::unordered_map keyCodeMap = { {AKEYCODE_BACK, 6}, {AKEYCODE_ENTER, 13}, {AKEYCODE_MENU, 18}, @@ -50,7 +50,7 @@ std::unordered_map keyCodeMap = { {AKEYCODE_DPAD_RIGHT, 1001}, {AKEYCODE_DPAD_CENTER, 1005}}; #elif CC_PLATFORM == CC_PLATFORM_OHOS -std::unordered_map keyCodeMap = {}; +ccstd::unordered_map keyCodeMap = {}; #endif //NOLINTNEXTLINE void dispatchKeyCodeEvent(int keyCode, cc::KeyboardEvent &event) { diff --git a/native/cocos/platform/java/jni/JniHelper.cpp b/native/cocos/platform/java/jni/JniHelper.cpp index 6e4ad7eb64..5b436c2a8a 100644 --- a/native/cocos/platform/java/jni/JniHelper.cpp +++ b/native/cocos/platform/java/jni/JniHelper.cpp @@ -70,7 +70,7 @@ private: jclass _globalKls = {}; }; #if CC_CACHE_CLASS_ID -std::unordered_map _cachedJClasses; +ccstd::unordered_map _cachedJClasses; #endif }; // namespace diff --git a/native/cocos/platform/java/jni/JniHelper.h b/native/cocos/platform/java/jni/JniHelper.h index 62cd26bee3..ea75a8a6de 100644 --- a/native/cocos/platform/java/jni/JniHelper.h +++ b/native/cocos/platform/java/jni/JniHelper.h @@ -30,7 +30,7 @@ #include #include #include -#include +#include "base/std/container/unordered_map.h" #include "base/Log.h" #include "base/Macros.h" #include "base/std/container/vector.h" @@ -70,7 +70,7 @@ using JniMethodInfo = struct JniMethodInfo_ { //NOLINT(readability-identifier-na class CC_DLL JniHelper { public: - using LocalRefMapType = std::unordered_map>; + using LocalRefMapType = ccstd::unordered_map>; static JavaVM *getJavaVM(); static JNIEnv *getEnv(); diff --git a/native/cocos/platform/linux/LinuxPlatform.cpp b/native/cocos/platform/linux/LinuxPlatform.cpp index d75281b2b4..f62d5ed438 100644 --- a/native/cocos/platform/linux/LinuxPlatform.cpp +++ b/native/cocos/platform/linux/LinuxPlatform.cpp @@ -37,7 +37,7 @@ namespace { -std::unordered_map gKeyMap = { +ccstd::unordered_map gKeyMap = { {SDLK_APPLICATION, cc::KeyCode::CONTEXT_MENU}, {SDLK_SCROLLLOCK, cc::KeyCode::SCROLLLOCK}, {SDLK_PAUSE, cc::KeyCode::PAUSE}, @@ -114,7 +114,7 @@ int sdlKeycodeToCocosCode(int sdlCode, int mode) { } } -std::unordered_map gWindowFlagMap = { +ccstd::unordered_map gWindowFlagMap = { {cc::ISystemWindow::CC_WINDOW_FULLSCREEN, SDL_WINDOW_FULLSCREEN}, {cc::ISystemWindow::CC_WINDOW_OPENGL, SDL_WINDOW_OPENGL}, {cc::ISystemWindow::CC_WINDOW_SHOWN, SDL_WINDOW_SHOWN}, diff --git a/native/cocos/platform/mac/cocos2d-prefix.pch b/native/cocos/platform/mac/cocos2d-prefix.pch index ead8f13574..ca7360cb44 100644 --- a/native/cocos/platform/mac/cocos2d-prefix.pch +++ b/native/cocos/platform/mac/cocos2d-prefix.pch @@ -25,7 +25,7 @@ #include #include #include - #include + #include "base/std/container/unordered_map.h" #include #include #include diff --git a/native/cocos/platform/qnx/QNXPlatform.cpp b/native/cocos/platform/qnx/QNXPlatform.cpp index 1f3d4d2879..e51bdbed8e 100644 --- a/native/cocos/platform/qnx/QNXPlatform.cpp +++ b/native/cocos/platform/qnx/QNXPlatform.cpp @@ -38,7 +38,7 @@ namespace { -std::unordered_map gKeyMap = { +ccstd::unordered_map gKeyMap = { {SDLK_APPLICATION, cc::KeyCode::CONTEXT_MENU}, {SDLK_SCROLLLOCK, cc::KeyCode::SCROLLLOCK}, {SDLK_PAUSE, cc::KeyCode::PAUSE}, @@ -115,7 +115,7 @@ int sdlKeycodeToCocosCode(int sdlCode, int mode) { } } -std::unordered_map gWindowFlagMap = { +ccstd::unordered_map gWindowFlagMap = { {cc::ISystemWindow::CC_WINDOW_FULLSCREEN, SDL_WINDOW_FULLSCREEN}, {cc::ISystemWindow::CC_WINDOW_OPENGL, SDL_WINDOW_OPENGL}, {cc::ISystemWindow::CC_WINDOW_SHOWN, SDL_WINDOW_SHOWN}, diff --git a/native/cocos/platform/win32/WindowsPlatform.cpp b/native/cocos/platform/win32/WindowsPlatform.cpp index 05f091173c..df6329c92f 100644 --- a/native/cocos/platform/win32/WindowsPlatform.cpp +++ b/native/cocos/platform/win32/WindowsPlatform.cpp @@ -72,7 +72,7 @@ void PVRFrameEnableControlWindow(bool bEnable) { RegCloseKey(hKey); } -std::unordered_map gKeyMap = { +ccstd::unordered_map gKeyMap = { {SDLK_APPLICATION, cc::KeyCode::CONTEXT_MENU}, {SDLK_SCROLLLOCK, cc::KeyCode::SCROLLLOCK}, {SDLK_PAUSE, cc::KeyCode::PAUSE}, @@ -149,7 +149,7 @@ int sdlKeycodeToCocosCode(int sdlCode, int mode) { } } -std::unordered_map gWindowFlagMap = { +ccstd::unordered_map gWindowFlagMap = { {cc::ISystemWindow::CC_WINDOW_FULLSCREEN, SDL_WINDOW_FULLSCREEN}, {cc::ISystemWindow::CC_WINDOW_OPENGL, SDL_WINDOW_OPENGL}, {cc::ISystemWindow::CC_WINDOW_SHOWN, SDL_WINDOW_SHOWN}, diff --git a/native/cocos/primitive/Transform.cpp b/native/cocos/primitive/Transform.cpp index c3b4789dd2..9d8fe7dcad 100644 --- a/native/cocos/primitive/Transform.cpp +++ b/native/cocos/primitive/Transform.cpp @@ -103,7 +103,7 @@ IGeometry wireframed(IGeometry &geometry) { // const offsets = [ [ 0, 1 ], [ 1, 2 ], [ 2, 0 ] ]; ccstd::vector> offsets{{0, 1}, {1, 2}, {2, 0}}; ccstd::vector lines; - std::unordered_map lineIDs; + ccstd::unordered_map lineIDs; for (uint32_t i = 0; i < indices->size(); i += 3) { for (uint32_t k = 0; k < 3; ++k) { const uint32_t i1 = (*indices)[i + offsets[k][0]]; diff --git a/native/cocos/profiler/GameStats.h b/native/cocos/profiler/GameStats.h index e4e943f8b0..2b74c974ce 100644 --- a/native/cocos/profiler/GameStats.h +++ b/native/cocos/profiler/GameStats.h @@ -29,7 +29,7 @@ #include #include #include -#include +#include "base/std/container/unordered_map.h" #include #include "base/StringUtil.h" @@ -171,7 +171,7 @@ struct CoreStats { struct MemoryStats { // memory stats std::mutex mutex; - std::unordered_map memories; + ccstd::unordered_map memories; inline void update(const std::string &name, uint64_t value) { std::lock_guard lock(mutex); @@ -192,9 +192,9 @@ struct MemoryStats { // assume update in main thread only. struct ObjectStats { // render stats: drawcalls, instances, triangles, etc - std::unordered_map renders; + ccstd::unordered_map renders; // object stats - std::unordered_map objects; + ccstd::unordered_map objects; inline void onFrameBegin() { for (auto &item : renders) { diff --git a/native/cocos/profiler/Profiler.cpp b/native/cocos/profiler/Profiler.cpp index 4580ba8c4a..fa51485751 100644 --- a/native/cocos/profiler/Profiler.cpp +++ b/native/cocos/profiler/Profiler.cpp @@ -319,7 +319,7 @@ void Profiler::printStats() { renderer->addText("TotalMax", {totalMaxOffset, yOffset}, titleInfo); rightLines++; - std::unordered_map memories; + ccstd::unordered_map memories; { std::lock_guard lock(_memoryStats.mutex); memories = _memoryStats.memories; diff --git a/native/cocos/renderer/core/PassUtils.cpp b/native/cocos/renderer/core/PassUtils.cpp index ecf6b1cb47..ae0e2f69ce 100644 --- a/native/cocos/renderer/core/PassUtils.cpp +++ b/native/cocos/renderer/core/PassUtils.cpp @@ -31,7 +31,7 @@ namespace cc { -const std::unordered_map type2reader = { +const ccstd::unordered_map type2reader = { {gfx::Type::UNKNOWN, [](const float * /*a*/, MaterialProperty & /*v*/, index_t /*idx*/) { CC_LOG_ERROR("type2reader unknown type"); }}, @@ -99,7 +99,7 @@ const std::unordered_map type2reader = { }}, }; -const std::unordered_map type2writer = { +const ccstd::unordered_map type2writer = { {gfx::Type::UNKNOWN, [](float * /*a*/, const MaterialProperty & /*v*/, index_t /*idx*/) { CC_LOG_ERROR("type2writer unknown type"); }}, diff --git a/native/cocos/renderer/core/PassUtils.h b/native/cocos/renderer/core/PassUtils.h index 4d24662530..63e3f06c6e 100644 --- a/native/cocos/renderer/core/PassUtils.h +++ b/native/cocos/renderer/core/PassUtils.h @@ -84,8 +84,8 @@ using MaterialPropertyVariant = cc::variant type2reader; //NOLINT(readability-identifier-naming) -extern const std::unordered_map type2writer; //NOLINT(readability-identifier-naming) +extern const ccstd::unordered_map type2reader; //NOLINT(readability-identifier-naming) +extern const ccstd::unordered_map type2writer; //NOLINT(readability-identifier-naming) /** * @en Gets the default values for the given type of uniform diff --git a/native/cocos/renderer/core/ProgramLib.h b/native/cocos/renderer/core/ProgramLib.h index 7d15833f7a..8ad28e2ee5 100644 --- a/native/cocos/renderer/core/ProgramLib.h +++ b/native/cocos/renderer/core/ProgramLib.h @@ -29,7 +29,7 @@ #include #include #include -#include +#include "base/std/container/unordered_map.h" #include "base/RefVector.h" #include "cocos/base/Optional.h" #include "core/Types.h" diff --git a/native/cocos/renderer/frame-graph/Blackboard.h b/native/cocos/renderer/frame-graph/Blackboard.h index 31dc37f1ff..21908abc17 100644 --- a/native/cocos/renderer/frame-graph/Blackboard.h +++ b/native/cocos/renderer/frame-graph/Blackboard.h @@ -25,7 +25,7 @@ #pragma once -#include +#include "base/std/container/unordered_map.h" #include "Handle.h" #include "base/Macros.h" @@ -49,7 +49,7 @@ public: inline bool has(const KeyType &name) const noexcept; private: - using Container = std::unordered_map; + using Container = ccstd::unordered_map; Container _container; }; diff --git a/native/cocos/renderer/frame-graph/DevicePassResourceTable.h b/native/cocos/renderer/frame-graph/DevicePassResourceTable.h index c00ad8ad5a..49406768a8 100644 --- a/native/cocos/renderer/frame-graph/DevicePassResourceTable.h +++ b/native/cocos/renderer/frame-graph/DevicePassResourceTable.h @@ -25,7 +25,7 @@ #pragma once -#include +#include "base/std/container/unordered_map.h" #include "Handle.h" #include "RenderTargetAttachment.h" #include "Resource.h" @@ -58,7 +58,7 @@ public: uint32_t getSubpassIndex() const { return _subpassIndex; } private: - using ResourceDictionary = std::unordered_map; + using ResourceDictionary = ccstd::unordered_map; static gfx::GFXObject *get(const ResourceDictionary &from, Handle handle) noexcept; void extract(const FrameGraph &graph, const PassNode *passNode, ccstd::vector const &renderTargets) noexcept; diff --git a/native/cocos/renderer/frame-graph/FrameGraph.cpp b/native/cocos/renderer/frame-graph/FrameGraph.cpp index c7bbc0c372..7e6845dd39 100644 --- a/native/cocos/renderer/frame-graph/FrameGraph.cpp +++ b/native/cocos/renderer/frame-graph/FrameGraph.cpp @@ -71,7 +71,7 @@ void FrameGraph::present(const TextureHandle &input, gfx::Texture *target, bool if (useMoveSemantic) { // using a global map here so that the user don't need to worry about importing the targets every frame - static std::unordered_map> presentTargets; + static ccstd::unordered_map> presentTargets; if (!presentTargets.count(target->getTypedID())) { auto name = FrameGraph::stringToHandle(StringUtil::format("Present Target %d", target->getTypedID()).c_str()); presentTargets.emplace(std::piecewise_construct, std::forward_as_tuple(target->getTypedID()), std::forward_as_tuple(name, Texture{target})); diff --git a/native/cocos/renderer/frame-graph/ResourceAllocator.h b/native/cocos/renderer/frame-graph/ResourceAllocator.h index d23b1fb8d7..7d37770aaf 100644 --- a/native/cocos/renderer/frame-graph/ResourceAllocator.h +++ b/native/cocos/renderer/frame-graph/ResourceAllocator.h @@ -26,7 +26,7 @@ #pragma once #include -#include +#include "base/std/container/unordered_map.h" #include "base/memory/Memory.h" #include "gfx-base/GFXDef.h" @@ -55,8 +55,8 @@ private: ResourceAllocator() noexcept = default; ~ResourceAllocator() = default; - std::unordered_map> _pool{}; - std::unordered_map _ages{}; + ccstd::unordered_map> _pool{}; + ccstd::unordered_map _ages{}; uint64_t _age{0}; }; diff --git a/native/cocos/renderer/gfx-base/GFXDevice.h b/native/cocos/renderer/gfx-base/GFXDevice.h index 9b7628eeaf..ea0365bc23 100644 --- a/native/cocos/renderer/gfx-base/GFXDevice.h +++ b/native/cocos/renderer/gfx-base/GFXDevice.h @@ -176,9 +176,9 @@ protected: uint32_t _numTriangles{0U}; MemoryStatus _memoryStatus; - unordered_map> _samplers; - unordered_map> _generalBarriers; - unordered_map> _textureBarriers; + ccstd::unordered_map> _samplers; + ccstd::unordered_map> _generalBarriers; + ccstd::unordered_map> _textureBarriers; private: ccstd::vector _swapchains; // weak reference diff --git a/native/cocos/renderer/gfx-base/GFXQueryPool.h b/native/cocos/renderer/gfx-base/GFXQueryPool.h index 633895ae2b..35dbb67135 100644 --- a/native/cocos/renderer/gfx-base/GFXQueryPool.h +++ b/native/cocos/renderer/gfx-base/GFXQueryPool.h @@ -27,7 +27,7 @@ #include #include -#include +#include "base/std/container/unordered_map.h" #include "GFXObject.h" namespace cc { @@ -68,7 +68,7 @@ protected: uint32_t _maxQueryObjects{0}; bool _forceWait{true}; std::mutex _mutex; - std::unordered_map _results; + ccstd::unordered_map _results; }; } // namespace gfx diff --git a/native/cocos/renderer/gfx-gles2/GLES2Commands.cpp b/native/cocos/renderer/gfx-gles2/GLES2Commands.cpp index 9b675a099e..bd8906a07a 100644 --- a/native/cocos/renderer/gfx-gles2/GLES2Commands.cpp +++ b/native/cocos/renderer/gfx-gles2/GLES2Commands.cpp @@ -1091,7 +1091,7 @@ void cmdFuncGLES2CreateShader(GLES2Device *device, GLES2GPUShader *gpuShader) { ccstd::vector glActiveSamplerTextures; ccstd::vector glActiveSamplerLocations; const GLESBindingMapping & bindingMappings = device->bindingMappings(); - unordered_map & texUnitCacheMap = device->stateCache()->texUnitCacheMap; + ccstd::unordered_map & texUnitCacheMap = device->stateCache()->texUnitCacheMap; // sampler bindings in the flexible set comes strictly after buffer bindings // so we need to subtract the buffer count for these samplers diff --git a/native/cocos/renderer/gfx-gles2/GLES2GPUObjects.h b/native/cocos/renderer/gfx-gles2/GLES2GPUObjects.h index ea8cde4750..0ce64a594e 100644 --- a/native/cocos/renderer/gfx-gles2/GLES2GPUObjects.h +++ b/native/cocos/renderer/gfx-gles2/GLES2GPUObjects.h @@ -253,7 +253,7 @@ struct GLES2GPUInputAssembler { GLES2GPUBuffer * gpuIndirectBuffer = nullptr; GLES2GPUAttributeList glAttribs; GLenum glIndexType = 0; - unordered_map glVAOs; + ccstd::unordered_map glVAOs; }; struct GLES2GPURenderPass { @@ -410,7 +410,7 @@ public: BlendState bs; bool isCullFaceEnabled = true; bool isStencilTestEnabled = false; - unordered_map texUnitCacheMap; + ccstd::unordered_map texUnitCacheMap; GLES2ObjectCache gfxStateCache; void initialize(size_t texUnits, size_t vertexAttributes) { @@ -565,7 +565,7 @@ private: GLuint glFramebuffer{0}; bool isExternal{false}; }; - using CacheMap = unordered_map; + using CacheMap = ccstd::unordered_map; CacheMap _renderbufferMap; // renderbuffer -> framebuffer CacheMap _textureMap; // texture -> framebuffer }; @@ -588,7 +588,7 @@ public: void update(GLES2GPUTexture *texture); private: - unordered_map> _framebuffers; + ccstd::unordered_map> _framebuffers; }; } // namespace gfx diff --git a/native/cocos/renderer/gfx-gles3/GLES3Commands.cpp b/native/cocos/renderer/gfx-gles3/GLES3Commands.cpp index 9b1a4e0ae9..5babe5eea2 100644 --- a/native/cocos/renderer/gfx-gles3/GLES3Commands.cpp +++ b/native/cocos/renderer/gfx-gles3/GLES3Commands.cpp @@ -1219,7 +1219,7 @@ void cmdFuncGLES3CreateShader(GLES3Device *device, GLES3GPUShader *gpuShader) { ccstd::vector glActiveSamplerTextures; ccstd::vector glActiveSamplerLocations; const GLESBindingMapping & bindingMappings = device->bindingMappings(); - unordered_map & texUnitCacheMap = device->stateCache()->texUnitCacheMap; + ccstd::unordered_map & texUnitCacheMap = device->stateCache()->texUnitCacheMap; // sampler bindings in the flexible set comes strictly after buffer bindings // so we need to subtract the buffer count for these samplers @@ -1784,7 +1784,7 @@ void cmdFuncGLES3Query(GLES3Device * /*device*/, GLES3QueryPool *queryPool, GLES } } - std::unordered_map mapResults; + ccstd::unordered_map mapResults; for (auto queryId = 0U; queryId < queryCount; queryId++) { uint32_t glID = queryPool->getId(queryId); auto iter = mapResults.find(glID); diff --git a/native/cocos/renderer/gfx-gles3/GLES3GPUObjects.h b/native/cocos/renderer/gfx-gles3/GLES3GPUObjects.h index eeb0ae2f1c..08a3a1fab4 100644 --- a/native/cocos/renderer/gfx-gles3/GLES3GPUObjects.h +++ b/native/cocos/renderer/gfx-gles3/GLES3GPUObjects.h @@ -191,7 +191,7 @@ public: GLuint getGLSampler(uint16_t minLod, uint16_t maxLod); private: - unordered_map _cache; + ccstd::unordered_map _cache; }; struct GLES3GPUInput { @@ -305,7 +305,7 @@ struct GLES3GPUInputAssembler { GLES3GPUBuffer * gpuIndirectBuffer = nullptr; GLES3GPUAttributeList glAttribs; GLenum glIndexType = 0; - unordered_map glVAOs; + ccstd::unordered_map glVAOs; }; struct GLES3GPUGeneralBarrier { @@ -482,7 +482,7 @@ public: BlendState bs; bool isCullFaceEnabled = true; bool isStencilTestEnabled = false; - unordered_map texUnitCacheMap; + ccstd::unordered_map texUnitCacheMap; GLES3ObjectCache gfxStateCache; void initialize(size_t texUnits, size_t imageUnits, size_t uboBindings, size_t ssboBindings, size_t vertexAttributes) { @@ -644,7 +644,7 @@ private: GLuint glFramebuffer{0}; bool isExternal{false}; }; - using CacheMap = unordered_map>; + using CacheMap = ccstd::unordered_map>; CacheMap _renderbufferMap; // renderbuffer -> mip level -> framebuffer CacheMap _textureMap; // texture -> mip level -> framebuffer }; @@ -667,7 +667,7 @@ public: void update(GLES3GPUTexture *texture); private: - unordered_map> _framebuffers; + ccstd::unordered_map> _framebuffers; }; } // namespace gfx diff --git a/native/cocos/renderer/gfx-gles3/GLES3QueryPool.h b/native/cocos/renderer/gfx-gles3/GLES3QueryPool.h index 60910645ce..18eacfb49f 100644 --- a/native/cocos/renderer/gfx-gles3/GLES3QueryPool.h +++ b/native/cocos/renderer/gfx-gles3/GLES3QueryPool.h @@ -44,7 +44,7 @@ public: inline void addId(uint32_t id) { _ids.push_back(id); } inline uint32_t getId(uint32_t index) const { return _ids[index]; } inline std::mutex & getMutex() { return _mutex; } - inline void setResults(std::unordered_map &&results) { _results = results; } + inline void setResults(ccstd::unordered_map &&results) { _results = results; } protected: friend class GLES3CommandBuffer; diff --git a/native/cocos/renderer/gfx-metal/MTLDevice.mm b/native/cocos/renderer/gfx-metal/MTLDevice.mm index bb816c91b8..f3f73f4f4e 100644 --- a/native/cocos/renderer/gfx-metal/MTLDevice.mm +++ b/native/cocos/renderer/gfx-metal/MTLDevice.mm @@ -332,7 +332,7 @@ void CCMTLDevice::getQueryPoolResults(QueryPool *queryPool) { gpuQueryPool->semaphore->wait(); uint64_t *results = queryCount > 0U ? static_cast(gpuQueryPool->visibilityResultBuffer.contents) : nullptr; - std::unordered_map mapResults; + ccstd::unordered_map mapResults; for (auto queryId = 0U; queryId < queryCount; queryId++) { uint32_t id = mtlQueryPool->_ids[queryId]; auto iter = mapResults.find(id); diff --git a/native/cocos/renderer/gfx-metal/MTLGPUObjects.h b/native/cocos/renderer/gfx-metal/MTLGPUObjects.h index 204b32e883..4153bb9700 100644 --- a/native/cocos/renderer/gfx-metal/MTLGPUObjects.h +++ b/native/cocos/renderer/gfx-metal/MTLGPUObjects.h @@ -97,8 +97,8 @@ struct CCMTLGPUSubpassAttachment { }; struct CCMTLGPUShader { - unordered_map blocks; - unordered_map samplers; + ccstd::unordered_map blocks; + ccstd::unordered_map samplers; ccstd::vector inputs; ccstd::vector outputs; diff --git a/native/cocos/renderer/gfx-metal/MTLPipelineState.mm b/native/cocos/renderer/gfx-metal/MTLPipelineState.mm index 727cc2316c..38d16ddf65 100644 --- a/native/cocos/renderer/gfx-metal/MTLPipelineState.mm +++ b/native/cocos/renderer/gfx-metal/MTLPipelineState.mm @@ -212,7 +212,7 @@ bool CCMTLPipelineState::createMTLRenderPipelineState() { void CCMTLPipelineState::setVertexDescriptor(MTLRenderPipelineDescriptor *descriptor) { auto activeAttributes = static_cast(_shader)->getAttributes(); ccstd::vector> layouts; - unordered_map> map; + ccstd::unordered_map> map; ccstd::vector streamOffsets(CCMTLDevice::getInstance()->getCapabilities().maxVertexAttributes, 0u); ccstd::vector activeAttribIdx(activeAttributes.size(), false); for (const auto &inputAttrib : _inputState.attributes) { diff --git a/native/cocos/renderer/gfx-metal/MTLRenderCommandEncoder.h b/native/cocos/renderer/gfx-metal/MTLRenderCommandEncoder.h index 49e4a84170..0ace5efd8c 100644 --- a/native/cocos/renderer/gfx-metal/MTLRenderCommandEncoder.h +++ b/native/cocos/renderer/gfx-metal/MTLRenderCommandEncoder.h @@ -28,7 +28,7 @@ #import #import #import -#include +#include "base/std/container/unordered_map.h" #include "MTLCommandEncoder.h" #include "MTLStd.h" #include "MTLUtils.h" @@ -299,12 +299,12 @@ protected: Viewport _viewport; Rect _scissorRect; Color _blendColor; - std::unordered_map _vertexBufferMap; - std::unordered_map _fragmentBufferMap; - std::unordered_map> _vertexTextureMap; - std::unordered_map> _fragmentTextureMap; - std::unordered_map> _vertexSamplerMap; - std::unordered_map> _fragmentSamplerMap; + ccstd::unordered_map _vertexBufferMap; + ccstd::unordered_map _fragmentBufferMap; + ccstd::unordered_map> _vertexTextureMap; + ccstd::unordered_map> _fragmentTextureMap; + ccstd::unordered_map> _vertexSamplerMap; + ccstd::unordered_map> _fragmentSamplerMap; }; } // namespace gfx diff --git a/native/cocos/renderer/gfx-metal/MTLShader.h b/native/cocos/renderer/gfx-metal/MTLShader.h index 6116d2f839..920ceed6fe 100644 --- a/native/cocos/renderer/gfx-metal/MTLShader.h +++ b/native/cocos/renderer/gfx-metal/MTLShader.h @@ -45,7 +45,7 @@ public: inline id getVertMTLFunction() const { return _vertFunction; } inline id getFragmentMTLFunction() const { return _fragFunction; } inline id getComputeMTLFunction() const { return _cmptFunction; } - inline const unordered_map &getFragmentSamplerBindings() const { return _mtlFragmentSamplerBindings; } + inline const ccstd::unordered_map &getFragmentSamplerBindings() const { return _mtlFragmentSamplerBindings; } inline const CCMTLGPUShader * gpuShader() const { return _gpuShader; } uint getAvailableBufferBindingIndex(ShaderStageFlagBit stage, uint stream); @@ -79,7 +79,7 @@ protected: // function constant hash , specialized MTLFunction NSMutableDictionary> *_specializedFragFuncs = nil; - unordered_map _mtlFragmentSamplerBindings; + ccstd::unordered_map _mtlFragmentSamplerBindings; ccstd::vector _availableVertexBufferBindingIndex; ccstd::vector _availableFragmentBufferBindingIndex; diff --git a/native/cocos/renderer/gfx-metal/MTLUtils.h b/native/cocos/renderer/gfx-metal/MTLUtils.h index d6821d5290..2875c8727c 100644 --- a/native/cocos/renderer/gfx-metal/MTLUtils.h +++ b/native/cocos/renderer/gfx-metal/MTLUtils.h @@ -31,7 +31,7 @@ #import #import #import -#include +#include "base/std/container/unordered_map.h" #include "gfx-base/GFXDef.h" namespace cc { diff --git a/native/cocos/renderer/gfx-metal/MTLUtils.mm b/native/cocos/renderer/gfx-metal/MTLUtils.mm index c23726fad8..7998d99b46 100644 --- a/native/cocos/renderer/gfx-metal/MTLUtils.mm +++ b/native/cocos/renderer/gfx-metal/MTLUtils.mm @@ -40,8 +40,8 @@ namespace cc { namespace gfx { namespace { -std::unordered_map pipelineMap; -std::unordered_map renderPassMap; +ccstd::unordered_map pipelineMap; +ccstd::unordered_map renderPassMap; EShLanguage getShaderStage(ShaderStageFlagBit type) { switch (type) { diff --git a/native/cocos/renderer/gfx-validator/TextureValidator.cpp b/native/cocos/renderer/gfx-validator/TextureValidator.cpp index c714f4e2a5..2f00cbec08 100644 --- a/native/cocos/renderer/gfx-validator/TextureValidator.cpp +++ b/native/cocos/renderer/gfx-validator/TextureValidator.cpp @@ -42,7 +42,7 @@ struct EnumHasher final { } }; -unordered_map featureCheckMap{}; +ccstd::unordered_map featureCheckMap{}; } // namespace TextureValidator::TextureValidator(Texture *actor) diff --git a/native/cocos/renderer/gfx-validator/ValidationUtils.h b/native/cocos/renderer/gfx-validator/ValidationUtils.h index 7e9e370dd3..031fff2b3e 100644 --- a/native/cocos/renderer/gfx-validator/ValidationUtils.h +++ b/native/cocos/renderer/gfx-validator/ValidationUtils.h @@ -109,7 +109,7 @@ private: BufferInfo info; ccstd::vector data; }; - unordered_map _bufferMap; + ccstd::unordered_map _bufferMap; }; ////////////////////////////////////////////////////////////////////////// diff --git a/native/cocos/renderer/gfx-vulkan/VKCommands.cpp b/native/cocos/renderer/gfx-vulkan/VKCommands.cpp index 2b41aacbdc..baa72b6bcd 100644 --- a/native/cocos/renderer/gfx-vulkan/VKCommands.cpp +++ b/native/cocos/renderer/gfx-vulkan/VKCommands.cpp @@ -1552,7 +1552,7 @@ void CCVKGPURecycleBin::clear() { VkSampleCountFlagBits CCVKGPUContext::getSampleCountForAttachments(Format format, VkFormat vkFormat, SampleCount sampleCount) const { if (sampleCount <= SampleCount::ONE) return VK_SAMPLE_COUNT_1_BIT; - static unordered_map cacheMap; + static ccstd::unordered_map cacheMap; if (!cacheMap.count(format)) { bool hasDepth = GFX_FORMAT_INFOS[toNumber(format)].hasDepth; VkImageUsageFlags usages = hasDepth ? VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT : VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT; diff --git a/native/cocos/renderer/gfx-vulkan/VKDevice.cpp b/native/cocos/renderer/gfx-vulkan/VKDevice.cpp index 69c4fd3e41..c738f553be 100644 --- a/native/cocos/renderer/gfx-vulkan/VKDevice.cpp +++ b/native/cocos/renderer/gfx-vulkan/VKDevice.cpp @@ -873,7 +873,7 @@ void CCVKDevice::getQueryPoolResults(QueryPool *queryPool) { CCASSERT(result == VK_SUCCESS || result == VK_NOT_READY, "Unexpected error code."); } - std::unordered_map mapResults; + ccstd::unordered_map mapResults; for (auto queryId = 0U; queryId < queryCount; queryId++) { uint32_t offset = queryId * width; if (bWait || results[offset + 1] > 0) { diff --git a/native/cocos/renderer/gfx-vulkan/VKGPUObjects.h b/native/cocos/renderer/gfx-vulkan/VKGPUObjects.h index b2427e599c..5efc048b02 100644 --- a/native/cocos/renderer/gfx-vulkan/VKGPUObjects.h +++ b/native/cocos/renderer/gfx-vulkan/VKGPUObjects.h @@ -218,7 +218,7 @@ struct CCVKGPUFramebuffer { }; using FramebufferList = ccstd::vector; -using FramebufferListMap = unordered_map; +using FramebufferListMap = ccstd::unordered_map; using FramebufferListMapIter = FramebufferListMap::iterator; struct CCVKGPUSwapchain { @@ -394,7 +394,7 @@ private: using CommandBufferPools = tbb::concurrent_unordered_map>; CommandBufferPools _commandBufferPools; - unordered_map> _descriptorSetPools; + ccstd::unordered_map> _descriptorSetPools; }; /** @@ -527,7 +527,7 @@ public: _setLayouts.insert(_setLayouts.cbegin(), _maxSetsPerPool, setLayout); _fleaMarkets.resize(device->backBufferCount); - unordered_map typeMap; + ccstd::unordered_map typeMap; for (const auto &vkBinding : bindings) { typeMap[vkBinding.descriptorType] += maxSetsPerPool * vkBinding.descriptorCount; } @@ -733,7 +733,7 @@ private: CCVKGPUDevice *_device = nullptr; uint32_t _lastBackBufferIndex = 0U; - unordered_map _pools; + ccstd::unordered_map _pools; }; /** @@ -1048,10 +1048,10 @@ private: CachedArray descriptors; }; - unordered_map _bufferInstanceIndices; - unordered_map> _buffers; - unordered_map> _textures; - unordered_map> _samplers; + ccstd::unordered_map _bufferInstanceIndices; + ccstd::unordered_map> _buffers; + ccstd::unordered_map> _textures; + ccstd::unordered_map> _samplers; CCVKGPUDescriptorSetHub *_descriptorSetHub = nullptr; }; @@ -1345,7 +1345,7 @@ private: bool canMemcpy = false; }; - ccstd::vector> _buffersToBeUpdated; + ccstd::vector> _buffersToBeUpdated; CCVKGPUDevice *_device = nullptr; }; @@ -1368,7 +1368,7 @@ public: void update(CCVKGPUTexture *texture); private: - unordered_map> _framebuffers; + ccstd::unordered_map> _framebuffers; }; } // namespace gfx diff --git a/native/cocos/renderer/gfx-vulkan/vk_mem_alloc.h b/native/cocos/renderer/gfx-vulkan/vk_mem_alloc.h index b1fa981916..00fed93503 100644 --- a/native/cocos/renderer/gfx-vulkan/vk_mem_alloc.h +++ b/native/cocos/renderer/gfx-vulkan/vk_mem_alloc.h @@ -4044,7 +4044,7 @@ extern PFN_vkGetDeviceProcAddr vkGetDeviceProcAddr; //#define VMA_USE_STL_CONTAINERS 1 /* Set this macro to 1 to make the library including and using STL containers: -std::pair, ccstd::vector, std::list, std::unordered_map. +std::pair, ccstd::vector, std::list, ccstd::unordered_map. Set it to 0 or undefined to make the library using its own implementation of the containers. @@ -4078,7 +4078,7 @@ Library has its own container implementation. #endif #if VMA_USE_STL_UNORDERED_MAP - #include + #include "base/std/container/unordered_map.h" #endif #if VMA_USE_STL_LIST @@ -5960,7 +5960,7 @@ private: #define VmaPair std::pair #define VMA_MAP_TYPE(KeyT, ValueT) \ - std::unordered_map, std::equal_to, VmaStlAllocator > > + ccstd::unordered_map, std::equal_to, VmaStlAllocator > > #else // #if VMA_USE_STL_UNORDERED_MAP @@ -5974,7 +5974,7 @@ struct VmaPair VmaPair(const T1& firstSrc, const T2& secondSrc) : first(firstSrc), second(secondSrc) { } }; -/* Class compatible with subset of interface of std::unordered_map. +/* Class compatible with subset of interface of ccstd::unordered_map. KeyT, ValueT must be POD because they will be stored in VmaVector. */ template diff --git a/native/cocos/renderer/gfx-wgpu/WGPUDescriptorSetLayout.cpp b/native/cocos/renderer/gfx-wgpu/WGPUDescriptorSetLayout.cpp index 21aca0b191..1b8166c334 100644 --- a/native/cocos/renderer/gfx-wgpu/WGPUDescriptorSetLayout.cpp +++ b/native/cocos/renderer/gfx-wgpu/WGPUDescriptorSetLayout.cpp @@ -40,7 +40,7 @@ namespace gfx { namespace anoymous { WGPUBindGroupLayout defaultBindgroupLayout = wgpuDefaultHandle; -std::unordered_map layoutPool; +ccstd::unordered_map layoutPool; } // namespace anoymous using namespace emscripten; diff --git a/native/cocos/renderer/gfx-wgpu/WGPUQueryPool.h b/native/cocos/renderer/gfx-wgpu/WGPUQueryPool.h index 0d1d4ebaea..23be96407e 100644 --- a/native/cocos/renderer/gfx-wgpu/WGPUQueryPool.h +++ b/native/cocos/renderer/gfx-wgpu/WGPUQueryPool.h @@ -44,7 +44,7 @@ public: inline void addId(uint32_t id) { _ids.push_back(id); } inline uint32_t getId(uint32_t index) const { return _ids[index]; } inline std::mutex & getMutex() { return _mutex; } - inline void setResults(std::unordered_map &&results) { _results = results; } + inline void setResults(ccstd::unordered_map &&results) { _results = results; } protected: void doInit(const QueryPoolInfo &info) override; diff --git a/native/cocos/renderer/pipeline/Define.cpp b/native/cocos/renderer/pipeline/Define.cpp index e1eb80a916..b421b555b2 100644 --- a/native/cocos/renderer/pipeline/Define.cpp +++ b/native/cocos/renderer/pipeline/Define.cpp @@ -522,7 +522,7 @@ bool supportsR32FloatTexture(gfx::Device *device) { return hasAllFlags(device->getFormatFeatures(gfx::Format::R32F), gfx::FormatFeature::RENDER_TARGET | gfx::FormatFeature::SAMPLED_TEXTURE); } -static std::unordered_map phases; //cjh how to clear this global variable when exiting game? +static ccstd::unordered_map phases; //cjh how to clear this global variable when exiting game? static uint32_t phaseNum = 0; uint getPhaseID(const String &phaseName) { diff --git a/native/cocos/renderer/pipeline/Define.h b/native/cocos/renderer/pipeline/Define.h index b9935c4629..56a9a26ef5 100644 --- a/native/cocos/renderer/pipeline/Define.h +++ b/native/cocos/renderer/pipeline/Define.h @@ -466,9 +466,9 @@ struct CC_DLL UBOShadow { struct CC_DLL DescriptorSetLayoutInfos { gfx::DescriptorSetLayoutBindingList bindings; - unordered_map blocks; - unordered_map samplers; - unordered_map storeImages; + ccstd::unordered_map blocks; + ccstd::unordered_map samplers; + ccstd::unordered_map storeImages; }; extern CC_DLL DescriptorSetLayoutInfos globalDescriptorSetLayout; extern CC_DLL DescriptorSetLayoutInfos localDescriptorSetLayout; diff --git a/native/cocos/renderer/pipeline/GlobalDescriptorSetManager.h b/native/cocos/renderer/pipeline/GlobalDescriptorSetManager.h index d5cc0d641a..9cdd917bcb 100644 --- a/native/cocos/renderer/pipeline/GlobalDescriptorSetManager.h +++ b/native/cocos/renderer/pipeline/GlobalDescriptorSetManager.h @@ -45,7 +45,7 @@ public: GlobalDSManager() = default; ~GlobalDSManager() = default; - inline std::unordered_map getDescriptorSetMap() const { return _descriptorSetMap; } + inline ccstd::unordered_map getDescriptorSetMap() const { return _descriptorSetMap; } inline gfx::Sampler * getLinearSampler() const { return _linearSampler; } inline gfx::Sampler * getPointSampler() const { return _pointSampler; } inline gfx::DescriptorSetLayout * getDescriptorSetLayout() const { return _descriptorSetLayout; } @@ -67,7 +67,7 @@ private: gfx::Sampler * _pointSampler = nullptr; IntrusivePtr _descriptorSetLayout; gfx::DescriptorSet * _globalDescriptorSet = nullptr; - std::unordered_map _descriptorSetMap{}; + ccstd::unordered_map _descriptorSetMap{}; ccstd::vector _shadowUBOs; }; diff --git a/native/cocos/renderer/pipeline/PipelineSceneData.h b/native/cocos/renderer/pipeline/PipelineSceneData.h index 4c0873d0b2..70c68ae56f 100644 --- a/native/cocos/renderer/pipeline/PipelineSceneData.h +++ b/native/cocos/renderer/pipeline/PipelineSceneData.h @@ -56,7 +56,7 @@ public: virtual void updatePipelineSceneData() {} inline void setShadowFramebuffer(const scene::Light *light, gfx::Framebuffer *framebuffer) { _shadowFrameBufferMap.emplace(light, framebuffer); } - inline const std::unordered_map &getShadowFramebufferMap() const { return _shadowFrameBufferMap; } + inline const ccstd::unordered_map &getShadowFramebufferMap() const { return _shadowFrameBufferMap; } inline const RenderObjectList & getRenderObjects() const { return _renderObjects; } inline const RenderObjectList & getDirShadowObjects() const { return _dirShadowObjects; } inline void setRenderObjects(RenderObjectList &&ro) { _renderObjects = std::forward(ro); } @@ -126,7 +126,7 @@ protected: bool _isHDR{true}; float _shadingScale{1.0F}; - std::unordered_map _shadowFrameBufferMap; + ccstd::unordered_map _shadowFrameBufferMap; }; } // namespace pipeline diff --git a/native/cocos/renderer/pipeline/PipelineStateManager.cpp b/native/cocos/renderer/pipeline/PipelineStateManager.cpp index bc1cc34bd5..64524d6941 100644 --- a/native/cocos/renderer/pipeline/PipelineStateManager.cpp +++ b/native/cocos/renderer/pipeline/PipelineStateManager.cpp @@ -31,7 +31,7 @@ namespace cc { namespace pipeline { -unordered_map> PipelineStateManager::psoHashMap; +ccstd::unordered_map> PipelineStateManager::psoHashMap; gfx::PipelineState *PipelineStateManager::getOrCreatePipelineState(const scene::Pass * pass, gfx::Shader * shader, diff --git a/native/cocos/renderer/pipeline/PipelineStateManager.h b/native/cocos/renderer/pipeline/PipelineStateManager.h index 48368c2c68..a7ff715625 100644 --- a/native/cocos/renderer/pipeline/PipelineStateManager.h +++ b/native/cocos/renderer/pipeline/PipelineStateManager.h @@ -44,7 +44,7 @@ public: static void destroyAll(); private: - static unordered_map> psoHashMap; + static ccstd::unordered_map> psoHashMap; }; } // namespace pipeline diff --git a/native/cocos/renderer/pipeline/RenderPipeline.h b/native/cocos/renderer/pipeline/RenderPipeline.h index c0cf35e0a4..ae58478e4a 100644 --- a/native/cocos/renderer/pipeline/RenderPipeline.h +++ b/native/cocos/renderer/pipeline/RenderPipeline.h @@ -26,7 +26,7 @@ #pragma once #include -#include +#include "base/std/container/unordered_map.h" #include "Define.h" #include "base/CoreStd.h" #include "core/assets/Asset.h" @@ -150,10 +150,10 @@ protected: uint _height{0}; gfx::Buffer * _quadIB{nullptr}; ccstd::vector _quadVB; - std::unordered_map> _quadIA; + ccstd::unordered_map> _quadIA; framegraph::FrameGraph _fg; - unordered_map _renderPasses; + ccstd::unordered_map _renderPasses; // use cluster culling or not bool _clusterEnabled{false}; diff --git a/native/cocos/renderer/pipeline/deferred/DeferredPipeline.h b/native/cocos/renderer/pipeline/deferred/DeferredPipeline.h index e6a197b9f9..9a9bafb563 100644 --- a/native/cocos/renderer/pipeline/deferred/DeferredPipeline.h +++ b/native/cocos/renderer/pipeline/deferred/DeferredPipeline.h @@ -27,7 +27,7 @@ #include -#include +#include "base/std/container/unordered_map.h" #include "pipeline/Enum.h" #include "pipeline/RenderPipeline.h" diff --git a/native/cocos/renderer/pipeline/shadow/ShadowFlow.cpp b/native/cocos/renderer/pipeline/shadow/ShadowFlow.cpp index 23ebd1b545..4da4f949b0 100644 --- a/native/cocos/renderer/pipeline/shadow/ShadowFlow.cpp +++ b/native/cocos/renderer/pipeline/shadow/ShadowFlow.cpp @@ -41,7 +41,7 @@ namespace cc { namespace pipeline { -std::unordered_map ShadowFlow::renderPassHashMap; +ccstd::unordered_map ShadowFlow::renderPassHashMap; RenderFlowInfo ShadowFlow::initInfo = { "ShadowFlow", diff --git a/native/cocos/renderer/pipeline/shadow/ShadowFlow.h b/native/cocos/renderer/pipeline/shadow/ShadowFlow.h index 450aaa68fb..ea00c0d60a 100644 --- a/native/cocos/renderer/pipeline/shadow/ShadowFlow.h +++ b/native/cocos/renderer/pipeline/shadow/ShadowFlow.h @@ -63,7 +63,7 @@ private: ccstd::vector _validLights; ccstd::vector _usedTextures; - static std::unordered_map renderPassHashMap; + static ccstd::unordered_map renderPassHashMap; }; } // namespace pipeline } // namespace cc diff --git a/native/cocos/scene/Pass.h b/native/cocos/scene/Pass.h index ce555d206b..b4802912bb 100644 --- a/native/cocos/scene/Pass.h +++ b/native/cocos/scene/Pass.h @@ -55,7 +55,7 @@ struct PassDynamicsValue { bool dirty{false}; float value{0.F}; }; -using IPassDynamics = std::unordered_map; +using IPassDynamics = ccstd::unordered_map; enum class BatchingSchemes { NONE = 0, diff --git a/native/cocos/scene/RenderWindow.cpp b/native/cocos/scene/RenderWindow.cpp index aba6fbb790..9acacc6a7e 100644 --- a/native/cocos/scene/RenderWindow.cpp +++ b/native/cocos/scene/RenderWindow.cpp @@ -36,7 +36,7 @@ namespace scene { namespace { -const std::unordered_map ORIENTATION_MAP{ +const ccstd::unordered_map ORIENTATION_MAP{ {IScreen::Orientation::PORTRAIT, gfx::SurfaceTransform::IDENTITY}, {IScreen::Orientation::LANDSCAPE_RIGHT, gfx::SurfaceTransform::ROTATE_90}, {IScreen::Orientation::PORTRAIT_UPSIDE_DOWN, gfx::SurfaceTransform::ROTATE_180}, diff --git a/native/cocos/ui/videoplayer/VideoPlayer-java.cpp b/native/cocos/ui/videoplayer/VideoPlayer-java.cpp index 80e1c504b7..eb7a01b877 100644 --- a/native/cocos/ui/videoplayer/VideoPlayer-java.cpp +++ b/native/cocos/ui/videoplayer/VideoPlayer-java.cpp @@ -30,7 +30,7 @@ #include #include #include - #include + #include "base/std/container/unordered_map.h" #include "platform/FileUtils.h" #include "platform/java/jni/JniHelper.h" @@ -65,7 +65,7 @@ int createVideoWidgetJNI() { //----------------------------------------------------------------------------------------------------------- -static std::unordered_map sAllVideoPlayers; +static ccstd::unordered_map sAllVideoPlayers; VideoPlayer::VideoPlayer() : _videoPlayerIndex(-1), diff --git a/native/cocos/ui/webview/WebViewImpl-android.cpp b/native/cocos/ui/webview/WebViewImpl-android.cpp index d89fde6db3..9127b632d0 100644 --- a/native/cocos/ui/webview/WebViewImpl-android.cpp +++ b/native/cocos/ui/webview/WebViewImpl-android.cpp @@ -26,7 +26,7 @@ #include #include -#include +#include "base/std/container/unordered_map.h" #include "WebView-inl.h" @@ -157,7 +157,7 @@ std::string getUrlStringByFileName(const std::string &fileName) { namespace cc { -static std::unordered_map sWebViewImpls; +static ccstd::unordered_map sWebViewImpls; WebViewImpl::WebViewImpl(WebView *webView) : _viewTag(-1), _webView(webView) { diff --git a/native/cocos/ui/webview/WebViewImpl-ohos.cpp b/native/cocos/ui/webview/WebViewImpl-ohos.cpp index 1e853ab1a6..6fc690c0b1 100644 --- a/native/cocos/ui/webview/WebViewImpl-ohos.cpp +++ b/native/cocos/ui/webview/WebViewImpl-ohos.cpp @@ -26,7 +26,7 @@ #include #include -#include +#include "base/std/container/unordered_map.h" #include "WebView-inl.h" @@ -159,7 +159,7 @@ std::string getUrlStringByFileName(const std::string &fileName) { namespace cc { -static std::unordered_map sWebViewImpls; +static ccstd::unordered_map sWebViewImpls; WebViewImpl::WebViewImpl(WebView *webView) : _viewTag(-1), _webView(webView) {