diff --git a/parameter/ConfigurableDomain.cpp b/parameter/ConfigurableDomain.cpp index 35acb9caf..525e11e37 100644 --- a/parameter/ConfigurableDomain.cpp +++ b/parameter/ConfigurableDomain.cpp @@ -519,45 +519,35 @@ const CDomainConfiguration* CConfigurableDomain::getPendingConfiguration() const } // Configuration application if required -void CConfigurableDomain::apply(CParameterBlackboard* pParameterBlackboard, CSyncerSet* pSyncerSet, bool bForce) const +void CConfigurableDomain::apply(CParameterBlackboard* pParameterBlackboard, + CSyncerSet& syncerSet, + bool bForce) const { - // Apply configuration only if the blackboard will - // be synchronized either now or by syncerSet. - if(!pSyncerSet ^ _bSequenceAware) { - // The configuration can not be syncronised - return; - } - if (bForce) { // Force a configuration restore by forgetting about last applied configuration _pLastAppliedConfiguration = NULL; } const CDomainConfiguration* pApplicableDomainConfiguration = findApplicableDomainConfiguration(); - if (pApplicableDomainConfiguration) { - - // Check not the last one before applying - if (!_pLastAppliedConfiguration || _pLastAppliedConfiguration != pApplicableDomainConfiguration) { - - log_info("Applying configuration \"%s\" from domain \"%s\"", - pApplicableDomainConfiguration->getName().c_str(), - getName().c_str()); + // Check the last applied configuration is different from this one before apply + if (pApplicableDomainConfiguration != NULL && + _pLastAppliedConfiguration != pApplicableDomainConfiguration) { - // Check if we need to synchronize during restore - bool bSync = !pSyncerSet && _bSequenceAware; + log_info("Applying configuration \"%s\" from domain \"%s\"", + pApplicableDomainConfiguration->getName().c_str(), + getName().c_str()); - // Do the restore - pApplicableDomainConfiguration->restore(pParameterBlackboard, bSync, NULL); + // Do the restore, and synchronize if we are sequence aware + pApplicableDomainConfiguration->restore(pParameterBlackboard, _bSequenceAware, NULL); - // Record last applied configuration - _pLastAppliedConfiguration = pApplicableDomainConfiguration; + // Record last applied configuration + _pLastAppliedConfiguration = pApplicableDomainConfiguration; - // Check we need to provide syncer set to caller - if (pSyncerSet && !_bSequenceAware) { + // Check we need to provide syncer set to caller + if (!_bSequenceAware) { - // Since we applied changes, add our own sync set to the given one - *pSyncerSet += _syncerSet; - } + // Since we applied changes, add our own sync set to the given one + syncerSet += _syncerSet; } } } diff --git a/parameter/ConfigurableDomain.h b/parameter/ConfigurableDomain.h index a29c1ba04..07fb05c7c 100644 --- a/parameter/ConfigurableDomain.h +++ b/parameter/ConfigurableDomain.h @@ -95,8 +95,15 @@ class CConfigurableDomain : public CBinarySerializableElement // Ensure validity on whole domain from main blackboard void validate(const CParameterBlackboard* pMainBlackboard); - // Configuration application if required - void apply(CParameterBlackboard* pParameterBlackboard, CSyncerSet* pSyncerSet, bool bForced) const; + /** Apply the configuration if required + * + * @param[in] pParameterBlackboard the blackboard to synchronize + * @param[in] syncerSet the set containing application syncers + * @param[in] bForced boolean used to force configuration application + */ + void apply(CParameterBlackboard* pParameterBlackboard, + CSyncerSet& syncerSet, + bool bForced) const; // Return applicable configuration validity for given configurable element bool isApplicableConfigurationValid(const CConfigurableElement* pConfigurableElement) const; diff --git a/parameter/ConfigurableDomains.cpp b/parameter/ConfigurableDomains.cpp index b77e2aad9..b39968e4c 100644 --- a/parameter/ConfigurableDomains.cpp +++ b/parameter/ConfigurableDomains.cpp @@ -83,19 +83,10 @@ void CConfigurableDomains::apply(CParameterBlackboard* pParameterBlackboard, CSy const CConfigurableDomain* pChildConfigurableDomain = static_cast(getChild(uiChild)); // Apply and collect syncers when relevant - pChildConfigurableDomain->apply(pParameterBlackboard, &syncerSet, bForce); + pChildConfigurableDomain->apply(pParameterBlackboard, syncerSet, bForce); } // Synchronize those collected syncers syncerSet.sync(*pParameterBlackboard, false, NULL); - - // Then deal with domains that need to synchronize along apply - for (uiChild = 0; uiChild < uiNbConfigurableDomains; uiChild++) { - - const CConfigurableDomain* pChildConfigurableDomain = static_cast(getChild(uiChild)); - - // Apply and synchronize when relevant - pChildConfigurableDomain->apply(pParameterBlackboard, NULL, bForce); - } } // From IXmlSource