Moved BJob, and JobQueue into the support kit.

* Put it in the BSupportKit namespace, following the style introduced
  with the package kit for now.
* The BSupportKit::BJob class no longer knows about the package kit's
  Context class. However, the BPackageKit::BJob class does.
* Due to the namespace juggling, a lot of files had to be touched.
* The JobQueue class remains private.
* Due to the way Haiku is built on itself, you cannot build this change
  under Haiku with an older release.
This commit is contained in:
Axel Dörfler
2015-05-21 21:37:01 +02:00
parent 5f9f1ac662
commit e711e6e42f
35 changed files with 519 additions and 399 deletions
-66
View File
@@ -1,66 +0,0 @@
/*
* Copyright 2011, Haiku, Inc.
* Distributed under the terms of the MIT License.
*/
#ifndef _PACKAGE__PRIVATE__JOB_QUEUE_H_
#define _PACKAGE__PRIVATE__JOB_QUEUE_H_
#include <Locker.h>
#include <SupportDefs.h>
#include <package/Job.h>
namespace BPackageKit {
namespace BPrivate {
class JobQueue : private BJobStateListener {
public:
JobQueue();
virtual ~JobQueue();
status_t InitCheck() const;
status_t AddJob(BJob* job);
// takes ownership
status_t RemoveJob(BJob* job);
// gives up ownership
BJob* Pop();
// caller owns job
void Close();
private:
// BJobStateListener
virtual void JobSucceeded(BJob* job);
virtual void JobFailed(BJob* job);
private:
struct JobPriorityLess;
class JobPriorityQueue;
private:
status_t _Init();
void _RequeueDependantJobsOf(BJob* job);
void _RemoveDependantJobsOf(BJob* job);
BLocker fLock;
uint32 fNextTicketNumber;
JobPriorityQueue* fQueuedJobs;
sem_id fHaveRunnableJobSem;
status_t fInitStatus;
};
} // namespace BPrivate
} // namespace BPackageKit
#endif // _PACKAGE__PRIVATE__JOB_QUEUE_H_
@@ -29,7 +29,7 @@
namespace BPackageKit {
class BCommitTransactionResult;
@@ -42,7 +42,7 @@ using BPackageKit::BPrivate::BActivationTransaction;
using BPackageKit::BPrivate::BDaemonClient;
class BPackageManager : protected BJobStateListener {
class BPackageManager : protected BSupportKit::BJobStateListener {
public:
class RemoteRepository;
class LocalRepository;
@@ -118,9 +118,9 @@ protected:
protected:
// BJobStateListener
virtual void JobStarted(BJob* job);
virtual void JobProgress(BJob* job);
virtual void JobSucceeded(BJob* job);
virtual void JobStarted(BSupportKit::BJob* job);
virtual void JobProgress(BSupportKit::BJob* job);
virtual void JobSucceeded(BSupportKit::BJob* job);
private:
void _HandleProblems();