class
LongOperationTracker
Tracks execution of a long running operation (usually asynchronous operations taking multiple seconds/minutes).
Provides standardized of providing information about progress of the operation.
Public
Constructors
LongOperationTracker
- name
- Name that describes the operation being executed.
- flags
- Flags that describe how the operation is being executed.
- description
- Additional information about the operation.
- category
- Category that may be used for grouping similar operations together.
Methods
~LongOperationTracker
GetName
Name of the operation, to be used in UI and debugging.
GetDescription
Description of the operation, to be used in UI and debugging.
GetCategory
Category of the operation, if provided.
Can be used for grouping similar operations.
CanBeAborted
Returns true if the operation can be aborted.
ReportsProgress
Returns true if progress between range [0, 1] is being reported.
GetProgressPercent
Returns the current operation progress.
Values between [0, 1] are reported only if operation can report progress.
Internal
Methods
NotifyOperationStarted
To be called by external code when the operation starts executing.
NotifyOperationFinished
To be called by external code when the operation finished running and no errors were reported.
Does nothing if operation is already in one of the finished states (success, failed or error).
NotifyOperationAborted
To be called by external code when the operation has processed the user's abort request.
Does nothing if operation is already in one of the finished states (success, failed or error).
NotifyOperationFailed
To be called by external code when the operation has failed with some error.
Does nothing if operation is already in one of the other finished states (success or error). If operation is already in a failed state appends the provided error message to the existing error message.
NotifyProgressChanged
Changes the progress percent of the operation.
Thread safe.
Protected
Fields
mMutex
mState
mProgressPercent
mError
Error reported if the operation failed.