refs #601 Slot inhibitor no longer needed, this reverts commit:bc2e0faa.

This commit is contained in:
Mathew Sutcliffe
2016-03-09 20:37:34 +00:00
parent a47a2681bd
commit f680cee8ed
3 changed files with 4 additions and 22 deletions

View File

@@ -192,19 +192,9 @@ namespace BlackMisc
{ {
if (! m_deferredChanges.isEmpty()) if (! m_deferredChanges.isEmpty())
{ {
auto promises = m_cache->m_revision.loadedValuePromises();
for (const auto &tuple : promises)
{
QObject *pageOwner = nullptr;
QString key;
std::tie(pageOwner, key, std::ignore) = tuple;
m_deferredChanges.inhibit(pageOwner, key); // don't fire notification slots for objects waiting on syncLoad futures
}
m_deferredChanges.setSaved(); m_deferredChanges.setSaved();
emit valuesLoadedFromStore(m_deferredChanges, CIdentifier::anonymous()); emit valuesLoadedFromStore(m_deferredChanges, CIdentifier::anonymous());
deliverPromises(std::move(promises)); deliverPromises(m_cache->m_revision.loadedValuePromises());
m_deferredChanges.clear(); m_deferredChanges.clear();
} }
} }

View File

@@ -78,7 +78,6 @@ namespace BlackMisc
{ {
MetaType::registerMetadata(); MetaType::registerMetadata();
qDBusRegisterMetaType<value_type>(); qDBusRegisterMetaType<value_type>();
qDBusRegisterMetaType<decltype(m_inhibitions)::value_type>();
} }
//////////////////////////////// ////////////////////////////////
@@ -493,7 +492,7 @@ namespace BlackMisc
QList<NotifySlot> notifySlots; QList<NotifySlot> notifySlots;
forEachIntersection(m_elements, values, [changedBy, this, &notifySlots, &values](const QString & key, const ElementPtr & element, CValueCachePacket::const_iterator it) forEachIntersection(m_elements, values, [changedBy, this, &notifySlots, &values](const QString &, const ElementPtr & element, CValueCachePacket::const_iterator it)
{ {
if (changedBy == this) // round trip if (changedBy == this) // round trip
{ {
@@ -508,7 +507,7 @@ namespace BlackMisc
element->m_value.uniqueWrite() = it.value(); element->m_value.uniqueWrite() = it.value();
element->m_timestamp = it.timestamp(); element->m_timestamp = it.timestamp();
element->m_saved = values.isSaved(); element->m_saved = values.isSaved();
if (element->m_notifySlot && ! notifySlots.contains(element->m_notifySlot) && ! values.isInhibited(parent(), key)) if (element->m_notifySlot && ! notifySlots.contains(element->m_notifySlot))
{ {
notifySlots.push_back(element->m_notifySlot); notifySlots.push_back(element->m_notifySlot);
} }

View File

@@ -54,12 +54,6 @@ namespace BlackMisc
//! Insert values from another packet. //! Insert values from another packet.
void insert(const CValueCachePacket &other) { CDictionary::insert(other); } void insert(const CValueCachePacket &other) { CDictionary::insert(other); }
//! Add a page owner and key to the list of inhibited notifications.
void inhibit(QObject *pageOwner, const QString &key) { m_inhibitions.push_back(std::make_pair(reinterpret_cast<quintptr>(pageOwner), key)); }
//! Query whether a particular owner/key pair should have its notification inhibited.
bool isInhibited(QObject *pageOwner, const QString &key) const { return m_inhibitions.contains(std::make_pair(reinterpret_cast<quintptr>(pageOwner), key)); }
//! Discard timestamps and return as variant map. //! Discard timestamps and return as variant map.
CVariantMap toVariantMap() const; CVariantMap toVariantMap() const;
@@ -93,7 +87,6 @@ namespace BlackMisc
private: private:
BLACK_ENABLE_TUPLE_CONVERSION(CValueCachePacket) BLACK_ENABLE_TUPLE_CONVERSION(CValueCachePacket)
bool m_saved = false; bool m_saved = false;
CSequence<std::pair<quintptr, QString>> m_inhibitions;
}; };
/*! /*!
@@ -368,6 +361,6 @@ namespace BlackMisc
} // namespace } // namespace
Q_DECLARE_METATYPE(BlackMisc::CValueCachePacket) Q_DECLARE_METATYPE(BlackMisc::CValueCachePacket)
BLACK_DECLARE_TUPLE_CONVERSION(BlackMisc::CValueCachePacket, (attr(o.m_saved), attr(o.m_inhibitions))) BLACK_DECLARE_TUPLE_CONVERSION(BlackMisc::CValueCachePacket, (attr(o.m_saved)))
#endif #endif