fix: ActivityManager tweaks (#1220)
## Summary **What is the goal of this PR?** Small tweaks to #1016: - Only Activity and ActivityManager can access activityResultHandler and activityResult - `[[maybe_unused]]` in RenderLock constructor - Only ActivityManager and RenderLock can access renderingMutex - Missing renderUpdate after failed wifi selection - Standardize on activities calling finish instead of activityManager.popActivity - Hold RenderLock while mutating state in EpubReaderActivity result handlers --- ### AI Usage While CrossPoint doesn't have restrictions on AI tools in contributing, please be transparent about their usage as it helps set the right context for reviewers. Did you use AI tools to help write this code? _**NO**_
This commit is contained in:
@@ -11,7 +11,6 @@
|
||||
|
||||
#include "GfxRenderer.h"
|
||||
#include "MappedInputManager.h"
|
||||
#include "RenderLock.h"
|
||||
|
||||
class Activity; // forward declaration
|
||||
class RenderLock; // forward declaration
|
||||
@@ -31,6 +30,8 @@ class RenderLock; // forward declaration
|
||||
* - onActivityResult is implemented via a callback instead of a separate method, for simplicity
|
||||
*/
|
||||
class ActivityManager {
|
||||
friend class RenderLock;
|
||||
|
||||
protected:
|
||||
GfxRenderer& renderer;
|
||||
MappedInputManager& mappedInput;
|
||||
@@ -49,6 +50,10 @@ class ActivityManager {
|
||||
static void renderTaskTrampoline(void* param);
|
||||
[[noreturn]] virtual void renderTaskLoop();
|
||||
|
||||
// Mutex to protect rendering operations from race conditions
|
||||
// Must only be used via RenderLock
|
||||
SemaphoreHandle_t renderingMutex = nullptr;
|
||||
|
||||
// Whether to trigger a render after the current loop()
|
||||
// This variable must only be set by the main loop, to avoid race conditions
|
||||
bool requestedUpdate = false;
|
||||
@@ -61,10 +66,6 @@ class ActivityManager {
|
||||
}
|
||||
~ActivityManager() { assert(false); /* should never be called */ };
|
||||
|
||||
// Mutex to protect rendering operations from race conditions
|
||||
// Must only be used via RenderLock
|
||||
SemaphoreHandle_t renderingMutex = nullptr;
|
||||
|
||||
void begin();
|
||||
void loop();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user