public override void Update() { base.Update(); if (m_ElementsToBind.Count > 0) { using (s_ProfilerBindingRequestsMarker.Auto()) { long startTime = CurrentTime(); while (m_ElementsToBind.Count > 0 && (CurrentTime() - startTime) < k_MaxBindingTimeMs) { var element = m_ElementsToBind.FirstOrDefault(); if (element != null) { m_ElementsToBind.Remove(element); var bindingRequests = element.GetProperty(s_BindingRequestObjectVEPropertyName) as List <IBindingRequest>; if (bindingRequests != null) { element.SetProperty(s_BindingRequestObjectVEPropertyName, null); foreach (var req in bindingRequests) { req.Bind(element); } RequestObjectListPool.Release(bindingRequests); } } else { break; } } } } PerformTrackingOperations(); if (m_ElementsWithBindings.Count > 0) { long currentTimeMs = CurrentTime(); if (m_LastUpdateTime + k_MinUpdateDelayMs < currentTimeMs) { UpdateBindings(); m_LastUpdateTime = currentTimeMs; } } if (m_ElementsToBind.Count == 0) { temporaryObjectCache.Clear(); //We don't want to keep references to stuff needlessly } }
public static void AddBindingRequest(VisualElement ve, IBindingRequest req) { List <IBindingRequest> l = ve.GetProperty(s_BindingRequestObjectVEPropertyName) as List <IBindingRequest>; if (l == null) { l = RequestObjectListPool.Get(); ve.SetProperty(s_BindingRequestObjectVEPropertyName, l); } l.Add(req); ve.IncrementVersion(VersionChangeType.Bindings); }
public static void ClearBindingRequests(VisualElement ve) { List <IBindingRequest> l = ve.GetProperty(s_BindingRequestObjectVEPropertyName) as List <IBindingRequest>; if (l != null) { foreach (var r in l) { r.Release(); } RequestObjectListPool.Release(l); ve.SetProperty(s_BindingRequestObjectVEPropertyName, null); } }
public static void RemoveBindingRequest(VisualElement ve, IBindingRequest req) { List <IBindingRequest> l = ve.GetProperty(s_BindingRequestObjectVEPropertyName) as List <IBindingRequest>; if (l != null) { req.Release(); l.Remove(req); if (l.Count == 0) { RequestObjectListPool.Release(l); ve.SetProperty(s_BindingRequestObjectVEPropertyName, null); } } }