VirtualBox

Changeset 86069 in vbox for trunk/src


Ignore:
Timestamp:
Sep 9, 2020 3:03:23 AM (4 years ago)
Author:
vboxsync
Message:

OCI: Make ICloudProviderRegisteredEvent a non-waitable notification
sent after the fact. Introduce separate ICloudProviderUninstallEvent
sent before unistallation attempt, waitable. Introduce separate
ICloudProviderListChangedEvent that is sent when we are done with all
the extpack providers and the list of providers can be re-read.

Location:
trunk/src/VBox/Main
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r86068 r86069  
    2446724467  <enum
    2446824468    name="VBoxEventType"
    24469     uuid="d5d15e38-808d-11e9-aaac-4bc5d973ca37"
     24469    uuid="2ab7c196-f232-11ea-a5d2-83b96bc30bcc"
    2447024470    >
    2447124471
     
    2489624896      </desc>
    2489724897    </const>
    24898     <const name="OnCloudProviderRegistered" value="105">
    24899       <desc>
    24900         See <link to="ICloudProviderRegisteredEvent">ICloudProviderRegisteredEvent</link>.
    24901       </desc>
    24902     </const>
    24903     <const name="OnCloudProfileRegistered" value="106">
     24898    <const name="OnCloudProviderListChanged" value="105">
     24899      <desc>
     24900        See <link to="ICloudProviderListChangedEvent"/>.
     24901      </desc>
     24902    </const>
     24903    <const name="OnCloudProviderRegistered" value="106">
     24904      <desc>
     24905        See <link to="ICloudProviderRegisteredEvent"/>.
     24906      </desc>
     24907    </const>
     24908    <const name="OnCloudProviderUninstall" value="107">
     24909      <desc>
     24910        See <link to="ICloudProviderUninstallEvent"/>.
     24911      </desc>
     24912    </const>
     24913    <const name="OnCloudProfileRegistered" value="108">
    2490424914      <desc>
    2490524915        See <link to="ICloudProfileRegisteredEvent"/>.
    2490624916      </desc>
    2490724917    </const>
    24908     <const name="OnCloudProfileChanged" value="107">
     24918    <const name="OnCloudProfileChanged" value="109">
    2490924919      <desc>
    2491024920        See <!-- link to="ICloudProfileChangedEvent"/--> ICloudProfileChangedEvent.
     
    2491324923    <!-- End event marker -->
    2491424924    <!-- @todo rename to 'End' as it is exclusive (we use 'last' to be inclusive). -->
    24915     <const name="Last" value="108">
     24925    <const name="Last" value="110">
    2491624926      <desc>
    2491724927        Must be last event, used for iterations and structures relying on numerical event values.
     
    2825328263  </interface>
    2825428264
     28265  <interface name="ICloudProviderListChangedEvent" extends="IEvent"
     28266    uuid="a54d9cca-f23f-11ea-9755-efd0f1f792d9"
     28267    wsmap="managed" autogen="VBoxEvent"
     28268    id="OnCloudProviderListChanged"
     28269    >
     28270    <desc>
     28271      Each individual provider that is installed or uninstalled is
     28272      reported as an <link to="ICloudProviderRegisteredEvent"/>.  When
     28273      the batch is done this event is sent and listerns can get the
     28274      new list.
     28275    </desc>
     28276    <attribute name="registered" type="boolean" readonly="yes"/>
     28277  </interface>
     28278
    2825528279  <interface name="ICloudProviderRegisteredEvent" extends="IEvent"
    28256     uuid="3d515696-eb98-11ea-96ac-8b4794b20214"
     28280    uuid="e28e227a-f231-11ea-9641-9b500c6d5365"
    2825728281    wsmap="managed" autogen="VBoxEvent"
    28258     id="OnCloudProviderRegistered" waitable="yes"
    28259     >
     28282    id="OnCloudProviderRegistered"
     28283    >
     28284    <desc>
     28285      A cloud provider was installed or uninstalled.
     28286      See also <link to="ICloudProviderListChangedEvent"/>.
     28287    </desc>
    2826028288    <attribute name="id" type="uuid" mod="string" readonly="yes"/>
    2826128289    <attribute name="registered" type="boolean" readonly="yes"/>
     28290  </interface>
     28291
     28292  <interface name="ICloudProviderUninstallEvent" extends="IEvent"
     28293    uuid="f01f1066-f231-11ea-8eee-33bb2afb0b6e"
     28294    wsmap="managed" autogen="VBoxEvent"
     28295    id="OnCloudProviderCanUninstall" waitable="yes"
     28296    >
     28297    <desc>
     28298      A cloud provider is about to be uninstalled.
     28299      Unlike <link to="ICloudProviderRegisteredEvent"/> this one is
     28300      waitable and is sent <i>before</i> an attempt is made to
     28301      uninstall a provider.  Listerns should release references to the
     28302      provider and related objects if they have any, or the
     28303      uninstallation of the provider is going to fail because it's
     28304      still in use.
     28305    </desc>
     28306    <attribute name="id" type="uuid" mod="string" readonly="yes"/>
    2826228307  </interface>
    2826328308
  • trunk/src/VBox/Main/include/VirtualBoxImpl.h

    r86012 r86069  
    209209    int i_natNetworkRefDec(const Utf8Str &aNetworkName);
    210210
    211     void i_onCloudProviderRegistered(const Utf8Str &aId, BOOL aRegistered);
     211    void i_onCloudProviderListChanged(BOOL aRegistered);
     212    void i_onCloudProviderRegistered(const Utf8Str &aProviderId, BOOL aRegistered);
     213    void i_onCloudProviderUninstall(const Utf8Str &aProviderId);
    212214
    213215#ifdef VBOX_WITH_CLOUD_NET
  • trunk/src/VBox/Main/src-server/CloudProviderManagerImpl.cpp

    r86013 r86069  
    136136            {
    137137                /* do this before the provider goes over the rainbow bridge */
    138                 pTmpProvider->COMGETTER(Id)(bstrProviderId.asOutParam());
    139 
    140                 /**
    141                  * @todo r=uwe We send the event @em before we even
    142                  * try to uninstall the provider.  The GUI can get the
    143                  * event and get rid of any references to the objects
    144                  * related to this provider that it still has.  The
    145                  * current uninstall attempt might fail, but the GUI
    146                  * can then retry once and likely succeed.  Needs more
    147                  * thought and feeback from dsen.
     138                hrc = pTmpProvider->COMGETTER(Id)(bstrProviderId.asOutParam());
     139
     140                /*
     141                 * We send this event @em before we try to uninstall
     142                 * the provider.  The GUI can get the event and get
     143                 * rid of any references to the objects related to
     144                 * this provider that it still has.
    148145                 */
    149                 m_pVirtualBox->i_onCloudProviderRegistered(bstrProviderId, FALSE);
     146                if (bstrProviderId.isNotEmpty())
     147                    m_pVirtualBox->i_onCloudProviderUninstall(bstrProviderId);
    150148
    151149                hrc = pTmpProvider->PrepareUninstall();
     
    159157                m_astrExtPackNames.erase(m_astrExtPackNames.begin() + (ssize_t)i);
    160158                m_apCloudProviders.erase(m_apCloudProviders.begin() + (ssize_t)i);
     159
     160                if (bstrProviderId.isNotEmpty())
     161                    m_pVirtualBox->i_onCloudProviderRegistered(bstrProviderId, FALSE);
     162
    161163                /* NB: not advancing loop index */
    162164            }
     
    172174        if (fRes)
    173175            m_mapCloudProviderManagers.erase(it);
     176
     177        /**
     178         * Tell listeners we are done and they can re-read the new
     179         * list of providers.
     180         */
     181        m_pVirtualBox->i_onCloudProviderListChanged(FALSE);
    174182    }
    175183
     
    208216    m_mapCloudProviderManagers[strExtPackName] = pManager;
    209217
    210     /* collect provider ids for bulk-sending the events */
    211     std::vector<Utf8Str> aProviderIds;
    212     aProviderIds.reserve(apProvidersFromCurrExtPack.size());
    213 
    214218    for (unsigned i = 0; i < apProvidersFromCurrExtPack.size(); i++)
    215219    {
     
    228232                m_apCloudProviders.push_back(pProvider);
    229233
    230                 /* note the id of this provider to send an event later */
    231234                Bstr bstrProviderId;
    232235                pProvider->COMGETTER(Id)(bstrProviderId.asOutParam());
    233                 aProviderIds.push_back(bstrProviderId);
    234             }
    235         }
    236     }
    237 
    238     /* bulk-send ICloudProviderRegisteredEvent's */
    239     for (size_t i = 0; i < aProviderIds.size(); ++i)
    240     {
    241         m_pVirtualBox->i_onCloudProviderRegistered(aProviderIds[i], TRUE);
    242     }
     236                if (bstrProviderId.isNotEmpty())
     237                    m_pVirtualBox->i_onCloudProviderRegistered(bstrProviderId, TRUE);
     238            }
     239        }
     240    }
     241
     242    /**
     243     * Tell listeners we are done and they can re-read the new list of
     244     * providers.
     245     */
     246    m_pVirtualBox->i_onCloudProviderListChanged(TRUE);
    243247}
    244248
  • trunk/src/VBox/Main/src-server/VirtualBoxImpl.cpp

    r86012 r86069  
    38193819
    38203820
    3821 void VirtualBox::i_onCloudProviderRegistered(const Utf8Str &aId, BOOL aRegistered)
     3821void VirtualBox::i_onCloudProviderListChanged(BOOL aRegistered)
     3822{
     3823    ::FireCloudProviderListChangedEvent(m->pEventSource, aRegistered);
     3824}
     3825
     3826
     3827void VirtualBox::i_onCloudProviderRegistered(const Utf8Str &aProviderId, BOOL aRegistered)
     3828{
     3829    ::FireCloudProviderRegisteredEvent(m->pEventSource, aProviderId, aRegistered);
     3830}
     3831
     3832
     3833void VirtualBox::i_onCloudProviderUninstall(const Utf8Str &aProviderId)
    38223834{
    38233835    HRESULT hrc;
    38243836
    38253837    ComPtr<IEvent> pEvent;
    3826     hrc = CreateCloudProviderRegisteredEvent(pEvent.asOutParam(), m->pEventSource,
    3827                                              aId, aRegistered);
     3838    hrc = CreateCloudProviderUninstallEvent(pEvent.asOutParam(),
     3839                                            m->pEventSource, aProviderId);
    38283840    if (FAILED(hrc))
    38293841        return;
    38303842
    38313843    BOOL fDelivered = FALSE;
    3832     hrc = m->pEventSource->FireEvent(pEvent, 10000, &fDelivered); // XXX: timeout
     3844    hrc = m->pEventSource->FireEvent(pEvent, /* :timeout */ 10000, &fDelivered);
    38333845    if (FAILED(hrc))
    38343846        return;
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