Skip to content

Commit 1f8ef3a

Browse files
committed
view
1 parent c9bc154 commit 1f8ef3a

File tree

7 files changed

+52
-11
lines changed

7 files changed

+52
-11
lines changed

dev/PackageManager/API/M.W.M.D.AddPackageOptions.cpp

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,14 +178,30 @@ namespace winrt::Microsoft::Windows::Management::Deployment::implementation
178178
{
179179
return WindowsVersion::SupportsIAppxFactory4();
180180
}
181-
winrt::Windows::Foundation::Collections::IMap<winrt::Windows::Foundation::Uri, winrt::Windows::Foundation::Collections::IVector<winrt::Microsoft::Windows::Management::Deployment::IPackageValidator> > AddPackageOptions::PackageValidators()
181+
winrt::Windows::Foundation::Collections::IMapView<winrt::Windows::Foundation::Uri, winrt::Windows::Foundation::Collections::IVector<winrt::Microsoft::Windows::Management::Deployment::IPackageValidator> > AddPackageOptions::PackageValidators()
182182
{
183183
THROW_HR_IF(E_NOTIMPL, !::Microsoft::Windows::Management::Deployment::Feature_PackageValidator::IsEnabled());
184184

185+
if (!m_packageValidators)
186+
{
187+
// return an empty view
188+
return winrt::single_threaded_map<winrt::Windows::Foundation::Uri, winrt::Windows::Foundation::Collections::IVector<winrt::Microsoft::Windows::Management::Deployment::IPackageValidator> >().GetView();
189+
}
190+
else
191+
{
192+
return m_packageValidators.GetView();
193+
}
194+
}
195+
void AddPackageOptions::AddPackageValidator(winrt::Windows::Foundation::Uri const& packageUri, winrt::Microsoft::Windows::Management::Deployment::IPackageValidator const& validator)
196+
{
185197
if (!m_packageValidators)
186198
{
187199
m_packageValidators = winrt::single_threaded_map<winrt::Windows::Foundation::Uri, winrt::Windows::Foundation::Collections::IVector<winrt::Microsoft::Windows::Management::Deployment::IPackageValidator> >();
188200
}
189-
return m_packageValidators;
201+
if (!m_packageValidators.HasKey(packageUri))
202+
{
203+
m_packageValidators.Insert(packageUri, winrt::single_threaded_vector<winrt::Microsoft::Windows::Management::Deployment::IPackageValidator>());
204+
}
205+
m_packageValidators.Lookup(packageUri).Append(validator);
190206
}
191207
}

dev/PackageManager/API/M.W.M.D.AddPackageOptions.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ namespace winrt::Microsoft::Windows::Management::Deployment::implementation
4747
bool LimitToExistingPackages();
4848
void LimitToExistingPackages(bool value);
4949
bool IsPackageValidatorsSupported();
50-
winrt::Windows::Foundation::Collections::IMap<winrt::Windows::Foundation::Uri, winrt::Windows::Foundation::Collections::IVector<winrt::Microsoft::Windows::Management::Deployment::IPackageValidator> > PackageValidators();
50+
winrt::Windows::Foundation::Collections::IMapView<winrt::Windows::Foundation::Uri, winrt::Windows::Foundation::Collections::IVector<winrt::Microsoft::Windows::Management::Deployment::IPackageValidator> > PackageValidators();
51+
void AddPackageValidator(winrt::Windows::Foundation::Uri const&, winrt::Microsoft::Windows::Management::Deployment::IPackageValidator const&);
5152

5253
private:
5354
winrt::Microsoft::Windows::Management::Deployment::PackageVolume m_targetVolume{ nullptr };

dev/PackageManager/API/M.W.M.D.PackageDeploymentManager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3679,7 +3679,7 @@ namespace winrt::Microsoft::Windows::Management::Deployment::implementation
36793679
}
36803680

36813681
void PackageDeploymentManager::ValidatePackagesAndUpdateExpectedDigests(
3682-
winrt::Windows::Foundation::Collections::IMap<winrt::Windows::Foundation::Uri, winrt::Windows::Foundation::Collections::IVector<winrt::Microsoft::Windows::Management::Deployment::IPackageValidator> > const& packageValidators,
3682+
winrt::Windows::Foundation::Collections::IMapView<winrt::Windows::Foundation::Uri, winrt::Windows::Foundation::Collections::IVector<winrt::Microsoft::Windows::Management::Deployment::IPackageValidator> > const& packageValidators,
36833683
winrt::Windows::Foundation::Collections::IMap<winrt::Windows::Foundation::Uri, hstring>& expectedDigests
36843684
)
36853685
{

dev/PackageManager/API/M.W.M.D.PackageDeploymentManager.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ namespace winrt::Microsoft::Windows::Management::Deployment::implementation
282282
static bool IsUriScheme_MsUup(winrt::Windows::Foundation::Uri const& packageUri);
283283

284284
void ValidatePackagesAndUpdateExpectedDigests(
285-
winrt::Windows::Foundation::Collections::IMap<winrt::Windows::Foundation::Uri, winrt::Windows::Foundation::Collections::IVector<winrt::Microsoft::Windows::Management::Deployment::IPackageValidator> > const& packageValidators,
285+
winrt::Windows::Foundation::Collections::IMapView<winrt::Windows::Foundation::Uri, winrt::Windows::Foundation::Collections::IVector<winrt::Microsoft::Windows::Management::Deployment::IPackageValidator> > const& packageValidators,
286286
winrt::Windows::Foundation::Collections::IMap<winrt::Windows::Foundation::Uri, hstring>& expectedDigests
287287
);
288288

dev/PackageManager/API/M.W.M.D.StagePackageOptions.cpp

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,15 +133,30 @@ namespace winrt::Microsoft::Windows::Management::Deployment::implementation
133133
{
134134
return WindowsVersion::SupportsIAppxFactory4();
135135
}
136-
winrt::Windows::Foundation::Collections::IMap<winrt::Windows::Foundation::Uri, winrt::Windows::Foundation::Collections::IVector<winrt::Microsoft::Windows::Management::Deployment::IPackageValidator> > StagePackageOptions::PackageValidators()
136+
winrt::Windows::Foundation::Collections::IMapView<winrt::Windows::Foundation::Uri, winrt::Windows::Foundation::Collections::IVector<winrt::Microsoft::Windows::Management::Deployment::IPackageValidator> > StagePackageOptions::PackageValidators()
137137
{
138138
THROW_HR_IF(E_NOTIMPL, !::Microsoft::Windows::Management::Deployment::Feature_PackageValidator::IsEnabled());
139139

140+
if (!m_packageValidators)
141+
{
142+
// return an empty view
143+
return winrt::single_threaded_map<winrt::Windows::Foundation::Uri, winrt::Windows::Foundation::Collections::IVector<winrt::Microsoft::Windows::Management::Deployment::IPackageValidator> >().GetView();
144+
}
145+
else
146+
{
147+
return m_packageValidators.GetView();
148+
}
149+
}
150+
void StagePackageOptions::AddPackageValidator(winrt::Windows::Foundation::Uri const& packageUri, winrt::Microsoft::Windows::Management::Deployment::IPackageValidator const& validator)
151+
{
140152
if (!m_packageValidators)
141153
{
142154
m_packageValidators = winrt::single_threaded_map<winrt::Windows::Foundation::Uri, winrt::Windows::Foundation::Collections::IVector<winrt::Microsoft::Windows::Management::Deployment::IPackageValidator> >();
143155
}
144-
return m_packageValidators;
156+
if (!m_packageValidators.HasKey(packageUri))
157+
{
158+
m_packageValidators.Insert(packageUri, winrt::single_threaded_vector<winrt::Microsoft::Windows::Management::Deployment::IPackageValidator>());
159+
}
160+
m_packageValidators.Lookup(packageUri).Append(validator);
145161
}
146-
147162
}

dev/PackageManager/API/M.W.M.D.StagePackageOptions.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ namespace winrt::Microsoft::Windows::Management::Deployment::implementation
3636
bool IsExpectedDigestsSupported();
3737
winrt::Windows::Foundation::Collections::IMap<winrt::Windows::Foundation::Uri, hstring> ExpectedDigests();
3838
bool IsPackageValidatorsSupported();
39-
winrt::Windows::Foundation::Collections::IMap<winrt::Windows::Foundation::Uri, winrt::Windows::Foundation::Collections::IVector<winrt::Microsoft::Windows::Management::Deployment::IPackageValidator> > PackageValidators();
39+
winrt::Windows::Foundation::Collections::IMapView<winrt::Windows::Foundation::Uri, winrt::Windows::Foundation::Collections::IVector<winrt::Microsoft::Windows::Management::Deployment::IPackageValidator> > PackageValidators();
40+
void AddPackageValidator(winrt::Windows::Foundation::Uri const&, winrt::Microsoft::Windows::Management::Deployment::IPackageValidator const&);
4041

4142
private:
4243
winrt::Microsoft::Windows::Management::Deployment::PackageVolume m_targetVolume{ nullptr };

dev/PackageManager/API/PackageManager.idl

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,11 @@ namespace Microsoft.Windows.Management.Deployment
235235

236236
[feature(Feature_PackageValidator)]
237237
[contract(PackageDeploymentContract, 3)]
238-
IMap<Windows.Foundation.Uri, IVector<IPackageValidator> > PackageValidators{ get; };
238+
IMapView<Windows.Foundation.Uri, IVector<IPackageValidator> > PackageValidators{ get; };
239+
240+
[feature(Feature_PackageValidator)]
241+
[contract(PackageDeploymentContract, 3)]
242+
void AddPackageValidator(Windows.Foundation.Uri packageUri, IPackageValidator validator);
239243
}
240244

241245
// Requires Windows >= 10.0.19041.0 (aka 2004 aka 20H1)
@@ -267,7 +271,11 @@ namespace Microsoft.Windows.Management.Deployment
267271

268272
[feature(Feature_PackageValidator)]
269273
[contract(PackageDeploymentContract, 3)]
270-
IMap<Windows.Foundation.Uri, IVector<IPackageValidator> > PackageValidators{ get; };
274+
IMapView<Windows.Foundation.Uri, IVector<IPackageValidator> > PackageValidators{ get; };
275+
276+
[feature(Feature_PackageValidator)]
277+
[contract(PackageDeploymentContract, 3)]
278+
void AddPackageValidator(Windows.Foundation.Uri packageUri, IPackageValidator validator);
271279
}
272280

273281
// Requires Windows >= 10.0.19041.0 (aka 2004 aka 20H1)

0 commit comments

Comments
 (0)