VirtualBox

Changeset 92038 in vbox for trunk/src


Ignore:
Timestamp:
Oct 25, 2021 2:22:18 PM (3 years ago)
Author:
vboxsync
Message:

FE/Qt: Tiny optimization in UIWizardNewVMNameOSTypeCommon::guessOSTypeFromName.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMNameOSTypePage.cpp

    r92037 r92038  
    176176bool UIWizardNewVMNameOSTypeCommon::guessOSTypeFromName(UINameAndSystemEditor *pNameAndSystemEditor, QString strNewName)
    177177{
    178     CHost host = uiCommon().host();
    179     bool fSupportsHWVirtEx = host.GetProcessorFeature(KProcessorFeature_HWVirtEx);
    180     bool fSupportsLongMode = host.GetProcessorFeature(KProcessorFeature_LongMode);
    181 
    182178    /* Append default architecture bit-count (64/32) if not already in the name: */
    183179    if (!strNewName.contains("32") && !strNewName.contains("64"))
     180    {
     181        /** @todo cache this result, no need to re-query it for each keystroke... */
     182        CHost host = uiCommon().host();
     183        bool fSupportsHWVirtEx = host.GetProcessorFeature(KProcessorFeature_HWVirtEx);
     184        bool fSupportsLongMode = host.GetProcessorFeature(KProcessorFeature_LongMode);
    184185        strNewName += ARCH_BITS == 64 && fSupportsHWVirtEx && fSupportsLongMode ? "64" : "32";
     186    }
    185187
    186188    /* Search for a matching OS type based on the string the user typed already. */
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