Changeset 78723 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- May 24, 2019 12:26:23 PM (6 years ago)
- 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 2520 2520 } 2521 2521 2522 void 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 2522 2546 void VBoxGlobal::refreshMedia() 2523 2547 { … … 3307 3331 { 3308 3332 /* UI medium may be new and not among our media, request enumeration: */ 3309 startMediumEnumeration();3333 enumerateAdditionalMedium(comMedium); 3310 3334 3311 3335 /* Search for corresponding UI medium again: */ -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.h
r78722 r78723 478 478 /** Starts medium-enumeration. */ 479 479 void startMediumEnumeration(const CMediumVector &mediaList = CMediumVector()); 480 /** Enumerates additional medium. */ 481 void enumerateAdditionalMedium(const CMedium &comMedium); 480 482 /** Calls refresh for each medium which has been already enumerated. */ 481 483 void refreshMedia(); -
trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumEnumerator.cpp
r78722 r78723 231 231 } 232 232 233 void 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 233 258 void UIMediumEnumerator::refreshMedia() 234 259 { -
trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumEnumerator.h
r78722 r78723 89 89 * @note Empty passed map means that full/overall medium-enumeration is requested. */ 90 90 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); 91 96 /** Refresh all the lightweight UIMedium information for all the cached UIMedium(s). 92 97 * @note Please note that this is a lightweight version, which doesn't perform
Note:
See TracChangeset
for help on using the changeset viewer.