Various minor cleanups
This commit is contained in:
@@ -167,7 +167,6 @@ DECLARE_SCRIPTING_TYPE_MINIMAL(PlatformBase);
|
||||
static void Exit();
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Copy memory region
|
||||
/// </summary>
|
||||
@@ -334,7 +333,6 @@ public:
|
||||
static void FreePages(void* ptr);
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Returns the current runtime platform type. It's compile-time constant.
|
||||
/// </summary>
|
||||
@@ -409,7 +407,6 @@ public:
|
||||
static void Sleep(int32 milliseconds) = delete;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets the current time in seconds.
|
||||
/// </summary>
|
||||
@@ -455,7 +452,6 @@ public:
|
||||
static void GetUTCTime(int32& year, int32& month, int32& dayOfWeek, int32& day, int32& hour, int32& minute, int32& second, int32& millisecond) = delete;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Shows the fatal error message to the user.
|
||||
/// </summary>
|
||||
@@ -482,7 +478,6 @@ public:
|
||||
static void Info(const Char* msg);
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Shows the fatal error message to the user.
|
||||
/// </summary>
|
||||
@@ -520,7 +515,6 @@ public:
|
||||
static bool IsDebuggerPresent();
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Performs a fatal crash.
|
||||
/// </summary>
|
||||
@@ -560,7 +554,6 @@ public:
|
||||
static void CheckFailed(const char* message, const char* file, int line);
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Sets the High DPI awareness.
|
||||
/// </summary>
|
||||
@@ -628,7 +621,6 @@ public:
|
||||
static void CreateGuid(Guid& result);
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// The list of users.
|
||||
/// </summary>
|
||||
@@ -645,7 +637,6 @@ public:
|
||||
API_EVENT() static Delegate<User*> UserRemoved;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Returns a value indicating whether can open a given URL in a web browser.
|
||||
/// </summary>
|
||||
@@ -660,7 +651,6 @@ public:
|
||||
API_FUNCTION() static void OpenUrl(const StringView& url) = delete;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets the origin position and size of the monitor at the given screen-space location.
|
||||
/// </summary>
|
||||
@@ -686,7 +676,6 @@ public:
|
||||
API_PROPERTY() static Float2 GetVirtualDesktopSize();
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets full path of the main engine directory.
|
||||
/// </summary>
|
||||
@@ -719,7 +708,6 @@ public:
|
||||
static bool SetWorkingDirectory(const String& path);
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets the process environment variables (pairs of key and value).
|
||||
/// </summary>
|
||||
|
||||
@@ -1221,10 +1221,11 @@ void* WindowsPlatform::LoadLibrary(const Char* filename)
|
||||
return handle;
|
||||
}
|
||||
|
||||
#if CRASH_LOG_ENABLE
|
||||
|
||||
Array<PlatformBase::StackFrame> WindowsPlatform::GetStackFrames(int32 skipCount, int32 maxDepth, void* context)
|
||||
{
|
||||
Array<StackFrame> result;
|
||||
#if CRASH_LOG_ENABLE
|
||||
DbgHelpLock();
|
||||
|
||||
// Initialize
|
||||
@@ -1350,12 +1351,9 @@ Array<PlatformBase::StackFrame> WindowsPlatform::GetStackFrames(int32 skipCount,
|
||||
}
|
||||
|
||||
DbgHelpUnlock();
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
#if CRASH_LOG_ENABLE
|
||||
|
||||
void WindowsPlatform::CollectCrashData(const String& crashDataFolder, void* context)
|
||||
{
|
||||
// Create mini dump file for crash debugging
|
||||
|
||||
@@ -80,8 +80,8 @@ public:
|
||||
static int32 CreateProcess(CreateProcessSettings& settings);
|
||||
static Window* CreateWindow(const CreateWindowSettings& settings);
|
||||
static void* LoadLibrary(const Char* filename);
|
||||
static Array<StackFrame, HeapAllocation> GetStackFrames(int32 skipCount = 0, int32 maxDepth = 60, void* context = nullptr);
|
||||
#if CRASH_LOG_ENABLE
|
||||
static Array<StackFrame, HeapAllocation> GetStackFrames(int32 skipCount = 0, int32 maxDepth = 60, void* context = nullptr);
|
||||
static void CollectCrashData(const String& crashDataFolder, void* context = nullptr);
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -165,9 +165,8 @@ extern MDomain* MActiveDomain;
|
||||
extern Array<MDomain*, FixedAllocation<4>> MDomains;
|
||||
|
||||
Dictionary<String, void*> CachedFunctions;
|
||||
|
||||
Dictionary<void*, MClass*> classHandles;
|
||||
Dictionary<void*, MAssembly*> assemblyHandles;
|
||||
Dictionary<void*, MClass*> CachedClassHandles;
|
||||
Dictionary<void*, MAssembly*> CachedAssemblyHandles;
|
||||
|
||||
/// <summary>
|
||||
/// Returns the function pointer to the managed static method in NativeInterop class.
|
||||
@@ -672,7 +671,7 @@ bool MAssembly::LoadCorlib()
|
||||
return true;
|
||||
}
|
||||
_hasCachedClasses = false;
|
||||
assemblyHandles.Add(_handle, this);
|
||||
CachedAssemblyHandles.Add(_handle, this);
|
||||
|
||||
// End
|
||||
OnLoaded(startTime);
|
||||
@@ -696,7 +695,7 @@ bool MAssembly::LoadImage(const String& assemblyPath, const StringView& nativePa
|
||||
Log::CLRInnerException(TEXT(".NET assembly image is invalid at ") + assemblyPath);
|
||||
return true;
|
||||
}
|
||||
assemblyHandles.Add(_handle, this);
|
||||
CachedAssemblyHandles.Add(_handle, this);
|
||||
|
||||
// Provide new path of hot-reloaded native library path for managed DllImport
|
||||
if (nativePath.HasChars())
|
||||
@@ -722,7 +721,7 @@ bool MAssembly::UnloadImage(bool isReloading)
|
||||
CallStaticMethod<void, const void*>(CloseAssemblyPtr, _handle);
|
||||
}
|
||||
|
||||
assemblyHandles.Remove(_handle);
|
||||
CachedAssemblyHandles.Remove(_handle);
|
||||
_handle = nullptr;
|
||||
}
|
||||
return false;
|
||||
@@ -780,7 +779,7 @@ MClass::MClass(const MAssembly* parentAssembly, void* handle, const char* name,
|
||||
static void* TypeIsEnumPtr = GetStaticMethodPointer(TEXT("TypeIsEnum"));
|
||||
_isEnum = CallStaticMethod<bool, void*>(TypeIsEnumPtr, handle);
|
||||
|
||||
classHandles.Add(handle, this);
|
||||
CachedClassHandles.Add(handle, this);
|
||||
}
|
||||
|
||||
bool MAssembly::ResolveMissingFile(String& assemblyPath) const
|
||||
@@ -800,7 +799,7 @@ MClass::~MClass()
|
||||
_properties.ClearDelete();
|
||||
_events.ClearDelete();
|
||||
|
||||
classHandles.Remove(_handle);
|
||||
CachedClassHandles.Remove(_handle);
|
||||
}
|
||||
|
||||
StringAnsiView MClass::GetName() const
|
||||
@@ -1018,11 +1017,7 @@ const Array<MObject*>& MClass::GetAttributes() const
|
||||
int numAttributes;
|
||||
static void* GetClassAttributesPtr = GetStaticMethodPointer(TEXT("GetClassAttributes"));
|
||||
CallStaticMethod<void, void*, MObject***, int*>(GetClassAttributesPtr, _handle, &attributes, &numAttributes);
|
||||
_attributes.Resize(numAttributes);
|
||||
for (int i = 0; i < numAttributes; i++)
|
||||
{
|
||||
_attributes[i] = attributes[i];
|
||||
}
|
||||
_attributes.Set(attributes, numAttributes);
|
||||
MCore::GC::FreeMemory(attributes);
|
||||
|
||||
_hasCachedAttributes = true;
|
||||
@@ -1444,7 +1439,7 @@ const Array<MObject*>& MProperty::GetAttributes() const
|
||||
MAssembly* GetAssembly(void* assemblyHandle)
|
||||
{
|
||||
MAssembly* assembly;
|
||||
if (assemblyHandles.TryGet(assemblyHandle, assembly))
|
||||
if (CachedAssemblyHandles.TryGet(assemblyHandle, assembly))
|
||||
return assembly;
|
||||
return nullptr;
|
||||
}
|
||||
@@ -1452,7 +1447,7 @@ MAssembly* GetAssembly(void* assemblyHandle)
|
||||
MClass* GetClass(MType* typeHandle)
|
||||
{
|
||||
MClass* klass = nullptr;
|
||||
classHandles.TryGet(typeHandle, klass);
|
||||
CachedClassHandles.TryGet(typeHandle, klass);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -1461,7 +1456,7 @@ MClass* GetOrCreateClass(MType* typeHandle)
|
||||
if (!typeHandle)
|
||||
return nullptr;
|
||||
MClass* klass;
|
||||
if (!classHandles.TryGet(typeHandle, klass))
|
||||
if (!CachedClassHandles.TryGet(typeHandle, klass))
|
||||
{
|
||||
NativeClassDefinitions classInfo;
|
||||
void* assemblyHandle;
|
||||
|
||||
Reference in New Issue
Block a user