VirtualBox

Changeset 3302 in vbox for trunk/src


Ignore:
Timestamp:
Jun 26, 2007 3:50:41 PM (18 years ago)
Author:
vboxsync
Message:

Main: More Machine children use the AutoStateDependency template.

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

Legend:

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

    r3007 r3302  
    171171    CheckComRCReturnRC (autoCaller.rc());
    172172
    173     AutoLock alock (this);
    174 
    175     CHECK_MACHINE_MUTABILITY (mParent);
     173    /* the machine needs to be mutable */
     174    Machine::AutoMutableStateDependency adep (mParent);
     175    CheckComRCReturnRC (adep.rc());
     176
     177    AutoLock alock (this);
    176178
    177179    mData.backup();
     
    201203    CheckComRCReturnRC (autoCaller.rc());
    202204
    203     AutoLock alock (this);
    204 
    205     CHECK_MACHINE_MUTABILITY (mParent);
     205    /* the machine needs to be mutable */
     206    Machine::AutoMutableStateDependency adep (mParent);
     207    CheckComRCReturnRC (adep.rc());
     208
     209    AutoLock alock (this);
    206210
    207211    mData.backup();
     
    231235    CheckComRCReturnRC (autoCaller.rc());
    232236
    233     AutoLock alock (this);
    234 
    235     CHECK_MACHINE_MUTABILITY (mParent);
     237    /* the machine needs to be mutable */
     238    Machine::AutoMutableStateDependency adep (mParent);
     239    CheckComRCReturnRC (adep.rc());
     240
     241    AutoLock alock (this);
    236242
    237243    mData.backup();
     
    264270    CheckComRCReturnRC (autoCaller.rc());
    265271
    266     AutoLock alock (this);
    267 
    268     CHECK_MACHINE_MUTABILITY (mParent);
     272    /* the machine needs to be mutable */
     273    Machine::AutoMutableStateDependency adep (mParent);
     274    CheckComRCReturnRC (adep.rc());
     275
     276    AutoLock alock (this);
    269277
    270278    mData.backup();
     
    293301    CheckComRCReturnRC (autoCaller.rc());
    294302
    295     AutoLock alock (this);
    296 
    297     CHECK_MACHINE_MUTABILITY (mParent);
     303    /* the machine needs to be mutable */
     304    Machine::AutoMutableStateDependency adep (mParent);
     305    CheckComRCReturnRC (adep.rc());
     306
     307    AutoLock alock (this);
    298308
    299309    mData.backup();
     
    323333    CheckComRCReturnRC (autoCaller.rc());
    324334
    325     AutoLock alock (this);
    326 
    327     CHECK_MACHINE_MUTABILITY (mParent);
     335    /* the machine needs to be mutable */
     336    Machine::AutoMutableStateDependency adep (mParent);
     337    CheckComRCReturnRC (adep.rc());
     338
     339    AutoLock alock (this);
    328340
    329341    mData.backup();
     
    353365    CheckComRCReturnRC (autoCaller.rc());
    354366
    355     AutoLock alock (this);
    356 
    357     CHECK_MACHINE_MUTABILITY (mParent);
     367    /* the machine needs to be mutable */
     368    Machine::AutoMutableStateDependency adep (mParent);
     369    CheckComRCReturnRC (adep.rc());
     370
     371    AutoLock alock (this);
    358372
    359373    mData.backup();
     
    383397    CheckComRCReturnRC (autoCaller.rc());
    384398
    385     AutoLock alock (this);
    386 
    387     CHECK_MACHINE_MUTABILITY (mParent);
     399    /* the machine needs to be mutable */
     400    Machine::AutoMutableStateDependency adep (mParent);
     401    CheckComRCReturnRC (adep.rc());
     402
     403    AutoLock alock (this);
    388404
    389405    mData.backup();
  • trunk/src/VBox/Main/USBControllerImpl.cpp

    r3007 r3302  
    227227    CheckComRCReturnRC (autoCaller.rc());
    228228
     229    /* the machine needs to be mutable */
     230    Machine::AutoMutableStateDependency adep (mParent);
     231    CheckComRCReturnRC (adep.rc());
     232
    229233    AutoLock alock (this);
    230 
    231     CHECK_MACHINE_MUTABILITY (mParent);
    232234
    233235    if (mData->mEnabled != aEnabled)
     
    295297    CheckComRCReturnRC (autoCaller.rc());
    296298
     299    /* the machine needs to be mutable */
     300    Machine::AutoMutableStateDependency adep (mParent);
     301    CheckComRCReturnRC (adep.rc());
     302
    297303    AutoLock alock (this);
    298 
    299     CHECK_MACHINE_MUTABILITY (mParent);
    300304
    301305    ComObjPtr <USBDeviceFilter> filter;
     
    319323
    320324    /* the machine needs to be mutable */
    321     Machine::AutoStateDependency <Machine::MutableStateDep> adep (mParent);
     325    Machine::AutoMutableStateDependency adep (mParent);
    322326    CheckComRCReturnRC (adep.rc());
    323327
     
    380384
    381385    /* the machine needs to be mutable */
    382     Machine::AutoStateDependency <Machine::MutableStateDep> adep (mParent);
     386    Machine::AutoMutableStateDependency adep (mParent);
    383387    CheckComRCReturnRC (adep.rc());
    384388
     
    677681
    678682    /* we need the machine state */
    679     Machine::AutoStateDependency <Machine::MutableStateDep> adep (mParent);
     683    Machine::AutoMutableStateDependency adep (mParent);
    680684    AssertComRCReturn (adep.rc(), false);
    681685
     
    950954#else
    951955    /* we need the machine state */
    952     Machine::AutoStateDependency <Machine::MutableStateDep> adep (mParent);
     956    Machine::AutoMutableStateDependency adep (mParent);
    953957    AssertComRCReturnRC (adep.rc());
    954958
  • trunk/src/VBox/Main/include/MachineImpl.h

    r3001 r3302  
    299299     *
    300300     *  @code
     301     *      AutoCaller autoCaller (this);
     302     *      CheckComRCReturnRC (autoCaller.rc());
     303     *
    301304     *      Machine::AutoStateDependency <MutableStateDep> adep (mParent);
    302305     *      CheckComRCReturnRC (stateDep.rc());
     
    305308     *      ...
    306309     *  @endcode
     310     *
     311     *  Note that it is more convenient to use the following individual
     312     *  shortcut classes instead of using this template directly:
     313     *  AutoAnyStateDependency, AutoMutableStateDependency and
     314     *  AutoMutableOrSavedStateDependency. The usage pattern is exactly the
     315     *  same as above except that there is no need to specify the template
     316     *  argument because it is already done by the shortcut class.
    307317     *
    308318     *  @param taDepType    Dependecy type to manage.
     
    373383        DECLARE_CLS_NEW_DELETE_NOOP (AutoStateDependency)
    374384    };
     385
     386    /**
     387     *  Shortcut to AutoStateDependency <AnyStateDep>.
     388     *  See AutoStateDependency to get the usage pattern.
     389     *
     390     *  Accepts any machine state and guarantees the state won't change before
     391     *  this object is destroyed. If the machine state cannot be protected (as
     392     *  a result of the state change currently in progress), this instance's
     393     *  #rc() method will indicate a failure, and the caller is not allowed to
     394     *  rely on any particular machine state and should return the failed
     395     *  result code to the upper level.
     396     */
     397    typedef AutoStateDependency <AnyStateDep> AutoAnyStateDependency;
     398
     399    /**
     400     *  Shortcut to AutoStateDependency <MutableStateDep>.
     401     *  See AutoStateDependency to get the usage pattern.
     402     *
     403     *  Succeeds only if the machine state is in one of the mutable states, and
     404     *  guarantees the given mutable state won't change before this object is
     405     *  destroyed. If the machine is not mutable, this instance's #rc() method
     406     *  will indicate a failure, and the caller is not allowed to rely on any
     407     *  particular machine state and should return the failed result code to
     408     *  the upper level.
     409     *
     410     *  Intended to be used within all setter methods of IMachine
     411     *  children objects (DVDDrive, NetworkAdapter, AudioAdapter, etc.) to
     412     *  provide data protection and consistency.
     413     */
     414    typedef AutoStateDependency <MutableStateDep> AutoMutableStateDependency;
     415
     416    /**
     417     *  Shortcut to AutoStateDependency <MutableOrSavedStateDep>.
     418     *  See AutoStateDependency to get the usage pattern.
     419     *
     420     *  Succeeds only if the machine state is in one of the mutable states, or
     421     *  if the machine is in the Saved state, and guarantees the given mutable
     422     *  state won't change before this object is destroyed. If the machine is
     423     *  not mutable, this instance's #rc() method will indicate a failure, and
     424     *  the caller is not allowed to rely on any particular machine state and
     425     *  should return the failed result code to the upper level.
     426     *
     427     *  Intended to be used within setter methods of IMachine
     428     *  children objects that may also operate on Saved machines.
     429     */
     430    typedef AutoStateDependency <MutableOrSavedStateDep> AutoMutableOrSavedStateDependency;
     431
    375432
    376433    VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT (Machine)
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