ProgressImpl.h revision c663b1d0961e81d772030d918e3b186ea6d93774
b2640405e06105d868b5fc8f7b676bb680884380vboxsync/* $Id$ */
b2640405e06105d868b5fc8f7b676bb680884380vboxsync/** @file
b2640405e06105d868b5fc8f7b676bb680884380vboxsync *
b2640405e06105d868b5fc8f7b676bb680884380vboxsync * VirtualBox COM class implementation
b2640405e06105d868b5fc8f7b676bb680884380vboxsync */
b2640405e06105d868b5fc8f7b676bb680884380vboxsync
b2640405e06105d868b5fc8f7b676bb680884380vboxsync/*
b2640405e06105d868b5fc8f7b676bb680884380vboxsync * Copyright (C) 2006-2010 Oracle Corporation
b2640405e06105d868b5fc8f7b676bb680884380vboxsync *
b2640405e06105d868b5fc8f7b676bb680884380vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
b2640405e06105d868b5fc8f7b676bb680884380vboxsync * available from http://www.virtualbox.org. This file is free software;
b2640405e06105d868b5fc8f7b676bb680884380vboxsync * you can redistribute it and/or modify it under the terms of the GNU
b2640405e06105d868b5fc8f7b676bb680884380vboxsync * General Public License (GPL) as published by the Free Software
b2640405e06105d868b5fc8f7b676bb680884380vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
b2640405e06105d868b5fc8f7b676bb680884380vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
b2640405e06105d868b5fc8f7b676bb680884380vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
b2640405e06105d868b5fc8f7b676bb680884380vboxsync */
b2640405e06105d868b5fc8f7b676bb680884380vboxsync
b2640405e06105d868b5fc8f7b676bb680884380vboxsync#ifndef ____H_PROGRESSIMPL
b2640405e06105d868b5fc8f7b676bb680884380vboxsync#define ____H_PROGRESSIMPL
b2640405e06105d868b5fc8f7b676bb680884380vboxsync
b2640405e06105d868b5fc8f7b676bb680884380vboxsync#include "VirtualBoxBase.h"
b2640405e06105d868b5fc8f7b676bb680884380vboxsync
b2640405e06105d868b5fc8f7b676bb680884380vboxsync#include <VBox/com/SupportErrorInfo.h>
b2640405e06105d868b5fc8f7b676bb680884380vboxsync
b2640405e06105d868b5fc8f7b676bb680884380vboxsync#include <iprt/semaphore.h>
b2640405e06105d868b5fc8f7b676bb680884380vboxsync
b2640405e06105d868b5fc8f7b676bb680884380vboxsync////////////////////////////////////////////////////////////////////////////////
b2640405e06105d868b5fc8f7b676bb680884380vboxsync
b2640405e06105d868b5fc8f7b676bb680884380vboxsync/**
b2640405e06105d868b5fc8f7b676bb680884380vboxsync * Base component class for progress objects.
b2640405e06105d868b5fc8f7b676bb680884380vboxsync */
b2640405e06105d868b5fc8f7b676bb680884380vboxsyncclass ATL_NO_VTABLE ProgressBase :
b2640405e06105d868b5fc8f7b676bb680884380vboxsync public VirtualBoxBase,
b2640405e06105d868b5fc8f7b676bb680884380vboxsync public com::SupportErrorInfoBase,
b2640405e06105d868b5fc8f7b676bb680884380vboxsync public VirtualBoxSupportTranslation<ProgressBase>,
b2640405e06105d868b5fc8f7b676bb680884380vboxsync VBOX_SCRIPTABLE_IMPL(IProgress)
b2640405e06105d868b5fc8f7b676bb680884380vboxsync{
b2640405e06105d868b5fc8f7b676bb680884380vboxsyncprotected:
b2640405e06105d868b5fc8f7b676bb680884380vboxsync
b2640405e06105d868b5fc8f7b676bb680884380vboxsync VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT (ProgressBase)
b2640405e06105d868b5fc8f7b676bb680884380vboxsync
b2640405e06105d868b5fc8f7b676bb680884380vboxsync DECLARE_EMPTY_CTOR_DTOR (ProgressBase)
b2640405e06105d868b5fc8f7b676bb680884380vboxsync
b2640405e06105d868b5fc8f7b676bb680884380vboxsync HRESULT FinalConstruct();
b2640405e06105d868b5fc8f7b676bb680884380vboxsync
b2640405e06105d868b5fc8f7b676bb680884380vboxsync // protected initializer/uninitializer for internal purposes only
b2640405e06105d868b5fc8f7b676bb680884380vboxsync HRESULT protectedInit(AutoInitSpan &aAutoInitSpan,
b2640405e06105d868b5fc8f7b676bb680884380vboxsync#if !defined (VBOX_COM_INPROC)
b2640405e06105d868b5fc8f7b676bb680884380vboxsync VirtualBox *aParent,
b2640405e06105d868b5fc8f7b676bb680884380vboxsync#endif
b2640405e06105d868b5fc8f7b676bb680884380vboxsync IUnknown *aInitiator,
b2640405e06105d868b5fc8f7b676bb680884380vboxsync CBSTR aDescription, OUT_GUID aId = NULL);
b2640405e06105d868b5fc8f7b676bb680884380vboxsync HRESULT protectedInit(AutoInitSpan &aAutoInitSpan);
b2640405e06105d868b5fc8f7b676bb680884380vboxsync void protectedUninit(AutoUninitSpan &aAutoUninitSpan);
b2640405e06105d868b5fc8f7b676bb680884380vboxsync
b2640405e06105d868b5fc8f7b676bb680884380vboxsyncpublic:
b2640405e06105d868b5fc8f7b676bb680884380vboxsync
b2640405e06105d868b5fc8f7b676bb680884380vboxsync // IProgress properties
b2640405e06105d868b5fc8f7b676bb680884380vboxsync STDMETHOD(COMGETTER(Id)) (BSTR *aId);
b2640405e06105d868b5fc8f7b676bb680884380vboxsync STDMETHOD(COMGETTER(Description)) (BSTR *aDescription);
b2640405e06105d868b5fc8f7b676bb680884380vboxsync STDMETHOD(COMGETTER(Initiator)) (IUnknown **aInitiator);
b2640405e06105d868b5fc8f7b676bb680884380vboxsync
b2640405e06105d868b5fc8f7b676bb680884380vboxsync // IProgress properties
b2640405e06105d868b5fc8f7b676bb680884380vboxsync STDMETHOD(COMGETTER(Cancelable)) (BOOL *aCancelable);
b2640405e06105d868b5fc8f7b676bb680884380vboxsync STDMETHOD(COMGETTER(Percent)) (ULONG *aPercent);
b2640405e06105d868b5fc8f7b676bb680884380vboxsync STDMETHOD(COMGETTER(TimeRemaining)) (LONG *aTimeRemaining);
b2640405e06105d868b5fc8f7b676bb680884380vboxsync STDMETHOD(COMGETTER(Completed)) (BOOL *aCompleted);
b2640405e06105d868b5fc8f7b676bb680884380vboxsync STDMETHOD(COMGETTER(Canceled)) (BOOL *aCanceled);
b2640405e06105d868b5fc8f7b676bb680884380vboxsync STDMETHOD(COMGETTER(ResultCode)) (LONG *aResultCode);
b2640405e06105d868b5fc8f7b676bb680884380vboxsync STDMETHOD(COMGETTER(ErrorInfo)) (IVirtualBoxErrorInfo **aErrorInfo);
b2640405e06105d868b5fc8f7b676bb680884380vboxsync STDMETHOD(COMGETTER(OperationCount)) (ULONG *aOperationCount);
b2640405e06105d868b5fc8f7b676bb680884380vboxsync STDMETHOD(COMGETTER(Operation)) (ULONG *aOperation);
b2640405e06105d868b5fc8f7b676bb680884380vboxsync STDMETHOD(COMGETTER(OperationDescription)) (BSTR *aOperationDescription);
b2640405e06105d868b5fc8f7b676bb680884380vboxsync STDMETHOD(COMGETTER(OperationPercent)) (ULONG *aOperationPercent);
b2640405e06105d868b5fc8f7b676bb680884380vboxsync STDMETHOD(COMSETTER(Timeout)) (ULONG aTimeout);
b2640405e06105d868b5fc8f7b676bb680884380vboxsync STDMETHOD(COMGETTER(Timeout)) (ULONG *aTimeout);
b2640405e06105d868b5fc8f7b676bb680884380vboxsync
b2640405e06105d868b5fc8f7b676bb680884380vboxsync // public methods only for internal purposes
b2640405e06105d868b5fc8f7b676bb680884380vboxsync
b2640405e06105d868b5fc8f7b676bb680884380vboxsync static HRESULT setErrorInfoOnThread (IProgress *aProgress);
b2640405e06105d868b5fc8f7b676bb680884380vboxsync bool setCancelCallback(void (*pfnCallback)(void *), void *pvUser);
b2640405e06105d868b5fc8f7b676bb680884380vboxsync
b2640405e06105d868b5fc8f7b676bb680884380vboxsync
b2640405e06105d868b5fc8f7b676bb680884380vboxsync // unsafe inline public methods for internal purposes only (ensure there is
b2640405e06105d868b5fc8f7b676bb680884380vboxsync // a caller and a read lock before calling them!)
b2640405e06105d868b5fc8f7b676bb680884380vboxsync
b2640405e06105d868b5fc8f7b676bb680884380vboxsync BOOL getCompleted() const { return mCompleted; }
b2640405e06105d868b5fc8f7b676bb680884380vboxsync HRESULT getResultCode() const { return mResultCode; }
b2640405e06105d868b5fc8f7b676bb680884380vboxsync double calcTotalPercent();
b2640405e06105d868b5fc8f7b676bb680884380vboxsync
b2640405e06105d868b5fc8f7b676bb680884380vboxsyncprotected:
b2640405e06105d868b5fc8f7b676bb680884380vboxsync void checkForAutomaticTimeout(void);
b2640405e06105d868b5fc8f7b676bb680884380vboxsync
b2640405e06105d868b5fc8f7b676bb680884380vboxsync#if !defined (VBOX_COM_INPROC)
b2640405e06105d868b5fc8f7b676bb680884380vboxsync /** Weak parent. */
b2640405e06105d868b5fc8f7b676bb680884380vboxsync VirtualBox * const mParent;
b2640405e06105d868b5fc8f7b676bb680884380vboxsync#endif
b2640405e06105d868b5fc8f7b676bb680884380vboxsync
b2640405e06105d868b5fc8f7b676bb680884380vboxsync const ComPtr<IUnknown> mInitiator;
b2640405e06105d868b5fc8f7b676bb680884380vboxsync
b2640405e06105d868b5fc8f7b676bb680884380vboxsync const Guid mId;
b2640405e06105d868b5fc8f7b676bb680884380vboxsync const Bstr mDescription;
b2640405e06105d868b5fc8f7b676bb680884380vboxsync
b2640405e06105d868b5fc8f7b676bb680884380vboxsync uint64_t m_ullTimestamp; // progress object creation timestamp, for ETA computation
b2640405e06105d868b5fc8f7b676bb680884380vboxsync
b2640405e06105d868b5fc8f7b676bb680884380vboxsync void (*m_pfnCancelCallback)(void *);
b2640405e06105d868b5fc8f7b676bb680884380vboxsync void *m_pvCancelUserArg;
b2640405e06105d868b5fc8f7b676bb680884380vboxsync
b2640405e06105d868b5fc8f7b676bb680884380vboxsync /* The fields below are to be properly initalized by subclasses */
b2640405e06105d868b5fc8f7b676bb680884380vboxsync
b2640405e06105d868b5fc8f7b676bb680884380vboxsync BOOL mCompleted;
b2640405e06105d868b5fc8f7b676bb680884380vboxsync BOOL mCancelable;
b2640405e06105d868b5fc8f7b676bb680884380vboxsync BOOL mCanceled;
b2640405e06105d868b5fc8f7b676bb680884380vboxsync HRESULT mResultCode;
b2640405e06105d868b5fc8f7b676bb680884380vboxsync ComPtr<IVirtualBoxErrorInfo> mErrorInfo;
b2640405e06105d868b5fc8f7b676bb680884380vboxsync
b2640405e06105d868b5fc8f7b676bb680884380vboxsync ULONG m_cOperations; // number of operations (so that progress dialog can display something like 1/3)
b2640405e06105d868b5fc8f7b676bb680884380vboxsync ULONG m_ulTotalOperationsWeight; // sum of weights of all operations, given to constructor
b2640405e06105d868b5fc8f7b676bb680884380vboxsync
b2640405e06105d868b5fc8f7b676bb680884380vboxsync ULONG m_ulOperationsCompletedWeight; // summed-up weight of operations that have been completed; initially 0
b2640405e06105d868b5fc8f7b676bb680884380vboxsync
b2640405e06105d868b5fc8f7b676bb680884380vboxsync ULONG m_ulCurrentOperation; // operations counter, incremented with each setNextOperation()
b2640405e06105d868b5fc8f7b676bb680884380vboxsync Bstr m_bstrOperationDescription; // name of current operation; initially from constructor, changed with setNextOperation()
b2640405e06105d868b5fc8f7b676bb680884380vboxsync ULONG m_ulCurrentOperationWeight; // weight of current operation, given to setNextOperation()
b2640405e06105d868b5fc8f7b676bb680884380vboxsync ULONG m_ulOperationPercent; // percentage of current operation, set with setCurrentOperationProgress()
b2640405e06105d868b5fc8f7b676bb680884380vboxsync ULONG m_cMsTimeout; /**< Automatic timeout value. 0 means none. */
b2640405e06105d868b5fc8f7b676bb680884380vboxsync};
b2640405e06105d868b5fc8f7b676bb680884380vboxsync
b2640405e06105d868b5fc8f7b676bb680884380vboxsync////////////////////////////////////////////////////////////////////////////////
b2640405e06105d868b5fc8f7b676bb680884380vboxsync
b2640405e06105d868b5fc8f7b676bb680884380vboxsync/**
b2640405e06105d868b5fc8f7b676bb680884380vboxsync * Normal progress object.
b2640405e06105d868b5fc8f7b676bb680884380vboxsync */
b2640405e06105d868b5fc8f7b676bb680884380vboxsyncclass ATL_NO_VTABLE Progress :
b2640405e06105d868b5fc8f7b676bb680884380vboxsync public com::SupportErrorInfoDerived<ProgressBase, Progress, IProgress>,
b2640405e06105d868b5fc8f7b676bb680884380vboxsync public VirtualBoxSupportTranslation<Progress>
b2640405e06105d868b5fc8f7b676bb680884380vboxsync{
b2640405e06105d868b5fc8f7b676bb680884380vboxsync
b2640405e06105d868b5fc8f7b676bb680884380vboxsyncpublic:
b2640405e06105d868b5fc8f7b676bb680884380vboxsync
b2640405e06105d868b5fc8f7b676bb680884380vboxsync VIRTUALBOXSUPPORTTRANSLATION_OVERRIDE (Progress)
b2640405e06105d868b5fc8f7b676bb680884380vboxsync
b2640405e06105d868b5fc8f7b676bb680884380vboxsync DECLARE_NOT_AGGREGATABLE (Progress)
b2640405e06105d868b5fc8f7b676bb680884380vboxsync
b2640405e06105d868b5fc8f7b676bb680884380vboxsync DECLARE_PROTECT_FINAL_CONSTRUCT()
b2640405e06105d868b5fc8f7b676bb680884380vboxsync
b2640405e06105d868b5fc8f7b676bb680884380vboxsync BEGIN_COM_MAP (Progress)
b2640405e06105d868b5fc8f7b676bb680884380vboxsync COM_INTERFACE_ENTRY (ISupportErrorInfo)
b2640405e06105d868b5fc8f7b676bb680884380vboxsync COM_INTERFACE_ENTRY (IProgress)
b2640405e06105d868b5fc8f7b676bb680884380vboxsync COM_INTERFACE_ENTRY2 (IDispatch, IProgress)
b2640405e06105d868b5fc8f7b676bb680884380vboxsync END_COM_MAP()
b2640405e06105d868b5fc8f7b676bb680884380vboxsync
b2640405e06105d868b5fc8f7b676bb680884380vboxsync HRESULT FinalConstruct();
b2640405e06105d868b5fc8f7b676bb680884380vboxsync void FinalRelease();
0c802efc285bf77b849eaf660a9c18a0e7f62445vboxsync
0c802efc285bf77b849eaf660a9c18a0e7f62445vboxsync // public initializer/uninitializer for internal purposes only
b2640405e06105d868b5fc8f7b676bb680884380vboxsync
b2640405e06105d868b5fc8f7b676bb680884380vboxsync /**
b2640405e06105d868b5fc8f7b676bb680884380vboxsync * Simplified constructor for progress objects that have only one
b2640405e06105d868b5fc8f7b676bb680884380vboxsync * operation as a task.
b2640405e06105d868b5fc8f7b676bb680884380vboxsync * @param aParent
b2640405e06105d868b5fc8f7b676bb680884380vboxsync * @param aInitiator
b2640405e06105d868b5fc8f7b676bb680884380vboxsync * @param aDescription
b2640405e06105d868b5fc8f7b676bb680884380vboxsync * @param aCancelable
b2640405e06105d868b5fc8f7b676bb680884380vboxsync * @param aId
b2640405e06105d868b5fc8f7b676bb680884380vboxsync * @return
b2640405e06105d868b5fc8f7b676bb680884380vboxsync */
b2640405e06105d868b5fc8f7b676bb680884380vboxsync HRESULT init(
b2640405e06105d868b5fc8f7b676bb680884380vboxsync#if !defined (VBOX_COM_INPROC)
b2640405e06105d868b5fc8f7b676bb680884380vboxsync VirtualBox *aParent,
b2640405e06105d868b5fc8f7b676bb680884380vboxsync#endif
b2640405e06105d868b5fc8f7b676bb680884380vboxsync IUnknown *aInitiator,
eb4f1fa4c357485330370c0eaba27e5a2af7d9c4vboxsync CBSTR aDescription,
b2640405e06105d868b5fc8f7b676bb680884380vboxsync BOOL aCancelable,
b2640405e06105d868b5fc8f7b676bb680884380vboxsync OUT_GUID aId = NULL)
2347f07aa55c4c0035118a2a1634e5187a3ffdf4vboxsync {
eb4f1fa4c357485330370c0eaba27e5a2af7d9c4vboxsync return init(
b2640405e06105d868b5fc8f7b676bb680884380vboxsync#if !defined (VBOX_COM_INPROC)
b2640405e06105d868b5fc8f7b676bb680884380vboxsync aParent,
b2640405e06105d868b5fc8f7b676bb680884380vboxsync#endif
b2640405e06105d868b5fc8f7b676bb680884380vboxsync aInitiator,
b2640405e06105d868b5fc8f7b676bb680884380vboxsync aDescription,
b2640405e06105d868b5fc8f7b676bb680884380vboxsync aCancelable,
083344b49cc7370da15d3cb7e3a9c9cb2d8dfbb0vboxsync 1, // cOperations
083344b49cc7370da15d3cb7e3a9c9cb2d8dfbb0vboxsync 1, // ulTotalOperationsWeight
083344b49cc7370da15d3cb7e3a9c9cb2d8dfbb0vboxsync aDescription, // bstrFirstOperationDescription
0c802efc285bf77b849eaf660a9c18a0e7f62445vboxsync 1, // ulFirstOperationWeight
083344b49cc7370da15d3cb7e3a9c9cb2d8dfbb0vboxsync aId);
0c802efc285bf77b849eaf660a9c18a0e7f62445vboxsync }
0c802efc285bf77b849eaf660a9c18a0e7f62445vboxsync
0c802efc285bf77b849eaf660a9c18a0e7f62445vboxsync /**
0c802efc285bf77b849eaf660a9c18a0e7f62445vboxsync * Not quite so simplified constructor for progress objects that have
0c802efc285bf77b849eaf660a9c18a0e7f62445vboxsync * more than one operation, but all sub-operations are weighed the same.
0c802efc285bf77b849eaf660a9c18a0e7f62445vboxsync * @param aParent
0c802efc285bf77b849eaf660a9c18a0e7f62445vboxsync * @param aInitiator
0c802efc285bf77b849eaf660a9c18a0e7f62445vboxsync * @param aDescription
0c802efc285bf77b849eaf660a9c18a0e7f62445vboxsync * @param aCancelable
0c802efc285bf77b849eaf660a9c18a0e7f62445vboxsync * @param cOperations
0c802efc285bf77b849eaf660a9c18a0e7f62445vboxsync * @param bstrFirstOperationDescription
0c802efc285bf77b849eaf660a9c18a0e7f62445vboxsync * @param aId
083344b49cc7370da15d3cb7e3a9c9cb2d8dfbb0vboxsync * @return
083344b49cc7370da15d3cb7e3a9c9cb2d8dfbb0vboxsync */
083344b49cc7370da15d3cb7e3a9c9cb2d8dfbb0vboxsync HRESULT init(
0c802efc285bf77b849eaf660a9c18a0e7f62445vboxsync#if !defined (VBOX_COM_INPROC)
083344b49cc7370da15d3cb7e3a9c9cb2d8dfbb0vboxsync VirtualBox *aParent,
0c802efc285bf77b849eaf660a9c18a0e7f62445vboxsync#endif
0c802efc285bf77b849eaf660a9c18a0e7f62445vboxsync IUnknown *aInitiator,
0c802efc285bf77b849eaf660a9c18a0e7f62445vboxsync CBSTR aDescription, BOOL aCancelable,
0c802efc285bf77b849eaf660a9c18a0e7f62445vboxsync ULONG cOperations,
0c802efc285bf77b849eaf660a9c18a0e7f62445vboxsync CBSTR bstrFirstOperationDescription,
0c802efc285bf77b849eaf660a9c18a0e7f62445vboxsync OUT_GUID aId = NULL)
0c802efc285bf77b849eaf660a9c18a0e7f62445vboxsync {
0c802efc285bf77b849eaf660a9c18a0e7f62445vboxsync return init(
0c802efc285bf77b849eaf660a9c18a0e7f62445vboxsync#if !defined (VBOX_COM_INPROC)
0c802efc285bf77b849eaf660a9c18a0e7f62445vboxsync aParent,
0c802efc285bf77b849eaf660a9c18a0e7f62445vboxsync#endif
0c802efc285bf77b849eaf660a9c18a0e7f62445vboxsync aInitiator,
0c802efc285bf77b849eaf660a9c18a0e7f62445vboxsync aDescription,
0c802efc285bf77b849eaf660a9c18a0e7f62445vboxsync aCancelable,
0c802efc285bf77b849eaf660a9c18a0e7f62445vboxsync cOperations, // cOperations
0c802efc285bf77b849eaf660a9c18a0e7f62445vboxsync cOperations, // ulTotalOperationsWeight = cOperations
0c802efc285bf77b849eaf660a9c18a0e7f62445vboxsync bstrFirstOperationDescription, // bstrFirstOperationDescription
0c802efc285bf77b849eaf660a9c18a0e7f62445vboxsync 1, // ulFirstOperationWeight: weigh them all the same
b2640405e06105d868b5fc8f7b676bb680884380vboxsync aId);
b2640405e06105d868b5fc8f7b676bb680884380vboxsync }
b2640405e06105d868b5fc8f7b676bb680884380vboxsync
b2640405e06105d868b5fc8f7b676bb680884380vboxsync HRESULT init(
b2640405e06105d868b5fc8f7b676bb680884380vboxsync#if !defined (VBOX_COM_INPROC)
b2640405e06105d868b5fc8f7b676bb680884380vboxsync VirtualBox *aParent,
b2640405e06105d868b5fc8f7b676bb680884380vboxsync#endif
0c802efc285bf77b849eaf660a9c18a0e7f62445vboxsync IUnknown *aInitiator,
b2640405e06105d868b5fc8f7b676bb680884380vboxsync CBSTR aDescription,
b2640405e06105d868b5fc8f7b676bb680884380vboxsync BOOL aCancelable,
0c802efc285bf77b849eaf660a9c18a0e7f62445vboxsync ULONG cOperations,
0c802efc285bf77b849eaf660a9c18a0e7f62445vboxsync ULONG ulTotalOperationsWeight,
0c802efc285bf77b849eaf660a9c18a0e7f62445vboxsync CBSTR bstrFirstOperationDescription,
0c802efc285bf77b849eaf660a9c18a0e7f62445vboxsync ULONG ulFirstOperationWeight,
0c802efc285bf77b849eaf660a9c18a0e7f62445vboxsync OUT_GUID aId = NULL);
0c802efc285bf77b849eaf660a9c18a0e7f62445vboxsync
0c802efc285bf77b849eaf660a9c18a0e7f62445vboxsync HRESULT init(BOOL aCancelable,
0c802efc285bf77b849eaf660a9c18a0e7f62445vboxsync ULONG aOperationCount,
3383321ffc6907012f92f16b26b026908de7fe7fvboxsync CBSTR aOperationDescription);
0c802efc285bf77b849eaf660a9c18a0e7f62445vboxsync
3383321ffc6907012f92f16b26b026908de7fe7fvboxsync void uninit();
3383321ffc6907012f92f16b26b026908de7fe7fvboxsync
3383321ffc6907012f92f16b26b026908de7fe7fvboxsync // IProgress methods
3383321ffc6907012f92f16b26b026908de7fe7fvboxsync STDMETHOD(WaitForCompletion)(LONG aTimeout);
0c802efc285bf77b849eaf660a9c18a0e7f62445vboxsync STDMETHOD(WaitForOperationCompletion)(ULONG aOperation, LONG aTimeout);
0c802efc285bf77b849eaf660a9c18a0e7f62445vboxsync STDMETHOD(Cancel)();
0c802efc285bf77b849eaf660a9c18a0e7f62445vboxsync
b2640405e06105d868b5fc8f7b676bb680884380vboxsync STDMETHOD(SetCurrentOperationProgress)(ULONG aPercent);
b2640405e06105d868b5fc8f7b676bb680884380vboxsync STDMETHOD(SetNextOperation)(IN_BSTR bstrNextOperationDescription, ULONG ulNextOperationsWeight);
b2640405e06105d868b5fc8f7b676bb680884380vboxsync
b2640405e06105d868b5fc8f7b676bb680884380vboxsync // public methods only for internal purposes
b2640405e06105d868b5fc8f7b676bb680884380vboxsync
b2640405e06105d868b5fc8f7b676bb680884380vboxsync HRESULT setResultCode(HRESULT aResultCode);
083344b49cc7370da15d3cb7e3a9c9cb2d8dfbb0vboxsync
0c802efc285bf77b849eaf660a9c18a0e7f62445vboxsync HRESULT notifyComplete(HRESULT aResultCode);
b2640405e06105d868b5fc8f7b676bb680884380vboxsync HRESULT notifyComplete(HRESULT aResultCode,
0c802efc285bf77b849eaf660a9c18a0e7f62445vboxsync const GUID &aIID,
0c802efc285bf77b849eaf660a9c18a0e7f62445vboxsync const Bstr &aComponent,
0c802efc285bf77b849eaf660a9c18a0e7f62445vboxsync const char *aText,
0c802efc285bf77b849eaf660a9c18a0e7f62445vboxsync ...);
b2640405e06105d868b5fc8f7b676bb680884380vboxsync HRESULT notifyCompleteV(HRESULT aResultCode,
0c802efc285bf77b849eaf660a9c18a0e7f62445vboxsync const GUID &aIID,
0c802efc285bf77b849eaf660a9c18a0e7f62445vboxsync const Bstr &aComponent,
0c802efc285bf77b849eaf660a9c18a0e7f62445vboxsync const char *aText,
0c802efc285bf77b849eaf660a9c18a0e7f62445vboxsync va_list va);
0c802efc285bf77b849eaf660a9c18a0e7f62445vboxsync bool notifyPointOfNoReturn(void);
0c802efc285bf77b849eaf660a9c18a0e7f62445vboxsync
b2640405e06105d868b5fc8f7b676bb680884380vboxsync /** For com::SupportErrorInfoImpl. */
0c802efc285bf77b849eaf660a9c18a0e7f62445vboxsync static const char *ComponentName() { return "Progress"; }
b2640405e06105d868b5fc8f7b676bb680884380vboxsync
0c802efc285bf77b849eaf660a9c18a0e7f62445vboxsyncprivate:
0c802efc285bf77b849eaf660a9c18a0e7f62445vboxsync
b2640405e06105d868b5fc8f7b676bb680884380vboxsync RTSEMEVENTMULTI mCompletedSem;
0c802efc285bf77b849eaf660a9c18a0e7f62445vboxsync ULONG mWaitersCount;
083344b49cc7370da15d3cb7e3a9c9cb2d8dfbb0vboxsync};
0c802efc285bf77b849eaf660a9c18a0e7f62445vboxsync
083344b49cc7370da15d3cb7e3a9c9cb2d8dfbb0vboxsync#endif /* ____H_PROGRESSIMPL */
0c802efc285bf77b849eaf660a9c18a0e7f62445vboxsync
0c802efc285bf77b849eaf660a9c18a0e7f62445vboxsync