儲存庫 vbox 的更動 18283
- 時間撮記:
- 2009-3-25 下午09:26:21 (16 年 以前)
- 檔案:
-
- 修改 1 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/src/VBox/Main/ApplianceImpl.cpp
r18278 r18283 1715 1715 pAppliance->m->ulWeightPerOperation); 1716 1716 1717 /* How many sub notifications are necessary? */1718 const float opCountMax = 100.0/5;1719 uint32_t opCount = 0;1720 1721 1717 /* Guest OS type */ 1722 1718 std::list<VirtualSystemDescriptionEntry*> vsdeOS; … … 1754 1750 1755 1751 if (!task->progress.isNull()) 1756 rc = task->progress->setCurrentOperationProgress( (uint32_t)(opCountMax * opCount++));1752 rc = task->progress->setCurrentOperationProgress(20); // let's say 1/5 of the XML is done here 1757 1753 1758 1754 /* CPU count (ignored for now) */ … … 1778 1774 1779 1775 if (!task->progress.isNull()) 1780 task->progress->setCurrentOperationProgress((uint32_t)(opCountMax * opCount++));1776 rc = task->progress->setCurrentOperationProgress(40); // let's say 2/5 of the XML is done here 1781 1777 1782 1778 /* Audio Adapter */ … … 1814 1810 1815 1811 if (!task->progress.isNull()) 1816 task->progress->setCurrentOperationProgress((uint32_t)(opCountMax * opCount++));1812 rc = task->progress->setCurrentOperationProgress(60); // let's say 3/5 of the XML is done here 1817 1813 1818 1814 /* Change the network adapters */ … … 1927 1923 1928 1924 if (!task->progress.isNull()) 1929 task->progress->setCurrentOperationProgress((uint32_t)(opCountMax * opCount++));1925 rc = task->progress->setCurrentOperationProgress(80); // let's say 4/5 of the XML is done here 1930 1926 1931 1927 /* CDROM drive */ … … 2013 2009 2014 2010 if (!task->progress.isNull()) 2015 task->progress->setCurrentOperationProgress((uint32_t)(opCountMax * opCount++));2011 rc = task->progress->setCurrentOperationProgress(90); 2016 2012 2017 2013 // store new machine for roll-back in case of errors … … 2078 2074 throw rc; 2079 2075 2080 ComPtr<IProgress> progress; 2076 // subprogress object for hard disk 2077 ComPtr<IProgress> pProgress2; 2081 2078 2082 2079 ComPtr<IHardDisk> dstHdVBox; … … 2094 2091 2095 2092 /* Create a dynamic growing disk image with the given capacity */ 2096 rc = dstHdVBox->CreateBaseStorage(di.iCapacity / _1M, HardDiskVariant_Standard, p rogress.asOutParam());2093 rc = dstHdVBox->CreateBaseStorage(di.iCapacity / _1M, HardDiskVariant_Standard, pProgress2.asOutParam()); 2097 2094 if (FAILED(rc)) throw rc; 2098 2095 … … 2132 2129 if (FAILED(rc)) throw rc; 2133 2130 /* Clone the source disk image */ 2134 rc = srcHdVBox->CloneTo(dstHdVBox, HardDiskVariant_Standard, p rogress.asOutParam());2131 rc = srcHdVBox->CloneTo(dstHdVBox, HardDiskVariant_Standard, pProgress2.asOutParam()); 2135 2132 if (FAILED(rc)) throw rc; 2136 2133 … … 2141 2138 } 2142 2139 2143 // now loop until the asynchronous operation completes and then 2144 // report its result 2140 // now loop until the asynchronous operation completes and then report its result 2145 2141 BOOL fCompleted; 2142 BOOL fCanceled; 2146 2143 ULONG currentPercent; 2147 while (SUCCEEDED(p rogress->COMGETTER(Completed(&fCompleted))))2144 while (SUCCEEDED(pProgress2->COMGETTER(Completed(&fCompleted)))) 2148 2145 { 2149 rc = progress->COMGETTER(Percent(¤tPercent));2146 rc = task->progress->COMGETTER(Canceled)(&fCanceled); 2150 2147 if (FAILED(rc)) throw rc; 2151 if (!task->progress.isNull()) 2152 task->progress->setCurrentOperationProgress(currentPercent); 2153 if (fCompleted) 2154 break; 2148 if (fCanceled) 2149 pProgress2->Cancel(); 2150 else 2151 { 2152 rc = pProgress2->COMGETTER(Percent(¤tPercent)); 2153 if (FAILED(rc)) throw rc; 2154 if (!task->progress.isNull()) 2155 task->progress->setCurrentOperationProgress(currentPercent); 2156 if (fCompleted) 2157 break; 2158 } 2155 2159 /* Make sure the loop is not too tight */ 2156 rc = p rogress->WaitForCompletion(100);2160 rc = pProgress2->WaitForCompletion(100); 2157 2161 if (FAILED(rc)) throw rc; 2158 2162 } 2159 2163 // report result of asynchronous operation 2160 2164 HRESULT vrc; 2161 rc = p rogress->COMGETTER(ResultCode)(&vrc);2165 rc = pProgress2->COMGETTER(ResultCode)(&vrc); 2162 2166 if (FAILED(rc)) throw rc; 2163 2167 … … 2166 2170 if (FAILED(vrc)) 2167 2171 { 2168 ProgressErrorInfo info(p rogress);2172 ProgressErrorInfo info(pProgress2); 2169 2173 Utf8Str str(info.getText()); 2170 2174 const char *pcsz = str.c_str(); … … 3025 3029 pDiskEntry->ulSizeMB); // operation's weight, as set up with the IProgress originally); 3026 3030 3027 // now loop until the asynchronous operation completes and then 3028 // report its result 3031 // now loop until the asynchronous operation completes and then report its result 3029 3032 BOOL fCompleted; 3033 BOOL fCanceled; 3030 3034 ULONG currentPercent; 3031 3035 while (SUCCEEDED(pProgress2->COMGETTER(Completed(&fCompleted)))) 3032 3036 { 3033 rc = pProgress2->COMGETTER(Percent(¤tPercent));3037 rc = task->progress->COMGETTER(Canceled)(&fCanceled); 3034 3038 if (FAILED(rc)) throw rc; 3035 if (!task->progress.isNull()) 3036 task->progress->setCurrentOperationProgress(currentPercent); 3037 if (fCompleted) 3038 break; 3039 // make sure the loop is not too tight 3039 if (fCanceled) 3040 pProgress2->Cancel(); 3041 else 3042 { 3043 rc = pProgress2->COMGETTER(Percent(¤tPercent)); 3044 if (FAILED(rc)) throw rc; 3045 if (!task->progress.isNull()) 3046 task->progress->setCurrentOperationProgress(currentPercent); 3047 if (fCompleted) 3048 break; 3049 } 3050 /* Make sure the loop is not too tight */ 3040 3051 rc = pProgress2->WaitForCompletion(100); 3041 3052 if (FAILED(rc)) throw rc; 3042 3053 } 3043 3044 3054 // report result of asynchronous operation 3045 3055 HRESULT vrc; … … 3201 3211 3202 3212 /** 3203 * Calculates the no. of operations for the IProgress objects in importMachines() and write(). 3213 * Sets up the given progress object so that it represents disk images accurately 3214 * during importMachines() and write(). 3215 * @param pProgress 3216 * @param bstrDescription 3204 3217 * @return 3205 3218 */ … … 3245 3258 else 3246 3259 { 3260 // no disks to export: 3247 3261 ulTotalOperationsWeight = cFixed; 3248 3262 m->ulWeightPerOperation = 1; … … 3254 3268 rc = pProgress->init(mVirtualBox, static_cast<IAppliance*>(this), 3255 3269 bstrDescription, 3256 FALSE /* aCancelable */,3270 TRUE /* aCancelable */, 3257 3271 cFixed + (ULONG)cDisks, // ULONG cOperations, 3258 3272 ulTotalOperationsWeight, // ULONG ulTotalOperationsWeight,
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器