VirtualBox

Changeset 90440 in vbox


Ignore:
Timestamp:
Jul 30, 2021 8:00:15 PM (4 years ago)
Author:
vboxsync
Message:

Main/VirtualBox: New event for creating/deleting of Progress objects in VBoxSVC. Intentionally not passing an object reference to avoid postponing the actual object progress object destruction. Plus a new method for finding progress objects by GUID (otherwise the event handler would often need client side searching by GUID which is inefficient).

Location:
trunk
Files:
4 edited

Legend:

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

    r90048 r90440  
    545545    /** Main group, IProgress. */
    546546    LOG_GROUP_MAIN_PROGRESS,
     547    /** Main group, IProgressCreatedEvent. */
     548    LOG_GROUP_MAIN_PROGRESSCREATEDEVENT,
    547549    /** Main group, IProgressEvent. */
    548550    LOG_GROUP_MAIN_PROGRESSEVENT,
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r89777 r90440  
    25442544  <interface
    25452545    name="IVirtualBox" extends="$unknown"
    2546     uuid="d0a0163f-e254-4e5b-a1f2-011cf991c38d"
     2546    uuid="0efe109d-9b2e-48cf-9969-3fb7b711062e"
    25472547    wsmap="managed"
    25482548    reservedMethods="8" reservedAttributes="12"
     
    35623562      <param name="result" type="boolean" dir="return">
    35633563        <desc>If firmware of this type and version is available.</desc>
     3564      </param>
     3565    </method>
     3566
     3567    <method name="findProgressById">
     3568      <desc>
     3569        Searches through all progress objects known to VBoxSVC for an
     3570        instance with the given GUID.
     3571        <note>
     3572          The method returns an error if the given GUID does not
     3573          correspond to any currently known progress object.
     3574        </note>
     3575      </desc>
     3576      <param name="id" type="uuid" mod="string" dir="in">
     3577        <desc>GUID of the progress object to search for.</desc>
     3578      </param>
     3579      <param name="progressObject" type="IProgress" dir="return">
     3580        <desc>Found progress object.</desc>
    35643581      </param>
    35653582    </method>
     
    2446624483  <enum
    2446724484    name="VBoxEventType"
    24468     uuid="2ab7c196-f232-11ea-a5d2-83b96bc30bcc"
     24485    uuid="c88a66ed-fbce-4c21-9196-12354bd96b89"
    2446924486    >
    2447024487
     
    2492024937      </desc>
    2492124938    </const>
     24939    <const name="OnProgressCreated" value="110">
     24940      <desc>
     24941        See <link to="IProgressCreatedEvent"/>.
     24942      </desc>
     24943    </const>
    2492224944    <!-- End event marker -->
    2492324945    <!-- @todo rename to 'End' as it is exclusive (we use 'last' to be inclusive). -->
    24924     <const name="Last" value="110">
     24946    <const name="Last" value="111">
    2492524947      <desc>
    2492624948        Must be last event, used for iterations and structures relying on numerical event values.
     
    2700627028    <attribute name="progressId" readonly="yes" type="uuid" mod="string">
    2700727029      <desc>GUID of the progress this event relates to.</desc>
     27030    </attribute>
     27031
     27032  </interface>
     27033
     27034  <interface
     27035    name="IProgressCreatedEvent" extends="IProgressEvent"
     27036    uuid="a85bba40-1b93-47bb-b125-dec708c30fc0"
     27037    wsmap="managed" autogen="VBoxEvent" id="OnProgressCreated">
     27038    <desc>Notification of a new progress object creation/deletion.
     27039      Covers purely projess objects in VBoxSVC. This
     27040      event is signaled on the event source of IVirtualBox, unlike
     27041      the other progress events.</desc>
     27042
     27043    <attribute name="create" readonly="yes" type="boolean">
     27044      <desc>If @c true, the progress object was created, otherwise it
     27045        was deleted.</desc>
    2700827046    </attribute>
    2700927047
  • trunk/src/VBox/Main/include/VirtualBoxImpl.h

    r87949 r90440  
    158158    int i_unloadVDPlugin(const char *pszPluginLibrary);
    159159
    160     void i_onMediumRegistered(const Guid &aMediumId, const DeviceType_T aDevType, const BOOL aRegistered);
     160    void i_onMediumRegistered(const Guid &aMediumId, const DeviceType_T aDevType, BOOL aRegistered);
    161161    void i_onMediumConfigChanged(IMedium *aMedium);
    162162    void i_onMediumChanged(IMediumAttachment* aMediumAttachment);
    163163    void i_onStorageControllerChanged(const Guid &aMachineId, const com::Utf8Str &aControllerName);
    164     void i_onStorageDeviceChanged(IMediumAttachment* aStorageDevice, const BOOL fRemoved, const BOOL fSilent);
     164    void i_onStorageDeviceChanged(IMediumAttachment* aStorageDevice, BOOL fRemoved, BOOL fSilent);
    165165    void i_onMachineStateChanged(const Guid &aId, MachineState_T aState);
    166166    void i_onMachineDataChanged(const Guid &aId, BOOL aTemporary = FALSE);
     
    199199    void i_onCloudProviderRegistered(const Utf8Str &aProviderId, BOOL aRegistered);
    200200    void i_onCloudProviderUninstall(const Utf8Str &aProviderId);
     201
     202    void i_onProgressCreated(const Guid &aId, BOOL aCreated);
    201203
    202204#ifdef VBOX_WITH_CLOUD_NET
     
    390392                                 com::Utf8Str &aFile,
    391393                                 BOOL *aResult);
     394    HRESULT findProgressById(const com::Guid &aId,
     395                             ComPtr<IProgress> &aProgressObject);
    392396
    393397    static HRESULT i_setErrorStaticBoth(HRESULT aResultCode, int vrc, const Utf8Str &aText)
  • trunk/src/VBox/Main/src-server/VirtualBoxImpl.cpp

    r87949 r90440  
    12711271    AutoReadLock safeLock(m->mtxProgressOperations COMMA_LOCKVAL_SRC_POS);
    12721272    ProgressMap pmap(m->mapProgressOperations);
     1273    /* Can release lock now. The following code works on a copy of the map. */
     1274    safeLock.release();
    12731275    aProgressOperations.resize(pmap.size());
    12741276    size_t i = 0;
     
    35153517
    35163518
     3519void VirtualBox::i_onProgressCreated(const Guid &aId, BOOL aCreated)
     3520{
     3521    ::FireProgressCreatedEvent(m->pEventSource, aId.toString(), aCreated);
     3522}
     3523
     3524
    35173525/**
    35183526 *  @note Locks the list of other objects for reading.
     
    57925800
    57935801
     5802HRESULT VirtualBox::findProgressById(const com::Guid &aId,
     5803                                     ComPtr<IProgress> &aProgressObject)
     5804{
     5805    if (!aId.isValid())
     5806        return setError(E_INVALIDARG,
     5807                        tr("The provided progress object GUID is invalid"));
     5808
     5809    /* protect mProgressOperations */
     5810    AutoReadLock safeLock(m->mtxProgressOperations COMMA_LOCKVAL_SRC_POS);
     5811
     5812    ProgressMap::const_iterator it = m->mapProgressOperations.find(aId);
     5813    if (it != m->mapProgressOperations.end())
     5814    {
     5815        aProgressObject = it->second;
     5816        return S_OK;
     5817    }
     5818    return setError(E_INVALIDARG,
     5819                    tr("The progress object with the given GUID could not be found"));
     5820}
     5821
     5822
    57945823#ifdef RT_OS_WINDOWS
    57955824#include <psapi.h>
     
    59986027
    59996028/**
    6000  * Wathces @a a_pidClient for termination.
     6029 * Watches @a a_pidClient for termination.
    60016030 *
    60026031 * @returns true if successfully enabled watching of it, false if not.
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