VirtualBox

Ignore:
Timestamp:
May 24, 2019 12:26:23 PM (6 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:7127: Do not perform whole medium-enumeration if one medium was not found in the tree, just enumerate it and it's children; This speedups VM details processing but is a dangerous one, needs to be carefully tested.

Location:
trunk/src/VBox/Frontends/VirtualBox/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp

    r78722 r78723  
    25202520}
    25212521
     2522void VBoxGlobal::enumerateAdditionalMedium(const CMedium &comMedium)
     2523{
     2524    /* Make sure VBoxGlobal is already valid: */
     2525    AssertReturnVoid(m_fValid);
     2526    /* Ignore the request during VBoxGlobal cleanup: */
     2527    if (s_fCleaningUp)
     2528        return;
     2529    /* Ignore the request during startup snapshot restoring: */
     2530    if (shouldRestoreCurrentSnapshot())
     2531        return;
     2532
     2533    /* Make sure medium-enumerator is already created: */
     2534    if (!m_pMediumEnumerator)
     2535        return;
     2536
     2537    /* Redirect request to medium-enumerator under proper lock: */
     2538    if (m_meCleanupProtectionToken.tryLockForRead())
     2539    {
     2540        if (m_pMediumEnumerator)
     2541            m_pMediumEnumerator->enumerateAdditionalMedium(comMedium);
     2542        m_meCleanupProtectionToken.unlock();
     2543    }
     2544}
     2545
    25222546void VBoxGlobal::refreshMedia()
    25232547{
     
    33073331    {
    33083332        /* UI medium may be new and not among our media, request enumeration: */
    3309         startMediumEnumeration();
     3333        enumerateAdditionalMedium(comMedium);
    33103334
    33113335        /* Search for corresponding UI medium again: */
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.h

    r78722 r78723  
    478478        /** Starts medium-enumeration. */
    479479        void startMediumEnumeration(const CMediumVector &mediaList = CMediumVector());
     480        /** Enumerates additional medium. */
     481        void enumerateAdditionalMedium(const CMedium &comMedium);
    480482        /** Calls refresh for each medium which has been already enumerated. */
    481483        void refreshMedia();
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumEnumerator.cpp

    r78722 r78723  
    231231}
    232232
     233void UIMediumEnumerator::enumerateAdditionalMedium(const CMedium &comMedium)
     234{
     235    /* Put the medium to vector for convenience: */
     236    CMediumVector inputMedia;
     237    inputMedia << comMedium;
     238
     239    /* Compose new map of passed medium & it's children.
     240     * While composing we are using data from already cached media. */
     241    UIMediumMap media;
     242    addMediaToMap(inputMedia, media);
     243
     244    /* VBoxGlobal is cleaning up, abort immediately: */
     245    if (VBoxGlobal::isCleaningUp())
     246        return;
     247
     248    /* Throw the media to existing map: */
     249    foreach (const QUuid &uMediumId, media.keys())
     250        m_media[uMediumId] = media.value(uMediumId);
     251
     252    /* Start enumeration for media with non-NULL ID: */
     253    foreach (const QUuid &uMediumID, media.keys())
     254        if (!uMediumID.isNull())
     255            createMediumEnumerationTask(media[uMediumID]);
     256}
     257
    233258void UIMediumEnumerator::refreshMedia()
    234259{
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumEnumerator.h

    r78722 r78723  
    8989      * @note  Empty passed map means that full/overall medium-enumeration is requested. */
    9090    void startMediumEnumeration(const CMediumVector &comMedia = CMediumVector());
     91    /** Makes a request to enumerate additionally specified @a comMedium.
     92      * @note  Previous map will be extended with the new one, composed of passed
     93      *        medium and it's children, values present in both maps will be merged
     94      *        from the previous to new one, keep that all in mind. */
     95    void enumerateAdditionalMedium(const CMedium &comMedium);
    9196    /** Refresh all the lightweight UIMedium information for all the cached UIMedium(s).
    9297      * @note  Please note that this is a lightweight version, which doesn't perform
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