1 write to _contextPool
PresentationFramework (1)
MS\Internal\PtsHost\PtsCache.cs (1)
149
_contextPool
= new List<ContextDesc>(1);
62 references to _contextPool
PresentationFramework (62)
MS\Internal\PtsHost\PtsCache.cs (62)
186
for (index = 0; index <
_contextPool
.Count; index++)
188
if (!
_contextPool
[index].InUse &&
189
_contextPool
[index].IsOptimalParagraphEnabled == ptsContext.IsOptimalParagraphEnabled)
196
if (index ==
_contextPool
.Count)
198
_contextPool
.Add(new ContextDesc());
199
_contextPool
[index].IsOptimalParagraphEnabled = ptsContext.IsOptimalParagraphEnabled;
200
_contextPool
[index].PtsHost = new PtsHost();
201
_contextPool
[index].PtsHost.Context = CreatePTSContext(index, textFormattingMode);
206
if (
_contextPool
[index].IsOptimalParagraphEnabled)
208
ptsContext.TextFormatter =
_contextPool
[index].TextFormatter;
212
_contextPool
[index].InUse = true;
213
_contextPool
[index].Owner = new WeakReference(ptsContext);
215
return
_contextPool
[index].PtsHost;
253
for (index = 0; index <
_contextPool
.Count; index++)
255
if (
_contextPool
[index].PtsHost == ptsHost)
260
Invariant.Assert(index <
_contextPool
.Count, "Cannot find matching PtsHost in the Context pool.");
261
PTS.Validate(PTS.GetFloaterHandlerInfo(ref
_contextPool
[index].FloaterInit, pobjectinfo));
272
for (index = 0; index <
_contextPool
.Count; index++)
274
if (
_contextPool
[index].PtsHost == ptsHost)
279
Invariant.Assert(index <
_contextPool
.Count, "Cannot find matching PtsHost in the context pool.");
280
PTS.Validate(PTS.GetTableObjHandlerInfo(ref
_contextPool
[index].TableobjInit, pobjectinfo));
313
while (index <
_contextPool
.Count)
315
PtsContext ptsContext =
_contextPool
[index].Owner.Target as PtsContext;
318
Invariant.Assert(
_contextPool
[index].PtsHost.Context == ptsContext.Context, "PTS Context mismatch.");
319
_contextPool
[index].Owner = new WeakReference(null);
320
_contextPool
[index].InUse = false;
326
if (!
_contextPool
[index].InUse)
331
Invariant.Assert(
_contextPool
[index].PtsHost.Context != IntPtr.Zero, "PTS Context handle is not valid.");
332
PTS.IgnoreError(PTS.DestroyDocContext(
_contextPool
[index].PtsHost.Context));
333
Invariant.Assert(
_contextPool
[index].InstalledObjects != IntPtr.Zero, "Installed Objects handle is not valid.");
334
PTS.IgnoreError(PTS.DestroyInstalledObjectsInfo(
_contextPool
[index].InstalledObjects));
337
if (
_contextPool
[index].TextPenaltyModule != null)
339
_contextPool
[index].TextPenaltyModule.Dispose();
342
_contextPool
.RemoveAt(index);
378
for (index = 0; index <
_contextPool
.Count; index++)
380
if (
_contextPool
[index].PtsHost.Context == ptsContext.Context)
382
_contextPool
[index].Owner = new WeakReference(null);
383
_contextPool
[index].InUse = false;
387
Invariant.Assert(index <
_contextPool
.Count, "PtsContext not found in the context pool.");
398
if (cleanContextPool &&
_contextPool
.Count > 4)
402
while (index <
_contextPool
.Count)
404
if (!
_contextPool
[index].InUse)
406
Invariant.Assert(
_contextPool
[index].PtsHost.Context != IntPtr.Zero, "PTS Context handle is not valid.");
407
PTS.Validate(PTS.DestroyDocContext(
_contextPool
[index].PtsHost.Context));
408
Invariant.Assert(
_contextPool
[index].InstalledObjects != IntPtr.Zero, "Installed Objects handle is not valid.");
409
PTS.Validate(PTS.DestroyInstalledObjectsInfo(
_contextPool
[index].InstalledObjects));
412
if (
_contextPool
[index].TextPenaltyModule != null)
414
_contextPool
[index].TextPenaltyModule.Dispose();
416
_contextPool
.RemoveAt(index);
437
ptsHost =
_contextPool
[index].PtsHost;
441
InitInstalledObjectsInfo(ptsHost, ref
_contextPool
[index].SubtrackParaInfo, ref
_contextPool
[index].SubpageParaInfo, out installedObjects, out installedObjectsCount);
442
_contextPool
[index].InstalledObjects = installedObjects;
445
InitGenericInfo(ptsHost, (IntPtr)(index + 1), installedObjects, installedObjectsCount, ref
_contextPool
[index].ContextInfo);
448
InitFloaterObjInfo(ptsHost, ref
_contextPool
[index].FloaterInit);
449
InitTableObjInfo(ptsHost, ref
_contextPool
[index].TableobjInit);
452
if (
_contextPool
[index].IsOptimalParagraphEnabled)
458
_contextPool
[index].TextPenaltyModule = penaltyModule;
459
_contextPool
[index].ContextInfo.ptsPenaltyModule = ptsPenaltyModule;
460
_contextPool
[index].TextFormatter = TextFormatter.CreateFromContext(textFormatterContext, textFormattingMode);
466
GC.SuppressFinalize(
_contextPool
[index].TextPenaltyModule);
470
PTS.Validate(PTS.CreateDocContext(ref
_contextPool
[index].ContextInfo, out context));