@joebigelow / wix-1 / commits / 12a5bf68

Track progress of bundle being laid out.

Sean Hall committed Apr 16, 2021 at 10:31 UTC 12a5bf684009c743a9de56f48681466a2cfdda02
1 file changed +25 -6
src/engine/apply.cpp
+25 -6
@@ -82,7 +82,8 @@ static HRESULT ApplyLayoutBundle(
82 __in BURN_CACHE_CONTEXT* pContext,
83 __in BURN_PAYLOAD_GROUP* pPayloads,
84 __in_z LPCWSTR wzExecutableName,
85 - __in_z LPCWSTR wzUnverifiedPath
85 + __in_z LPCWSTR wzUnverifiedPath,
86 + __in DWORD64 qwBundleSize
87 );
88 static HRESULT ApplyLayoutContainer(
89 __in BURN_CACHE_CONTEXT* pContext,
@@ -100,7 +101,8 @@ static HRESULT ExtractContainer(
101 static HRESULT LayoutBundle(
102 __in BURN_CACHE_CONTEXT* pContext,
103 __in_z LPCWSTR wzExecutableName,
103 - __in_z LPCWSTR wzUnverifiedPath
104 + __in_z LPCWSTR wzUnverifiedPath,
105 + __in DWORD64 qwBundleSize
106 );
107 static HRESULT ApplyAcquireContainerOrPayload(
108 __in BURN_CACHE_CONTEXT* pContext,
@@ -504,7 +506,7 @@ extern "C" HRESULT ApplyCache(
506 break;
507
508 case BURN_CACHE_ACTION_TYPE_LAYOUT_BUNDLE:
507 - hr = ApplyLayoutBundle(&cacheContext, pCacheAction->bundleLayout.pPayloadGroup, pCacheAction->bundleLayout.sczExecutableName, pCacheAction->bundleLayout.sczUnverifiedPath);
509 + hr = ApplyLayoutBundle(&cacheContext, pCacheAction->bundleLayout.pPayloadGroup, pCacheAction->bundleLayout.sczExecutableName, pCacheAction->bundleLayout.sczUnverifiedPath, pCacheAction->bundleLayout.qwBundleSize);
510 ExitOnFailure(hr, "Failed cache action: %ls", L"layout bundle");
511
512 ++(*pcOverallProgressTicks);
@@ -866,12 +868,13 @@ static HRESULT ApplyLayoutBundle(
868 __in BURN_CACHE_CONTEXT* pContext,
869 __in BURN_PAYLOAD_GROUP* pPayloads,
870 __in_z LPCWSTR wzExecutableName,
869 - __in_z LPCWSTR wzUnverifiedPath
871 + __in_z LPCWSTR wzUnverifiedPath,
872 + __in DWORD64 qwBundleSize
873 )
874 {
875 HRESULT hr = S_OK;
876
874 - hr = LayoutBundle(pContext, wzExecutableName, wzUnverifiedPath);
877 + hr = LayoutBundle(pContext, wzExecutableName, wzUnverifiedPath, qwBundleSize);
878 ExitOnFailure(hr, "Failed to layout bundle.");
879
880 for (DWORD i = 0; i < pPayloads->cPayloads; ++i)
@@ -1073,7 +1076,8 @@ LExit:
1076 static HRESULT LayoutBundle(
1077 __in BURN_CACHE_CONTEXT* pContext,
1078 __in_z LPCWSTR wzExecutableName,
1076 - __in_z LPCWSTR wzUnverifiedPath
1079 + __in_z LPCWSTR wzUnverifiedPath,
1080 + __in DWORD64 qwBundleSize
1081 )
1082 {
1083 HRESULT hr = S_OK;
@@ -1107,6 +1111,8 @@ static HRESULT LayoutBundle(
1111
1112 if (CSTR_EQUAL == nEquivalentPaths && FileExistsEx(sczDestinationPath, NULL))
1113 {
1114 + // TODO: send Acquire and Verify messages to BA?
1115 + pContext->qwSuccessfulCacheProgress += 2 * qwBundleSize;
1116 ExitFunction1(hr = S_OK);
1117 }
1118
@@ -1128,6 +1134,12 @@ static HRESULT LayoutBundle(
1134 hr = CopyPayload(&progress, pContext->hSourceEngineFile, sczBundlePath, wzUnverifiedPath);
1135 // Error handling happens after sending complete message to BA.
1136
1137 + // If succeeded, send 100% complete here to make sure progress was sent to the BA.
1138 + if (SUCCEEDED(hr))
1139 + {
1140 + hr = CompleteCacheProgress(&progress, qwBundleSize);
1141 + }
1142 +
1143 UserExperienceOnCacheAcquireComplete(pContext->pUX, NULL, NULL, hr, &fRetryAcquire);
1144 if (fRetryAcquire)
1145 {
@@ -1163,9 +1175,16 @@ static HRESULT LayoutBundle(
1175 fRetry = TRUE; // go back and retry acquire.
1176 }
1177 } while (S_FALSE == hr);
1178 +
1179 + if (fRetry)
1180 + {
1181 + pContext->qwSuccessfulCacheProgress -= qwBundleSize;
1182 + }
1183 } while (fRetry);
1184 LogExitOnFailure(hr, MSG_FAILED_LAYOUT_BUNDLE, "Failed to layout bundle: %ls to layout directory: %ls", sczBundlePath, pContext->wzLayoutDirectory);
1185
1186 + pContext->qwSuccessfulCacheProgress += qwBundleSize;
1187 +
1188 LExit:
1189 ReleaseStr(sczDestinationPath);
1190 ReleaseStr(sczBundleDownloadUrl);