diff data/model/DeferredNotifier.h @ 1752:6d09d68165a4 by-id

Further review of ById: make IDs only available when adding a model to the ById store, not by querying the item directly. This means any id encountered in the wild must have been added to the store at some point (even if later released), which simplifies reasoning about lifecycles
author Chris Cannam
date Fri, 05 Jul 2019 15:28:07 +0100
parents 7a56bb85030f
children
line wrap: on
line diff
--- a/data/model/DeferredNotifier.h	Thu Jul 04 18:04:21 2019 +0100
+++ b/data/model/DeferredNotifier.h	Fri Jul 05 15:28:07 2019 +0100
@@ -30,7 +30,8 @@
         NOTIFY_DEFERRED
     };
     
-    DeferredNotifier(Model *m, Mode mode) : m_model(m), m_mode(mode) { }
+    DeferredNotifier(Model *m, ModelId id, Mode mode) :
+        m_model(m), m_modelId(id), m_mode(mode) { }
 
     Mode getMode() const {
         return m_mode;
@@ -41,7 +42,7 @@
     
     void update(sv_frame_t frame, sv_frame_t duration) {
         if (m_mode == NOTIFY_ALWAYS) {
-            m_model->modelChangedWithin(frame, frame + duration);
+            m_model->modelChangedWithin(m_modelId, frame, frame + duration);
         } else {
             QMutexLocker locker(&m_mutex);
             m_extents.sample(frame);
@@ -60,7 +61,7 @@
             }
         }
         if (shouldEmit) {
-            m_model->modelChangedWithin(from, to);
+            m_model->modelChangedWithin(m_modelId, from, to);
             QMutexLocker locker(&m_mutex);
             m_extents.reset();
         }
@@ -68,6 +69,7 @@
 
 private:
     Model *m_model;
+    ModelId m_modelId;
     Mode m_mode;
     QMutex m_mutex;
     Extents<sv_frame_t> m_extents;