VirtualBox

Changeset 69002 in vbox


Ignore:
Timestamp:
Oct 6, 2017 12:49:53 PM (7 years ago)
Author:
vboxsync
Message:

bugref:8674. Added 2 new events into the Progress - "percentage changed" and "task completed".

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/log.h

    r68485 r69002  
    570570    /** Main group, IProgress. */
    571571    LOG_GROUP_MAIN_PROGRESS,
     572    /** Main group, IProgressEvent. */
     573    LOG_GROUP_MAIN_PROGRESSEVENT,
     574    /** Main group, IProgressPercentageChangedEvent. */
     575    LOG_GROUP_MAIN_PROGRESSPERCENTAGECHANGEDEVENT,
     576    /** Main group, IProgressTaskCompletedEvent. */
     577    LOG_GROUP_MAIN_PROGRESSTASKCOMPLETEDEVENT,
    572578    /** Main group, IReusableEvent. */
    573579    LOG_GROUP_MAIN_REUSABLEEVENT,
     
    10761082    "MAIN_PROCESS", \
    10771083    "MAIN_PROGRESS", \
     1084    "MAIN_PROGRESSEVENT", \
     1085    "MAIN_PROGRESSPERCENTAGECHANGEDEVENT", \
     1086    "MAIN_PROGRESSTASKCOMPLETEDEVENT", \
    10781087    "MAIN_REUSABLEEVENT", \
    10791088    "MAIN_RUNTIMEERROREVENT", \
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r68986 r69002  
    1397313973  <interface
    1397413974    name="IProgress" extends="$unknown"
    13975     uuid="77faf1c0-489d-b123-274c-5a95e77ab286"
     13975    uuid="e0026dc0-0c55-47b1-aa64-d340a396b418"
    1397613976    wsmap="managed"
    1397713977    reservedMethods="1" reservedAttributes="2"
     
    1410914109      </desc>
    1411014110    </attribute>
     14111
     14112    <attribute name="eventSource" type="IEventSource" readonly="yes"/>
    1411114113
    1411214114    <method name="setCurrentOperationProgress">
     
    2225622258      </desc>
    2225722259    </const>
     22260    <const name="OnProgressPercentageChanged" value="98">
     22261      <desc>
     22262        See <link to="IProgressPercentageChangedEvent">IProgressPercentageChangedEvent</link>.
     22263      </desc>
     22264    </const>
     22265    <const name="OnProgressTaskCompleted" value="99">
     22266      <desc>
     22267        See <link to="IProgressTaskCompletedEvent">IProgressTaskCompletedEvent</link>.
     22268      </desc>
     22269    </const>
    2225822270    <!-- Last event marker -->
    22259     <const name="Last" value="98">
     22271    <const name="Last" value="100">
    2226022272      <desc>
    2226122273        Must be last event, used for iterations and structures relying on numerical event values.
     
    2429924311  </interface>
    2430024312
     24313  <interface
     24314    name="IProgressEvent" extends="IEvent"
     24315    uuid="daaf9016-1f04-4191-aa2f-1fac9646ae4c"
     24316    wsmap="managed" id="ProgressEvent">
     24317    <desc>Base abstract interface for all progress events.</desc>
     24318
     24319    <attribute name="progressId" readonly="yes" type="uuid" mod="string">
     24320      <desc>GUID of the progress this event relates to.</desc>
     24321    </attribute>
     24322
     24323  </interface>
     24324
     24325  <interface
     24326    name="IProgressPercentageChangedEvent" extends="IProgressEvent"
     24327    uuid="f05d7e60-1bcf-4218-9807-04e036cc70f1"
     24328    wsmap="managed" autogen="VBoxEvent" id="OnProgressPercentageChanged">
     24329    <desc>Progress state change event.</desc>
     24330
     24331    <attribute name="percent" readonly="yes" type="long">
     24332      <desc>New percent</desc>
     24333    </attribute>
     24334  </interface>
     24335
     24336  <interface
     24337    name="IProgressTaskCompletedEvent" extends="IProgressEvent"
     24338    uuid="a5bbdb7d-8ce7-469f-a4c2-6476f581ff72"
     24339    wsmap="managed" autogen="VBoxEvent" id="OnProgressTaskCompleted">
     24340    <desc>Progress task completion event.</desc>
     24341    <attribute name="midlDoesNotLikeEmptyInterfaces" readonly="yes" type="boolean"/>
     24342  </interface>
     24343
    2430124344  <module name="VBoxSVC" context="LocalServer">
    2430224345    <class name="VirtualBox" uuid="B1A7A4F2-47B9-4A1E-82B2-07CCD5323C3F"
  • trunk/src/VBox/Main/include/ProgressImpl.h

    r67245 r69002  
    2222#include "ProgressWrap.h"
    2323#include "VirtualBoxBase.h"
     24#include "EventImpl.h"
    2425
    2526#include <iprt/semaphore.h>
     
    151152    VirtualBox * const      mParent;
    152153#endif
    153 
     154    const ComObjPtr<EventSource> pEventSource;
    154155    const ComPtr<IUnknown>  mInitiator;
    155156
     
    203204    HRESULT getTimeout(ULONG *aTimeout);
    204205    HRESULT setTimeout(ULONG aTimeout);
     206    HRESULT getEventSource(ComPtr<IEventSource> &aEventSource);
    205207
    206208    // wrapped IProgress methods
  • trunk/src/VBox/Main/src-all/ProgressImpl.cpp

    r67242 r69002  
    4242#include "AutoCaller.h"
    4343
     44#include "VBoxEvents.h"
    4445
    4546Progress::Progress()
     
    168169
    169170    HRESULT rc = S_OK;
     171    rc = unconst(pEventSource).createObject();
     172    if (FAILED(rc)) throw rc;
     173
     174    rc = pEventSource->init();
     175    if (FAILED(rc)) throw rc;
    170176
    171177//    rc = Progress::init(
     
    475481        RTSemEventMultiSignal(mCompletedSem);
    476482
     483    fireProgressTaskCompletedEvent(pEventSource, mId.toUtf16().raw());
     484
    477485    return S_OK;
    478486}
     
    563571            vrc = VERR_CANCELLED;
    564572        }
     573        ULONG actualPercent = 0;
     574        pThis->getPercent(&actualPercent);
     575        fireProgressPercentageChangedEvent(pThis->pEventSource, pThis->mId.toUtf16().raw(), actualPercent);
    565576    }
    566577    /* else ignored */
     
    813824    m_ulOperationPercent = aPercent;
    814825
     826    ULONG actualPercent = 0;
     827    getPercent(&actualPercent);
     828    fireProgressPercentageChangedEvent(pEventSource, mId.toUtf16().raw(), actualPercent);
     829
    815830    return S_OK;
    816831}
     
    847862    if (mWaitersCount > 0)
    848863        RTSemEventMultiSignal(mCompletedSem);
     864
     865    ULONG actualPercent = 0;
     866    getPercent(&actualPercent);
     867    fireProgressPercentageChangedEvent(pEventSource, mId.toUtf16().raw(), actualPercent);
    849868
    850869    return S_OK;
     
    10751094}
    10761095
     1096HRESULT Progress::getEventSource(ComPtr<IEventSource> &aEventSource)
     1097{
     1098    /* event source is const, no need to lock */
     1099    pEventSource.queryInterfaceTo(aEventSource.asOutParam());
     1100    return S_OK;
     1101}
    10771102
    10781103// private internal helpers
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette