From cc3e5db9942cd2c24ecfcc0f9599db7d8950233f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julio=20C=C3=A9sar=20Rocha?= Date: Mon, 10 Apr 2023 18:54:10 -0700 Subject: [PATCH 1/2] Use Boost GUID generator (#11470) * Update package lock * Use Boost UUID library * Change files * Remove GuidHelper import --- .../packages.lock.json | 29 ++++++++++++++++++- .../packages.lock.json | 25 ++++++++++++++-- vnext/Shared/Modules/BlobModule.cpp | 7 +++-- vnext/Shared/Modules/BlobModule.h | 4 +++ 4 files changed, 59 insertions(+), 6 deletions(-) diff --git a/vnext/Microsoft.ReactNative.Managed.UnitTests/packages.lock.json b/vnext/Microsoft.ReactNative.Managed.UnitTests/packages.lock.json index 265cfe2c208..c82ace2e6ea 100644 --- a/vnext/Microsoft.ReactNative.Managed.UnitTests/packages.lock.json +++ b/vnext/Microsoft.ReactNative.Managed.UnitTests/packages.lock.json @@ -78,11 +78,16 @@ "NETStandard.Library": { "type": "Transitive", "resolved": "2.0.3", - "contentHash": "st47PosZSHrjECdjeIzZQbzivYBJFv6P2nv4cj2ypdI204DO+vZ7l5raGMiX4eXMJ53RfOIg+/s4DHVZ54Nu2A==", + "contentHash": "548M6mnBSJWxsIlkQHfbzoYxpiYFXZZSL00p4GHYv8PkiqFBnnT68mW5mGEsA/ch9fDO9GkPgkFQpWiXZN7mAQ==", "dependencies": { "Microsoft.NETCore.Platforms": "1.1.0" } }, + "ReactNative.Hermes.Windows": { + "type": "Transitive", + "resolved": "0.0.0-2302.1002-2d4bf1df", + "contentHash": "4skpllUPEBkww7FN7iacP7NWrZlEGDNg83qIuFjKn4Sl8JpJQZqfUTrXcvh6tb4mHXkmwFoKhLw4Rc5Op7f+8w==" + }, "runtime.win10-arm.Microsoft.Net.Native.Compiler": { "type": "Transitive", "resolved": "2.2.7-rel-27913-00", @@ -272,6 +277,28 @@ "microsoft.reactnative": { "type": "Project" }, + "fmt": { + "type": "Project" + }, + "folly": { + "type": "Project", + "dependencies": { + "boost": "[1.76.0, )", + "fmt": "[1.0.0, )" + } + }, + "microsoft.reactnative": { + "type": "Project", + "dependencies": { + "Common": "[1.0.0, )", + "Folly": "[1.0.0, )", + "Microsoft.UI.Xaml": "[2.7.0, )", + "Microsoft.Windows.SDK.BuildTools": "[10.0.22000.194, )", + "ReactCommon": "[1.0.0, )", + "ReactNative.Hermes.Windows": "[0.0.0-2302.1002-2d4bf1df, )", + "boost": "[1.76.0, )" + } + }, "microsoft.reactnative.managed": { "type": "Project", "dependencies": { diff --git a/vnext/Microsoft.ReactNative.Managed/packages.lock.json b/vnext/Microsoft.ReactNative.Managed/packages.lock.json index 04e54db679e..bb6c3fc1f9b 100644 --- a/vnext/Microsoft.ReactNative.Managed/packages.lock.json +++ b/vnext/Microsoft.ReactNative.Managed/packages.lock.json @@ -63,11 +63,16 @@ "NETStandard.Library": { "type": "Transitive", "resolved": "2.0.3", - "contentHash": "st47PosZSHrjECdjeIzZQbzivYBJFv6P2nv4cj2ypdI204DO+vZ7l5raGMiX4eXMJ53RfOIg+/s4DHVZ54Nu2A==", + "contentHash": "548M6mnBSJWxsIlkQHfbzoYxpiYFXZZSL00p4GHYv8PkiqFBnnT68mW5mGEsA/ch9fDO9GkPgkFQpWiXZN7mAQ==", "dependencies": { "Microsoft.NETCore.Platforms": "1.1.0" } }, + "ReactNative.Hermes.Windows": { + "type": "Transitive", + "resolved": "0.0.0-2302.1002-2d4bf1df", + "contentHash": "4skpllUPEBkww7FN7iacP7NWrZlEGDNg83qIuFjKn4Sl8JpJQZqfUTrXcvh6tb4mHXkmwFoKhLw4Rc5Op7f+8w==" + }, "runtime.win10-arm.Microsoft.Net.Native.Compiler": { "type": "Transitive", "resolved": "2.2.7-rel-27913-00", @@ -136,7 +141,23 @@ "contentHash": "qF6RRZKaflI+LR1YODNyWYjq5YoX8IJ2wx5y8O+AW2xO+1t/Q6Mm+jQ38zJbWnmXbrcOqUYofn7Y3/KC6lTLBQ==" }, "microsoft.reactnative": { - "type": "Project" + "type": "Project", + "dependencies": { + "Common": "[1.0.0, )", + "Folly": "[1.0.0, )", + "Microsoft.UI.Xaml": "[2.7.0, )", + "Microsoft.Windows.SDK.BuildTools": "[10.0.22000.194, )", + "ReactCommon": "[1.0.0, )", + "ReactNative.Hermes.Windows": "[0.0.0-2302.1002-2d4bf1df, )", + "boost": "[1.76.0, )" + } + }, + "reactcommon": { + "type": "Project", + "dependencies": { + "Folly": "[1.0.0, )", + "boost": "[1.76.0, )" + } } }, "UAP,Version=v10.0.16299/win10-arm": { diff --git a/vnext/Shared/Modules/BlobModule.cpp b/vnext/Shared/Modules/BlobModule.cpp index 867e45c0193..10ef4472e8e 100644 --- a/vnext/Shared/Modules/BlobModule.cpp +++ b/vnext/Shared/Modules/BlobModule.cpp @@ -12,6 +12,9 @@ // React Native #include +// Boost Libriaries +#include + // Windows API #include #include @@ -33,7 +36,6 @@ using winrt::Microsoft::ReactNative::IReactPropertyBag; using winrt::Microsoft::ReactNative::ReactNonAbiValue; using winrt::Microsoft::ReactNative::ReactPropertyBag; using winrt::Microsoft::ReactNative::ReactPropertyId; -using winrt::Windows::Foundation::GuidHelper; using winrt::Windows::Foundation::IInspectable; using winrt::Windows::Foundation::Uri; using winrt::Windows::Security::Cryptography::CryptographicBuffer; @@ -249,8 +251,7 @@ void MemoryBlobPersistor::StoreMessage(vector &&message, string &&blobI } string MemoryBlobPersistor::StoreMessage(vector &&message) noexcept { - // substr(1, 36) strips curly braces from a GUID. - auto blobId = winrt::to_string(winrt::to_hstring(GuidHelper::CreateNewGuid())).substr(1, 36); + auto blobId = boost::uuids::to_string(m_guidGenerator()); scoped_lock lock{m_mutex}; m_blobs.insert_or_assign(blobId, std::move(message)); diff --git a/vnext/Shared/Modules/BlobModule.h b/vnext/Shared/Modules/BlobModule.h index 76c5d46e5e7..900bf5c5d18 100644 --- a/vnext/Shared/Modules/BlobModule.h +++ b/vnext/Shared/Modules/BlobModule.h @@ -11,6 +11,9 @@ // React Native #include +// Boost Libraries +#include + // Windows API #include @@ -26,6 +29,7 @@ namespace Microsoft::React { class MemoryBlobPersistor final : public IBlobPersistor { std::unordered_map> m_blobs; std::mutex m_mutex; + boost::uuids::random_generator m_guidGenerator; public: #pragma region IBlobPersistor From 47071dc5857bb9e2d5f9af3a74ed214dc94dabba Mon Sep 17 00:00:00 2001 From: "Julio C. Rocha" Date: Mon, 10 Apr 2023 20:23:23 -0700 Subject: [PATCH 2/2] Change files --- ...ative-windows-c89d9e91-bbd2-4321-a828-dea393861a32.json | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 change/react-native-windows-c89d9e91-bbd2-4321-a828-dea393861a32.json diff --git a/change/react-native-windows-c89d9e91-bbd2-4321-a828-dea393861a32.json b/change/react-native-windows-c89d9e91-bbd2-4321-a828-dea393861a32.json new file mode 100644 index 00000000000..b7e34cd65d8 --- /dev/null +++ b/change/react-native-windows-c89d9e91-bbd2-4321-a828-dea393861a32.json @@ -0,0 +1,7 @@ +{ + "type": "patch", + "comment": "Use Boost GUID generator (#11470)", + "packageName": "react-native-windows", + "email": "julio.rocha@microsoft.com", + "dependentChangeType": "patch" +}