VirtualBox

Changeset 13165 in vbox for trunk/src


Ignore:
Timestamp:
Oct 10, 2008 11:27:30 AM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
37684
Message:

Main: use the HGCM guest property change notification interface and do some clean ups

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/ConsoleImpl.cpp

    r13079 r13165  
    10011001    return VINF_SUCCESS;
    10021002}
     1003
     1004#ifdef VBOX_WITH_GUEST_PROPS
     1005// static
     1006DECLCALLBACK(void)
     1007Console::doGuestPropNotification (PVBOXHGCMCALLBACKHDR pHeader)
     1008{
     1009    /* No locking, as this is purely a notification which does not make any
     1010     * changes to the object state. */
     1011    guestProp::PHOSTCALLBACKDATA pCBData
     1012        = reinterpret_cast<guestProp::PHOSTCALLBACKDATA>(pHeader);
     1013    AssertReturnVoid(VBOXHGCMCALLBACKMAGIC == pCBData->hdr.u32Magic);
     1014    AssertReturnVoid(sizeof(guestProp::HOSTCALLBACKDATA) == pCBData->hdr.cbStruct);
     1015    ComObjPtr <Console> pConsole = reinterpret_cast <Console *> (pCBData->hdr.pvData);
     1016    pConsole->mControl->PushGuestProperty(Bstr(pCBData->pcszName),
     1017                                          Bstr(pCBData->pcszValue),
     1018                                          pCBData->u64Timestamp,
     1019                                          Bstr(pCBData->pcszFlags));
     1020}
     1021#endif
     1022
    10031023
    10041024// IConsole properties
  • trunk/src/VBox/Main/ConsoleImpl2.cpp

    r12911 r13165  
    18101810            pConsole->mVMMDev->hgcmHostCall ("VBoxGuestPropSvc", guestProp::SET_CFGM_NODE, 3, &parms[0]);
    18111811
     1812            /* Register the host notification callback */
     1813            parms[0].type = VBOX_HGCM_SVC_PARM_CALLBACK;
     1814            parms[0].u.callback.pFunction = Console::doGuestPropNotification;
     1815            parms[0].u.callback.pvData = pvConsole;
     1816
     1817            pConsole->mVMMDev->hgcmHostCall ("VBoxGuestPropSvc", guestProp::REGISTER_CALLBACK, 1, &parms[0]);
     1818
    18121819            Log(("Set VBoxGuestPropSvc property store\n"));
    18131820        }
  • trunk/src/VBox/Main/MachineImpl.cpp

    r12914 r13165  
    89268926    LogFlowThisFunc (("\n"));
    89278927
     8928#ifdef VBOX_WITH_GUEST_PROPS
    89288929    AutoCaller autoCaller (this);
    89298930    AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
     
    89578958    mHWData->mPropertyServiceActive = true;
    89588959    return S_OK;
     8960#else
     8961    return VERR_NOT_IMPLEMENTED;
     8962#endif
    89598963}
    89608964
     
    89658969{
    89668970    LogFlowThisFunc (("\n"));
     8971
     8972#ifdef VBOX_WITH_GUEST_PROPS
    89678973    AutoCaller autoCaller (this);
    89688974    AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
     
    90069012    mData->mRegistered = TRUE;
    90079013    return S_OK;
     9014#else
     9015    return VERR_NOT_IMPLEMENTED;
     9016#endif
     9017}
     9018
     9019STDMETHODIMP SessionMachine::PushGuestProperty (INPTR BSTR aName, INPTR BSTR aValue,
     9020                                                ULONG64 aTimestamp, INPTR BSTR aFlags)
     9021{
     9022    LogFlowThisFunc (("\n"));
     9023
     9024#ifdef VBOX_WITH_GUEST_PROPS
     9025    if (!VALID_PTR(aName))
     9026        return E_INVALIDARG;
     9027    if ((aValue != NULL) && (!VALID_PTR(aValue) || !VALID_PTR(aFlags)))
     9028        return E_INVALIDARG;  /* aValue can be NULL to indicate deletion */
     9029
     9030    AutoCaller autoCaller (this);
     9031    CheckComRCReturnRC (autoCaller.rc());
     9032
     9033    AutoWriteLock alock (this);
     9034
     9035    HRESULT rc = checkStateDependency (MutableStateDep);
     9036    CheckComRCReturnRC (rc);
     9037
     9038    mHWData.backup();
     9039    for (HWData::GuestPropertyList::iterator iter = mHWData->mGuestProperties.begin();
     9040         iter != mHWData->mGuestProperties.end(); ++iter)
     9041        if (aName == iter->mName)
     9042        {
     9043            mHWData->mGuestProperties.erase(iter);
     9044            break;
     9045        }
     9046    if (aValue != NULL)
     9047    {
     9048        HWData::GuestProperty property = { aName, aValue, aTimestamp, aFlags };
     9049        mHWData->mGuestProperties.push_back(property);
     9050    }
     9051
     9052    /* send a callback notification if appropriate */
     9053    alock.leave();
     9054    // doGuestPropertyCallback(aName, aValue, aFlags);
     9055
     9056    return S_OK;
     9057#else
     9058    return VERR_NOT_IMPLEMENTED;
     9059#endif
    90089060}
    90099061
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r13084 r13165  
    22512251  <interface
    22522252     name="IInternalMachineControl" extends="$unknown"
    2253      uuid="de04566a-7125-444b-949e-34e9f3ec3676"
     2253     uuid="4042ddf2-93d3-4749-8517-dde3f17ea630"
    22542254     internal="yes"
    22552255     wsmap="suppress"
     
    25272527      <param name="name" type="wstring" dir="in" safearray="yes">
    25282528        <desc>
    2529           The names of the properties returned.
     2529          The names of the properties.
    25302530        </desc>
    25312531      </param>
    25322532      <param name="value" type="wstring" dir="in" safearray="yes">
    25332533        <desc>
    2534           The values of the properties returned.  The array entries match the
     2534          The values of the properties.  The array entries match the
    25352535          corresponding entries in the @a name array.
    25362536        </desc>
     
    25382538      <param name="timestamp" type="unsigned long long" dir="in" safearray="yes">
    25392539        <desc>
    2540           The timestamps of the properties returned.  The array entries match
     2540          The timestamps of the properties.  The array entries match
    25412541          the corresponding entries in the @a name array.
    25422542        </desc>
     
    25442544      <param name="flags" type="wstring" dir="in" safearray="yes">
    25452545        <desc>
    2546           The flags of the properties returned.  The array entries match the
     2546          The flags of the properties.  The array entries match the
    25472547          corresponding entries in the @a name array.
     2548        </desc>
     2549      </param>
     2550    </method>
     2551    <method name="pushGuestProperty">
     2552      <desc>
     2553        Update a single guest property in IMachine.
     2554      </desc>
     2555      <param name="name" type="wstring" dir="in">
     2556        <desc>
     2557          The name of the property to be updated.
     2558        </desc>
     2559      </param>
     2560      <param name="value" type="wstring" dir="in">
     2561        <desc>
     2562          The value of the property.
     2563        </desc>
     2564      </param>
     2565      <param name="timestamp" type="unsigned long long" dir="in">
     2566        <desc>
     2567          The timestamp of the property.
     2568        </desc>
     2569      </param>
     2570      <param name="flags" type="wstring" dir="in">
     2571        <desc>
     2572          The flags of the property.
    25482573        </desc>
    25492574      </param>
  • trunk/src/VBox/Main/include/ConsoleImpl.h

    r13079 r13165  
    4141#include <VBox/vrdpapi.h>
    4242#include <VBox/pdmdrv.h>
     43#ifdef VBOX_WITH_GUEST_PROPS
     44# include <VBox/HostServices/GuestPropertySvc.h>  /* For the property notification callback */
     45#endif
    4346
    4447struct VUSBIRHCONFIG;
     
    485488    static DECLCALLBACK(int)    loadStateFileExec (PSSMHANDLE pSSM, void *pvUser, uint32_t u32Version);
    486489
     490#ifdef VBOX_WITH_GUEST_PROPS
     491    static DECLCALLBACK(void)   doGuestPropNotification (PVBOXHGCMCALLBACKHDR pHeader);
     492#endif
     493
    487494    bool mSavedStateDataLoaded : 1;
    488495
  • trunk/src/VBox/Main/include/MachineImpl.h

    r11683 r13165  
    845845    STDMETHOD(PushGuestProperties) (ComSafeArrayIn(INPTR BSTR, aNames), ComSafeArrayIn(INPTR BSTR, aValues),
    846846              ComSafeArrayIn(ULONG64, aTimestamps), ComSafeArrayIn(INPTR BSTR, aFlags));
     847    STDMETHOD(PushGuestProperty) (INPTR BSTR aName, INPTR BSTR aValue,
     848                                  ULONG64 aTimestamp, INPTR BSTR aFlags);
    847849
    848850    // public methods only for internal purposes
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