| 37 | } |
| 38 | |
| 39 | bool SurfaceManager::init() { |
| 40 | AGENUI_LOG("init, %d", _instanceId); |
| 41 | // Create EventDispatcher and flush cached listeners under the same lock |
| 42 | // to prevent race with addSurfaceEventListener/removeSurfaceEventListener |
| 43 | { |
| 44 | std::lock_guard<std::mutex> mutexWrap(_cachedListenersMutex); |
| 45 | _dispatcher = new EventDispatcher(); |
| 46 | for (const auto &listener : _cachedListeners) { |
| 47 | AGENUI_LOG("add cached listener %p", listener); |
| 48 | _dispatcher->addEventListener(listener); |
| 49 | } |
| 50 | _cachedListeners.clear(); |
| 51 | } |
| 52 | |
| 53 | // Create modules in dependency order |
| 54 | createSurfaceCoordinator(); |
| 55 | createStreamingContentParser(); |
| 56 | return true; |
| 57 | } |
| 58 | |
| 59 | void SurfaceManager::uninit() { |
| 60 | AGENUI_LOG("uninit, %d", _instanceId); |
no test coverage detected