VirtualBox

Changeset 25903 in vbox for trunk/src/VBox/Main/include


Ignore:
Timestamp:
Jan 18, 2010 6:15:43 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
56719
Message:

Main: make restoreSnapshot() work with the lock validator; take saveSettings() out of a lot of functions and instead return a flag to the caller so the caller can make that call; as a side effect, this no longer calls saveSettings multiple times in several code paths (e.g. restoreSnapshot()) and cleans up locking in medium tasks

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/include/MachineImpl.h

    r25901 r25903  
    889889                                IProgress *aProgress,
    890890                                ULONG aWeight,
    891                                 bool aOnline);
    892     HRESULT deleteImplicitDiffs();
     891                                bool aOnline,
     892                                bool *pfNeedsSaveSettings);
     893    HRESULT deleteImplicitDiffs(bool *pfNeedsSaveSettings);
    893894
    894895    MediumAttachment* findAttachment(const MediaData::AttachmentList &ll,
     
    901902                                     Guid &id);
    902903
    903     void fixupMedia(bool aCommit, bool aOnline = false);
     904    void commitMedia(bool aOnline = false);
     905    void rollbackMedia();
    904906
    905907    bool isInOwnDir(Utf8Str *aSettingsDir = NULL);
     
    10881090
    10891091    HRESULT endSavingState(BOOL aSuccess);
    1090     HRESULT endTakingSnapshot(BOOL aSuccess);
    10911092
    10921093    typedef std::map<ComObjPtr<Machine>, MachineState_T> AffectedMachines;
  • trunk/src/VBox/Main/include/MediumImpl.h

    r25888 r25903  
    7878    HRESULT init(VirtualBox *aVirtualBox,
    7979                 CBSTR aFormat,
    80                  CBSTR aLocation);
     80                 CBSTR aLocation,
     81                 bool *pfNeedsSaveSettings);
    8182    HRESULT init(VirtualBox *aVirtualBox,
    8283                 CBSTR aLocation,
     
    193194     */
    194195    HRESULT deleteStorageNoWait(ComObjPtr<Progress> &aProgress)
    195     { return deleteStorage(&aProgress, false /* aWait */); }
     196    { return deleteStorage(&aProgress, false /* aWait */, NULL /* pfNeedsSaveSettings */); }
    196197
    197198    /**
     
    199200     * blocking the current thread.
    200201     */
    201     HRESULT deleteStorageAndWait(ComObjPtr<Progress> *aProgress = NULL)
    202     { return deleteStorage(aProgress, true /* aWait */); }
     202    HRESULT deleteStorageAndWait(ComObjPtr<Progress> *aProgress, bool *pfNeedsSaveSettings)
     203    { return deleteStorage(aProgress, true /* aWait */, pfNeedsSaveSettings); }
    203204
    204205    /**
     
    209210                                    MediumVariant_T aVariant,
    210211                                    ComObjPtr<Progress> &aProgress)
    211     { return createDiffStorage(aTarget, aVariant, &aProgress, false /* aWait */); }
     212    { return createDiffStorage(aTarget, aVariant, &aProgress, false /* aWait */, NULL /* pfNeedsSaveSettings*/ ); }
    212213
    213214    /**
     
    217218    HRESULT createDiffStorageAndWait(ComObjPtr<Medium> &aTarget,
    218219                                     MediumVariant_T aVariant,
    219                                      ComObjPtr<Progress> *aProgress = NULL)
    220     { return createDiffStorage(aTarget, aVariant, aProgress, true /* aWait */); }
     220                                     bool *pfNeedsSaveSettings)
     221    { return createDiffStorage(aTarget, aVariant, NULL /*aProgress*/, true /* aWait */, pfNeedsSaveSettings); }
    221222
    222223    HRESULT prepareMergeTo(Medium *aTarget, MergeChain * &aChain,
     
    229230    HRESULT mergeToNoWait(MergeChain *aChain,
    230231                          ComObjPtr<Progress> &aProgress)
    231     { return mergeTo(aChain, &aProgress, false /* aWait */); }
     232    { return mergeTo(aChain, &aProgress, false /* aWait */, NULL /*pfNeedsSaveSettings*/); }
    232233
    233234    /**
     
    236237     */
    237238    HRESULT mergeToAndWait(MergeChain *aChain,
    238                            ComObjPtr<Progress> *aProgress = NULL)
    239     { return mergeTo(aChain, aProgress, true /* aWait */); }
     239                           ComObjPtr<Progress> *aProgress,
     240                           bool *pfNeedsSaveSettings)
     241    { return mergeTo(aChain, aProgress, true /* aWait */, pfNeedsSaveSettings); }
    240242
    241243    void cancelMergeTo(MergeChain *aChain);
     
    244246
    245247    HRESULT prepareDiscard(MergeChain * &aChain);
    246     HRESULT discard(ComObjPtr<Progress> &aProgress, ULONG ulWeight, MergeChain *aChain);
     248    HRESULT discard(ComObjPtr<Progress> &aProgress, ULONG ulWeight, MergeChain *aChain, bool *pfNeedsSaveSettings);
    247249    void cancelDiscard(MergeChain *aChain);
    248250
     
    273275     * this object's AutoMayUninitSpan and from under mVirtualBox write lock.
    274276     */
    275     HRESULT unregisterWithVirtualBox();
     277    HRESULT unregisterWithVirtualBox(bool *pfNeedsSaveSettings);
    276278
    277279    HRESULT setStateError();
    278280
    279     HRESULT deleteStorage(ComObjPtr<Progress> *aProgress, bool aWait);
     281    HRESULT deleteStorage(ComObjPtr<Progress> *aProgress, bool aWait, bool *pfNeedsSaveSettings);
    280282
    281283    HRESULT createDiffStorage(ComObjPtr<Medium> &aTarget,
    282284                              MediumVariant_T aVariant,
    283285                              ComObjPtr<Progress> *aProgress,
    284                               bool aWait);
     286                              bool aWait,
     287                              bool *pfNeedsSaveSettings);
    285288
    286289    HRESULT mergeTo(MergeChain *aChain,
    287290                    ComObjPtr<Progress> *aProgress,
    288                     bool aWait);
     291                    bool aWait,
     292                    bool *pfNeedsSaveSettings);
    289293
    290294    HRESULT setLocation(const Utf8Str &aLocation, const Utf8Str &aFormat = Utf8Str());
  • trunk/src/VBox/Main/include/VirtualBoxImpl.h

    r25834 r25903  
    274274    void calculateRelativePath(const Utf8Str &strPath, Utf8Str &aResult);
    275275
    276     HRESULT registerHardDisk(Medium *aHardDisk, bool aSaveRegistry = true);
    277     HRESULT unregisterHardDisk(Medium *aHardDisk, bool aSaveRegistry = true);
    278 
    279     HRESULT registerImage(Medium *aImage, DeviceType_T argType, bool aSaveRegistry = true);
    280     HRESULT unregisterImage(Medium *aImage, DeviceType_T argType, bool aSaveRegistry = true);
     276    HRESULT registerHardDisk(Medium *aHardDisk, bool *pfNeedsSaveSettings);
     277    HRESULT unregisterHardDisk(Medium *aHardDisk, bool *pfNeedsSaveSettings);
     278
     279    HRESULT registerImage(Medium *aImage, DeviceType_T argType, bool *pfNeedsSaveSettings);
     280    HRESULT unregisterImage(Medium *aImage, DeviceType_T argType, bool *pfNeedsSaveSettings);
    281281
    282282    HRESULT saveSettings();
     
    289289    const Utf8Str& settingsFilePath();
    290290
    291     RWLockHandle& hardDiskTreeLockHandle();
     291    RWLockHandle& getMediaTreeLockHandle();
    292292
    293293    /* for VirtualBoxSupportErrorInfoImpl */
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette