1 write to _contextPool
PresentationFramework (1)
MS\Internal\PtsHost\PtsCache.cs (1)
145
_contextPool
= new List<ContextDesc>(1);
60 references to _contextPool
PresentationFramework (60)
MS\Internal\PtsHost\PtsCache.cs (60)
182
for (index = 0; index <
_contextPool
.Count; index++)
184
if (!
_contextPool
[index].InUse &&
185
_contextPool
[index].IsOptimalParagraphEnabled == ptsContext.IsOptimalParagraphEnabled)
193
if (index ==
_contextPool
.Count)
195
_contextPool
.Add(new ContextDesc());
196
_contextPool
[index].IsOptimalParagraphEnabled = ptsContext.IsOptimalParagraphEnabled;
197
_contextPool
[index].PtsHost = new PtsHost();
198
_contextPool
[index].PtsHost.Context = CreatePTSContext(index, textFormattingMode);
204
if (
_contextPool
[index].IsOptimalParagraphEnabled)
206
ptsContext.TextFormatter =
_contextPool
[index].TextFormatter;
210
_contextPool
[index].InUse = true;
211
_contextPool
[index].Owner = new WeakReference(ptsContext);
213
return
_contextPool
[index].PtsHost;
251
for (index = 0; index <
_contextPool
.Count; index++)
253
if (
_contextPool
[index].PtsHost == ptsHost)
258
Invariant.Assert(index <
_contextPool
.Count, "Cannot find matching PtsHost in the Context pool.");
259
PTS.Validate(PTS.GetFloaterHandlerInfo(ref
_contextPool
[index].FloaterInit, pobjectinfo));
270
for (index = 0; index <
_contextPool
.Count; index++)
272
if (
_contextPool
[index].PtsHost == ptsHost)
277
Invariant.Assert(index <
_contextPool
.Count, "Cannot find matching PtsHost in the context pool.");
278
PTS.Validate(PTS.GetTableObjHandlerInfo(ref
_contextPool
[index].TableobjInit, pobjectinfo));
311
while (index <
_contextPool
.Count)
313
PtsContext ptsContext =
_contextPool
[index].Owner.Target as PtsContext;
316
Invariant.Assert(
_contextPool
[index].PtsHost.Context == ptsContext.Context, "PTS Context mismatch.");
317
_contextPool
[index].Owner = new WeakReference(null);
318
_contextPool
[index].InUse = false;
324
if (!
_contextPool
[index].InUse)
329
Invariant.Assert(
_contextPool
[index].PtsHost.Context != IntPtr.Zero, "PTS Context handle is not valid.");
330
PTS.IgnoreError(PTS.DestroyDocContext(
_contextPool
[index].PtsHost.Context));
331
Invariant.Assert(
_contextPool
[index].InstalledObjects != IntPtr.Zero, "Installed Objects handle is not valid.");
332
PTS.IgnoreError(PTS.DestroyInstalledObjectsInfo(
_contextPool
[index].InstalledObjects));
335
_contextPool
[index].TextPenaltyModule?.Dispose();
337
_contextPool
.RemoveAt(index);
373
for (index = 0; index <
_contextPool
.Count; index++)
375
if (
_contextPool
[index].PtsHost.Context == ptsContext.Context)
377
_contextPool
[index].Owner = new WeakReference(null);
378
_contextPool
[index].InUse = false;
382
Invariant.Assert(index <
_contextPool
.Count, "PtsContext not found in the context pool.");
393
if (cleanContextPool &&
_contextPool
.Count > 4)
397
while (index <
_contextPool
.Count)
399
if (!
_contextPool
[index].InUse)
401
Invariant.Assert(
_contextPool
[index].PtsHost.Context != IntPtr.Zero, "PTS Context handle is not valid.");
402
PTS.Validate(PTS.DestroyDocContext(
_contextPool
[index].PtsHost.Context));
403
Invariant.Assert(
_contextPool
[index].InstalledObjects != IntPtr.Zero, "Installed Objects handle is not valid.");
404
PTS.Validate(PTS.DestroyInstalledObjectsInfo(
_contextPool
[index].InstalledObjects));
407
_contextPool
[index].TextPenaltyModule?.Dispose();
408
_contextPool
.RemoveAt(index);
429
ptsHost =
_contextPool
[index].PtsHost;
433
InitInstalledObjectsInfo(ptsHost, ref
_contextPool
[index].SubtrackParaInfo, ref
_contextPool
[index].SubpageParaInfo, out installedObjects, out installedObjectsCount);
434
_contextPool
[index].InstalledObjects = installedObjects;
437
InitGenericInfo(ptsHost, (IntPtr)(index + 1), installedObjects, installedObjectsCount, ref
_contextPool
[index].ContextInfo);
440
InitFloaterObjInfo(ptsHost, ref
_contextPool
[index].FloaterInit);
441
InitTableObjInfo(ptsHost, ref
_contextPool
[index].TableobjInit);
444
if (
_contextPool
[index].IsOptimalParagraphEnabled)
450
_contextPool
[index].TextPenaltyModule = penaltyModule;
451
_contextPool
[index].ContextInfo.ptsPenaltyModule = ptsPenaltyModule;
452
_contextPool
[index].TextFormatter = TextFormatter.CreateFromContext(textFormatterContext, textFormattingMode);
458
GC.SuppressFinalize(
_contextPool
[index].TextPenaltyModule);
462
PTS.Validate(PTS.CreateDocContext(ref
_contextPool
[index].ContextInfo, out context));