Merge branch 'development' of https://github.com/o3de/o3de into GroupToggleSwitch

This commit is contained in:
Jose
2021-07-13 14:51:56 -05:00
827 changed files with 22468 additions and 26141 deletions
+18 -5
View File
@@ -27,11 +27,17 @@ namespace AZ
template <typename... Params>
EventHandler<Params...>::EventHandler(const EventHandler& rhs)
: m_callback(rhs.m_callback)
, m_event(rhs.m_event)
{
// Copy the callback function, then perform a Connect with the new event
if (rhs.m_event)
// Copy the callback and event, then perform a Connect to the event
if (m_callback && m_event)
{
rhs.m_event->Connect(*this);
m_event->Connect(*this);
}
else
{
// It was not possible to connect to the event, set it to nullptr
m_event = nullptr;
}
}
@@ -65,9 +71,16 @@ namespace AZ
{
Disconnect();
m_callback = rhs.m_callback;
if (rhs.m_event)
m_event = rhs.m_event;
// Copy the callback and event, then perform a Connect to the event
if (m_callback && m_event)
{
rhs.m_event->Connect(*this);
m_event->Connect(*this);
}
else
{
// It was not possible to connect to the event, set it to nullptr
m_event = nullptr;
}
}
@@ -23,6 +23,8 @@ namespace AZ
}
JsonUuidSerializer::JsonUuidSerializer()
: m_zeroUuidString(AZ::Uuid::CreateNull().ToString<AZStd::string>())
, m_zeroUuidStringNoDashes(AZ::Uuid::CreateNull().ToString<AZStd::string>(true, false))
{
m_uuidFormat = AZStd::regex(R"(\{[a-f0-9]{8}-?[a-f0-9]{4}-?[a-f0-9]{4}-?[a-f0-9]{4}-?[a-f0-9]{12}\})",
AZStd::regex_constants::icase | AZStd::regex_constants::optimize);
@@ -53,7 +55,7 @@ namespace AZ
Uuid* valAsUuid = reinterpret_cast<Uuid*>(outputValue);
if (IsExplicitDefault(inputValue))
if (IsExplicitDefault(inputValue) || (inputValue == m_zeroUuidString.c_str()) || (inputValue == m_zeroUuidStringNoDashes.c_str()))
{
*valAsUuid = AZ::Uuid::CreateNull();
return MessageResult("Uuid value set to default of null.", JSR::ResultCode(JSR::Tasks::ReadField, JSR::Outcomes::DefaultsUsed));
@@ -47,6 +47,8 @@ namespace AZ
const Uuid& valueTypeId, JsonSerializerContext& context);
private:
const AZStd::string m_zeroUuidString;
const AZStd::string m_zeroUuidStringNoDashes;
AZStd::regex m_uuidFormat;
};
} // namespace AZ
@@ -3252,6 +3252,7 @@ LUA_API const Node* lua_getDummyNode()
else if (Internal::LuaScriptNumber<short>::FromStack(param, result)) return result;
else if (Internal::LuaScriptNumber<AZ::s64>::FromStack(param, result)) return result;
else if (Internal::LuaScriptNumber<long>::FromStack(param, result)) return result;
else if (Internal::LuaScriptNumber<AZ::s8>::FromStack(param, result)) return result;
else if (Internal::LuaScriptNumber<unsigned char>::FromStack(param, result)) return result;
else if (Internal::LuaScriptNumber<unsigned short>::FromStack(param, result)) return result;
else if (Internal::LuaScriptNumber<unsigned int>::FromStack(param, result)) return result;
@@ -32,6 +32,15 @@ namespace AZ
{
if (m_hashes.size() < m_hashes.max_size())
{
constexpr size_t MaxTagSize = TagName{}.max_size();
if (specialization.size() > MaxTagSize)
{
AZ_Error("Settings Registry", false, R"(Cannot append Specialization tag of "%.*s.")"
" It is longer than the MaxTagNameSize of %zu", AZ_STRING_ARG(specialization),
MaxTagSize);
return false;
}
m_names.push_back(TagName{ specialization });
TagName& tag = m_names.back();
AZStd::to_lower(tag.begin(), tag.end());
@@ -49,7 +49,7 @@ namespace AZ
class Specializations
{
public:
static constexpr size_t MaxTagNameSize = 32;
static constexpr size_t MaxTagNameSize = 64;
static constexpr size_t MaxCount = 15;
static constexpr size_t NotFound = static_cast<size_t>(-1);
using TagName = AZStd::fixed_string<MaxTagNameSize>;
@@ -146,7 +146,7 @@ namespace AZ {
AZStd::mutex g_dbgLoadingMutex;
HANDLE g_currentProcess = 0; /// We deal with only one process for now.
CRITICAL_SECTION g_csDbgHelpDll; /// All dbg help functions are single threaded, so we need to control the access.
AZStd::fixed_vector<SymbolStorage::ModuleInfo, 256> g_moduleInfo;
AZStd::fixed_vector<SymbolStorage::ModuleInfo, 2048> g_moduleInfo;
// reserve 4k of scratch space so that we can get some callstack information without any allocations and as little stack frame usage as possible.
const size_t g_scratchSpaceSize = 2048;
@@ -257,6 +257,48 @@ namespace UnitTest
EXPECT_FALSE(testEvent1.HasHandlerConnected());
EXPECT_TRUE(testEvent2.HasHandlerConnected());
}
TEST_F(EventTests, TestHandlerCopyConstructorOperator)
{
int32_t invokedCounter = 0;
AZ::Event<> testEvent;
AZ::Event<>::Handler testHandler([&invokedCounter]() { invokedCounter++; });
testHandler.Connect(testEvent);
AZ::Event<>::Handler testHandler2(testHandler);
EXPECT_TRUE(testHandler.IsConnected());
EXPECT_TRUE(testHandler2.IsConnected());
EXPECT_TRUE(invokedCounter == 0);
testEvent.Signal();
EXPECT_TRUE(invokedCounter == 2);
}
TEST_F(EventTests, TestHandlerCopyAssignmentOperator)
{
int32_t invokedCounter = 0;
AZ::Event<> testEvent;
AZ::Event<>::Handler testHandler([&invokedCounter]() { invokedCounter++; });
testHandler.Connect(testEvent);
AZ::Event<>::Handler testHandler2;
EXPECT_TRUE(testHandler.IsConnected());
EXPECT_FALSE(testHandler2.IsConnected());
testHandler2 = testHandler;
EXPECT_TRUE(testHandler2.IsConnected());
EXPECT_TRUE(invokedCounter == 0);
testEvent.Signal();
EXPECT_TRUE(invokedCounter == 2);
}
}
#if defined(HAVE_BENCHMARK)
@@ -1155,7 +1155,7 @@ namespace Benchmark
class StorageDriveWindowsFixture : public benchmark::Fixture
{
public:
constexpr static char* TestFileName = "StreamerBenchmark.bin";
constexpr static const char* TestFileName = "StreamerBenchmark.bin";
constexpr static size_t FileSize = 64_mib;
void SetupStreamer(bool enableFileSharing)