#include <sbMetadataJob.h>
Public Types | |
enum | JobType { TYPE_READ = 0, TYPE_WRITE = 1 } |
Public Member Functions | |
sbMetadataJob () | |
virtual | ~sbMetadataJob () |
nsresult | Init (nsIArray *aMediaItemsArray, nsIStringEnumerator *aRequiredProperties, JobType aJobType) |
nsresult | AppendMediaItems (nsIArray *aMediaItemsArray) |
nsresult | AppendJobItem (sbMetadataJobItem *aJobItem) |
nsresult | OnJobProgress () |
nsresult | GetQueuedItem (PRBool aMainThreadOnly, sbMetadataJobItem **aJobItem) |
nsresult | PutProcessedItem (sbMetadataJobItem *aJobItem) |
nsresult | GetType (JobType *aJobType) |
nsresult | SetBlocked (PRBool aBlocked) |
Public Member Functions inherited from sbIJobProgress | |
nsIStringEnumerator | getErrorMessages () |
Enumerate all the errors encountered during the job. More... | |
void | addJobProgressListener (in sbIJobProgressListener aListener) |
Add a listener to be notified when significant job progress has been made. More... | |
void | removeJobProgressListener (in sbIJobProgressListener aListener) |
Remove a previously added listener. More... | |
Public Member Functions inherited from sbIJobCancelable | |
void | cancel () |
Attempt to cancel the job Throws NS_ERROR_FAILURE if canceling fails. More... | |
Public Member Functions inherited from sbIAlbumArtListener | |
void | onChangeFetcher (in sbIAlbumArtFetcher aFetcher) |
onChangeFetcher - Notifies the listener when the fetcher being used has changed. This is used from the sbIAlbumArtFetcherSet component. More... | |
void | onTrackResult (in nsIURI aImageLocation, in sbIMediaItem aMediaItem) |
onTrackResult - Notifies the listener when either an image has or has not been found. aImageLocation will be null if the operation failed to get artwork. More... | |
void | onAlbumResult (in nsIURI aImageLocation, in nsIArray aMediaItems) |
onAlbumResult - Notifies the listener when either an image has or has not been found for a list of items. aImageLocation will be null if the operation failed to get artwork. More... | |
void | onSearchComplete (in nsIArray aMediaItems) |
onSearchComplete - Notifies the listener that the search for artwork has been completed. More... | |
Friends | |
class | sbMediaListBatchCallback |
Additional Inherited Members | |
Public Attributes inherited from sbIJobProgressUI | |
readonly attribute DOMString | crop |
Public Attributes inherited from sbIJobProgress | |
const unsigned short | STATUS_FAILED = 0x00 |
Constant indicating that the job has completed with errors. More... | |
const unsigned short | STATUS_SUCCEEDED = 0x10 |
Constant indicating that the job has completed. More... | |
const unsigned short | STATUS_RUNNING = 0x20 |
Constant indicating that the job is active. More... | |
readonly attribute unsigned short | status |
Current status of the job. More... | |
readonly attribute boolean | blocked |
If true, progress of job is blocked (e.g., due to locked resource). More... | |
readonly attribute AString | statusText |
Localized message describing the status of the job. More... | |
readonly attribute AString | titleText |
Localized message describing the type or purpose of the job. More... | |
readonly attribute unsigned long | progress |
Number of work units completed. More... | |
readonly attribute unsigned long | total |
Total number of work units to be completed May be set to 0 if the job length is indeterminate. More... | |
readonly attribute unsigned long | errorCount |
Number of errors that have been encountered. More... | |
Public Attributes inherited from sbIJobCancelable | |
readonly attribute boolean | canCancel |
True if it is possible to cancel the job. More... | |
A container of sbMetadataJobItems representing a request to sbFileMetadataService. Provides feedback to the caller via sbIJobProgress, and allows the request to be cancelled via sbIJobCancelable.
Expects job items to be taken from the container, processed, and then returned in a completed state. Responsible for preparing media item properties when writing, and filtering and setting propertes when reading.
All interactions other than GetQueuedItem and PutProcessedItem must be performed on the main thread.
Definition at line 80 of file sbMetadataJob.h.
Enumerator | |
---|---|
TYPE_READ | |
TYPE_WRITE |
Definition at line 95 of file sbMetadataJob.h.
sbMetadataJob::sbMetadataJob | ( | ) |
|
virtual |
Definition at line 149 of file sbMetadataJob.cpp.
nsresult sbMetadataJob::AppendJobItem | ( | sbMetadataJobItem * | aJobItem | ) |
Append an existing job item to the queue.
aJobItem | The job item to append to the queue. |
Definition at line 401 of file sbMetadataJob.cpp.
nsresult sbMetadataJob::AppendMediaItems | ( | nsIArray * | aMediaItemsArray | ) |
Add additional media items to the job.
Notes:
aMediaItemsArray | Array of sbIMediaItems |
Definition at line 253 of file sbMetadataJob.cpp.
nsresult sbMetadataJob::GetQueuedItem | ( | PRBool | aMainThreadOnly, |
sbMetadataJobItem ** | aJobItem | ||
) |
Take a waiting job item for processing. Will prepare job item properties and handler appropriately
May be called off of the main thread.
aMainThreadOnly | If true, will return a job item that needs to be run on the main thread due to implementation details. |
aJobItem | The job item to be processed |
Definition at line 515 of file sbMetadataJob.cpp.
nsresult sbMetadataJob::GetType | ( | JobType * | aJobType | ) |
TYPE_READ or TYPE_WRITE
Definition at line 1320 of file sbMetadataJob.cpp.
nsresult sbMetadataJob::Init | ( | nsIArray * | aMediaItemsArray, |
nsIStringEnumerator * | aRequiredProperties, | ||
JobType | aJobType | ||
) |
Initialize the job with the given media items. Called by sbFileMetadataService when a request is received.
Notes:
aMediaItemsArray | Array of sbIMediaItems |
aRequiredProperties | Array of nsStrings for properties to use. |
aJobType | Operation to perform (TYPE_READ or TYPE_WRITE) |
Definition at line 166 of file sbMetadataJob.cpp.
nsresult sbMetadataJob::OnJobProgress | ( | ) |
Notify listeners of job progress. To be called periodically by the main thread timer in sbFileMetadataService.
Definition at line 1249 of file sbMetadataJob.cpp.
nsresult sbMetadataJob::PutProcessedItem | ( | sbMetadataJobItem * | aJobItem | ) |
Give back a job item after processing has been attempted. Records progress and may perform additional processing on the item.
May be called off of the main thread.
aJobItem | The job item that has been processed |
Definition at line 581 of file sbMetadataJob.cpp.
nsresult sbMetadataJob::SetBlocked | ( | PRBool | aBlocked | ) |
Set the job blocked status to the value specified by aBlocked.
aBlocked | Job blocked status. |
Definition at line 1328 of file sbMetadataJob.cpp.
|
friend |
Definition at line 85 of file sbMetadataJob.h.