diff options
Diffstat (limited to 'src/gallium/drivers/swr/rasterizer/archrast')
3 files changed, 22 insertions, 10 deletions
diff --git a/src/gallium/drivers/swr/rasterizer/archrast/archrast.cpp b/src/gallium/drivers/swr/rasterizer/archrast/archrast.cpp index c29bb884588..574098d80a8 100644 --- a/src/gallium/drivers/swr/rasterizer/archrast/archrast.cpp +++ b/src/gallium/drivers/swr/rasterizer/archrast/archrast.cpp @@ -43,8 +43,8 @@ namespace ArchRast EventHandlerStatsFile(uint32_t id) : EventHandlerFile(id) {} // These are events that we're not interested in saving in stats event files. - virtual void handle(Start& event) {} - virtual void handle(End& event) {} + virtual void Handle(Start& event) {} + virtual void Handle(End& event) {} }; static EventManager* FromHandle(HANDLE hThreadContext) @@ -64,7 +64,7 @@ namespace ArchRast if (pManager && pHandler) { - pManager->attach(pHandler); + pManager->Attach(pHandler); return pManager; } @@ -82,11 +82,11 @@ namespace ArchRast } // Dispatch event for this thread. - void dispatch(HANDLE hThreadContext, Event& event) + void Dispatch(HANDLE hThreadContext, Event& event) { EventManager* pManager = FromHandle(hThreadContext); SWR_ASSERT(pManager != nullptr); - pManager->dispatch(event); + pManager->Dispatch(event); } } diff --git a/src/gallium/drivers/swr/rasterizer/archrast/archrast.h b/src/gallium/drivers/swr/rasterizer/archrast/archrast.h index bdb3afbed99..e6376f208fe 100644 --- a/src/gallium/drivers/swr/rasterizer/archrast/archrast.h +++ b/src/gallium/drivers/swr/rasterizer/archrast/archrast.h @@ -36,6 +36,6 @@ namespace ArchRast void DestroyThreadContext(HANDLE hThreadContext); // Dispatch event for this thread. - void dispatch(HANDLE hThreadContext, Event& event); + void Dispatch(HANDLE hThreadContext, Event& event); }; diff --git a/src/gallium/drivers/swr/rasterizer/archrast/eventmanager.h b/src/gallium/drivers/swr/rasterizer/archrast/eventmanager.h index d162ca8fe57..78ba8f3e2d7 100644 --- a/src/gallium/drivers/swr/rasterizer/archrast/eventmanager.h +++ b/src/gallium/drivers/swr/rasterizer/archrast/eventmanager.h @@ -43,24 +43,36 @@ namespace ArchRast class EventManager { public: - void attach(EventHandler* pHandler) + EventManager() {} + + ~EventManager() + { + // Event manager owns destroying handler objects once attached. + ///@note See comment for Detach. + for (auto pHandler : mHandlers) + { + delete pHandler; + } + } + + void Attach(EventHandler* pHandler) { mHandlers.push_back(pHandler); } - void dispatch(Event& event) + void Dispatch(Event& event) { ///@todo Add event filter check here. for (auto pHandler : mHandlers) { - event.accept(pHandler); + event.Accept(pHandler); } } private: // Handlers stay registered for life - void detach(EventHandler* pHandler) { SWR_ASSERT(0); } + void Detach(EventHandler* pHandler) { SWR_ASSERT(0); } std::vector<EventHandler*> mHandlers; }; |