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), fNodeMonitorEventHandleTime(0),
fPackagesToBeActivated(), fPackagesToBeActivated(),
fPackagesToBeDeactivated(), fPackagesToBeDeactivated(),
fLocationInfoReply(B_MESSAGE_GET_INSTALLATION_LOCATION_INFO_REPLY) fLocationInfoReply(B_MESSAGE_GET_INSTALLATION_LOCATION_INFO_REPLY),
fPendingPackageJobCount(0)
{ {
looper->AddHandler(this); looper->AddHandler(this);
} }
@@ -425,21 +426,21 @@ Volume::HandleCommitTransactionRequest(BMessage* message)
void void
Volume::PackageJobPending() Volume::PackageJobPending()
{ {
fState->PackageJobPending(); atomic_add(&fPendingPackageJobCount, 1);
} }
void void
Volume::PackageJobFinished() Volume::PackageJobFinished()
{ {
fState->PackageJobFinished(); atomic_add(&fPendingPackageJobCount, -1);
} }
bool bool
Volume::IsPackageJobPending() const Volume::IsPackageJobPending() const
{ {
return fState->IsPackageJobPending(); return fPendingPackageJobCount != 0;
} }
+1
View File
@@ -185,6 +185,7 @@ private:
PackageSet fPackagesToBeDeactivated; PackageSet fPackagesToBeDeactivated;
BMessage fLocationInfoReply; BMessage fLocationInfoReply;
// only accessed in the application thread // only accessed in the application thread
int32 fPendingPackageJobCount;
}; };
+1 -2
View File
@@ -17,8 +17,7 @@ VolumeState::VolumeState()
fLock("volume state"), fLock("volume state"),
fPackagesByFileName(), fPackagesByFileName(),
fPackagesByNodeRef(), fPackagesByNodeRef(),
fChangeCount(0), fChangeCount(0)
fPendingPackageJobCount(0)
{ {
} }
-26
View File
@@ -44,10 +44,6 @@ public:
const PackageSet& activatedPackage, const PackageSet& activatedPackage,
const PackageSet& deactivatePackages); const PackageSet& deactivatePackages);
void PackageJobPending();
void PackageJobFinished();
bool IsPackageJobPending() const;
private: private:
void _RemovePackage(Package* package); void _RemovePackage(Package* package);
@@ -56,7 +52,6 @@ private:
PackageFileNameHashTable fPackagesByFileName; PackageFileNameHashTable fPackagesByFileName;
PackageNodeRefHashTable fPackagesByNodeRef; PackageNodeRefHashTable fPackagesByNodeRef;
int64 fChangeCount; 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 #endif // VOLUME_STATE_H