summaryrefslogtreecommitdiff
path: root/xfa/fgas/font/cfgas_gefont.cpp
AgeCommit message (Collapse)Author
2017-05-20Use observed ptrs from CFGAS_GEFont back to its font mgrs.chromium/3106Tom Sepez
CFGAS_GEFonts are ref counted, and its a good thing since they are managed by at least three different font managers: CFGAS_FontMgr, CXFA_PDFFontMgr, and CXFA_FontMgr. None of these have a clear claim to ownership of the CFGAS_GEFont. CFGAS_GEFont has back-pointers to two of these, CFGAS_FontMgr, and CXFA_PDFFontMgr, and they could each outlive the other. Thus the font needs to watch for destruction of either of its managers, so as to stop using it after its gone. Bug: 724640 Change-Id: I907ec35e300e11e532e13545d51fb200ac86b4f9 Reviewed-on: https://pdfium-review.googlesource.com/5735 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2017-05-01Remove more |new|s, part 5Tom Sepez
Many of these are already unique_ptrs. Change-Id: I3695d4ff5a8f7483ad994ac7657897fd55069cd5 Reviewed-on: https://pdfium-review.googlesource.com/4690 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-04-19Move CFGAS_Stream to CFX_SeekableStreamProxyDan Sinclair
This CL moves the FGAS stream code into core/fxcrt and renames to CFX_SeekableStreamProxy. Change-Id: I6641fe0cca45a128ef3ec281b0b40f8d60296387 Reviewed-on: https://pdfium-review.googlesource.com/4311 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
2017-04-12Remove MakeSeekableReadStreamDan Sinclair
This Cl removes the MakeSeekableReadStream call and, at the one place it's used, creates an IFX_MemoryStream which is a seekable read stream. Change-Id: I6b0b23636eff47f8caca5432313ba99703e21e4d Reviewed-on: https://pdfium-review.googlesource.com/4037 Reviewed-by: Nicolás Peña <npm@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-03-23Cleanup some xfa/fxfa code.Dan Sinclair
This CL moves the .h files to have names corresponding to the contained classes. The .cpp files are moved alongside the .h files. Any extra classes in the .h files have been split into their own files. Change-Id: I14b4efc02417f0df946500e87b6c502e77020db8 Reviewed-on: https://pdfium-review.googlesource.com/3160 Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-03-14Replace FX_CHAR and FX_WCHAR with underlying types.Dan Sinclair
Change-Id: I96e0a20d66b9184d22f64d8e4ce0dadd5a78c1e8 Reviewed-on: https://pdfium-review.googlesource.com/2967 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-03-13Replace discrete array with a map.dan sinclair
There is one use of the discrete array, GFGAS_GEFont. This CL replaces that usage with a std::map and removes the fgas_util classes. Change-Id: Ic45812168e9487ebac08abaa131c58080a949d69 Reviewed-on: https://pdfium-review.googlesource.com/2953 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-03-02Remove CFX_MassArrayTemplate<CFX_Rect> backing array.Tom Sepez
The map is one-to-one, so no need for a pointer to an externally stored rect. Change-Id: I4cd6f728cdadeb4c7b25b6f34f5d50bb5db89623 Reviewed-on: https://pdfium-review.googlesource.com/2896 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-02-08Update to use CFX_Rect{F} and CFX_Matrix constructors.Dan Sinclair
This Cl updates the code to use the constructors instead of creating an empty object and calling Set(). It also removes the various memsets of the CFX_Rect{F} classes. Change-Id: I6e20cec00866a38372858dcba5a30d31103172e4 Reviewed-on: https://pdfium-review.googlesource.com/2550 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-01-17Avoid endless loop deleting CFGAS_GEFont.tsepez
It's a ref-counted class, so if we're in the destructor, the ref count has hit zero. We can't make a new ref pointer to itself here, as it will re-invoke the destructor when it goes out of scope. This should have been an obvious anti-pattern in hindsight. The object in question can't be in the m_pFontManager, since the font manager retains a reference, and we wouldn't get to this destructor while that is present. So the cleanup isn't required. Fixing this revealed a free-delete mismatch in cxfa_textlayout.cpp. I also converted to use unique_ptrs in a few places near this issue. Fixing this revealed a UAF in CFGAS_GEFont, memcpy'ing a RetainPtr is not a good idea as it doesn't bump the ref count. Also protect and friend the CFGAS_GEFont destructor, to make sure random deletes don't happen. Also kill off a const cast, and remove unnecessary conversion to retain_ptr when we already have one. TEST=look for absence of -11 in XFA corpus test logs, bots not currently noticing the segv. Argh. Review-Url: https://codereview.chromium.org/2631703003
2017-01-06Remove CFX_MapPtrToPtr in xfa/fgas, part 2tsepez
Review-Url: https://codereview.chromium.org/2616623005
2017-01-05Properly ref-count CFGAS_GEFont with CFX_RetainPtr.tsepez
We worry about cyclical references, but no leaks found. Review-Url: https://codereview.chromium.org/2609423003
2016-12-07Refcount IFGAS_ streams all the time, tootsepez
IFGAS_Streams are not part of the IFX_Stream hierarchy, but can be made from such. Review-Url: https://codereview.chromium.org/2559763002
2016-12-07Refcount all the IFX_ stream classes all the time.tsepez
We can remove a lot of "bOwnsStream" logic in the process. Always pass these by const reference, in case the called method wants to hang on to the stream (one exception is where we stick a raw pointer into a void* slot in a context from another layer). Review-Url: https://codereview.chromium.org/2451493002
2016-12-02Rename IFX_Stream to IFGAS_Stream.tsepez
It's a separate hierarchy unrelated to the IFX_*Stream classes. Also rename CFX_Stream to CFGAS_Stream, and so forth. Review-Url: https://codereview.chromium.org/2535723010
2016-11-30Convert loose FX_Create* functions into static methodstsepez
Also remove a bool that is always false. Review-Url: https://codereview.chromium.org/2539203002
2016-11-21Clean up CFGAS_GEFontnpm
Removed some unused method, named files properly, cleaned up a bit. Review-Url: https://codereview.chromium.org/2524493002