package daemon: Move pending job accounting back to Volume

This commit is contained in:
Ingo Weinhold
2014-04-26 15:34:17 +02:00
parent fb53533e86
commit 7a35d803d0
4 changed files with 7 additions and 32 deletions
+5 -4
View File
@@ -99,7 +99,8 @@ Volume::Volume(BLooper* looper)
fNodeMonitorEventHandleTime(0),
fPackagesToBeActivated(),
fPackagesToBeDeactivated(),
fLocationInfoReply(B_MESSAGE_GET_INSTALLATION_LOCATION_INFO_REPLY)
fLocationInfoReply(B_MESSAGE_GET_INSTALLATION_LOCATION_INFO_REPLY),
fPendingPackageJobCount(0)
{
looper->AddHandler(this);
}
@@ -425,21 +426,21 @@ Volume::HandleCommitTransactionRequest(BMessage* message)
void
Volume::PackageJobPending()
{
fState->PackageJobPending();
atomic_add(&fPendingPackageJobCount, 1);
}
void
Volume::PackageJobFinished()
{
fState->PackageJobFinished();
atomic_add(&fPendingPackageJobCount, -1);
}
bool
Volume::IsPackageJobPending() const
{
return fState->IsPackageJobPending();
return fPendingPackageJobCount != 0;
}
+1
View File
@@ -185,6 +185,7 @@ private:
PackageSet fPackagesToBeDeactivated;
BMessage fLocationInfoReply;
// only accessed in the application thread
int32 fPendingPackageJobCount;
};
+1 -2
View File
@@ -17,8 +17,7 @@ VolumeState::VolumeState()
fLock("volume state"),
fPackagesByFileName(),
fPackagesByNodeRef(),
fChangeCount(0),
fPendingPackageJobCount(0)
fChangeCount(0)
{
}
-26
View File
@@ -44,10 +44,6 @@ public:
const PackageSet& activatedPackage,
const PackageSet& deactivatePackages);
void PackageJobPending();
void PackageJobFinished();
bool IsPackageJobPending() const;
private:
void _RemovePackage(Package* package);
@@ -56,7 +52,6 @@ private:
PackageFileNameHashTable fPackagesByFileName;
PackageNodeRefHashTable fPackagesByNodeRef;
int64 fChangeCount;
int32 fPendingPackageJobCount;
};
@@ -88,25 +83,4 @@ VolumeState::ByNodeRefIterator() const
}
inline void
VolumeState::PackageJobPending()
{
atomic_add(&fPendingPackageJobCount, 1);
}
inline void
VolumeState::PackageJobFinished()
{
atomic_add(&fPendingPackageJobCount, -1);
}
inline bool
VolumeState::IsPackageJobPending() const
{
return fPendingPackageJobCount != 0;
}
#endif // VOLUME_STATE_H