package daemon: Move pending job accounting back to Volume
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -185,6 +185,7 @@ private:
|
||||
PackageSet fPackagesToBeDeactivated;
|
||||
BMessage fLocationInfoReply;
|
||||
// only accessed in the application thread
|
||||
int32 fPendingPackageJobCount;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -17,8 +17,7 @@ VolumeState::VolumeState()
|
||||
fLock("volume state"),
|
||||
fPackagesByFileName(),
|
||||
fPackagesByNodeRef(),
|
||||
fChangeCount(0),
|
||||
fPendingPackageJobCount(0)
|
||||
fChangeCount(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user