Age | Commit message (Collapse) | Author |
|
Doing so reveals places where there are needless copies
and conversions.
Change-Id: I24a868d40aa63836f4167eaf4541964049df7916
Reviewed-on: https://pdfium-review.googlesource.com/2555
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
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>
|
|
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
|
|
This Cl replaces the custom IFX_MemoryAllocator code with new/delete as needed.
Change-Id: Ie786f607c9e0b3035ffd87733bc3e29a4b6426d9
Reviewed-on: https://pdfium-review.googlesource.com/2164
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
|
|
Code is much clearer when we use the actual types
rather than this convention.
Review-Url: https://codereview.chromium.org/2618993002
|
|
Review-Url: https://codereview.chromium.org/2610813010
|
|
Review-Url: https://codereview.chromium.org/2616623005
|
|
We worry about cyclical references, but no leaks found.
Review-Url: https://codereview.chromium.org/2609423003
|
|
Minimalist changes with the tidying of the code to
use better loop iterators as a follow-up.
Review-Url: https://codereview.chromium.org/2556963004
|
|
Also convernt one nearby array to vector as well.
Review-Url: https://codereview.chromium.org/2559903002
|
|
Review-Url: https://codereview.chromium.org/2562563002
|
|
IFGAS_Streams are not part of the IFX_Stream hierarchy, but
can be made from such.
Review-Url: https://codereview.chromium.org/2559763002
|
|
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
|
|
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
|
|
Group related IFX_ classes.
Move #defines to .cpp file that uses them.
Replace loose function with static method.
Review-Url: https://codereview.chromium.org/2548583004
|
|
Also remove a bool that is always false.
Review-Url: https://codereview.chromium.org/2539203002
|
|
Removed some unused method, named files properly, cleaned up a bit.
Review-Url: https://codereview.chromium.org/2524493002
|
|
The -build/include setting was masking out build/include_what_you_use. This CL
restores them, fixes any build errors, and adds NOLINT as needed. As well,
the runtime/explicit and runtime/printf flags are aslo enabled and NOLINT'd.
lint cleanups
Change-Id: Ib013b3eb29c8d0e48cad74c5df9028684130719f
Reviewed-on: https://pdfium-review.googlesource.com/2030
Reviewed-by: Tom Sepez <tsepez@chromium.org>
|
|
Review-Url: https://codereview.chromium.org/2512213002
|
|
IFGAS_FontMgr is an interface only for a class only defined on Windows,
plus a class only defined for non-Windows. I'm removing the interface,
renaming the class to have the same name in both cases, and cleaning up
a bit of unused methods.
Review-Url: https://codereview.chromium.org/2494883002
|
|
Review-Url: https://codereview.chromium.org/2467203003
|
|
It's been troubling for some time that an IFX_FileStream might
actually be an in-memory buffer with no backing file.
Review-Url: https://codereview.chromium.org/2443723002
|
|
- Nit fixes.
- Remove unused methods.
- Replace FX_BOOL with bool.
Review-Url: https://codereview.chromium.org/2419433004
|
|
BUG=pdfium:611
Review-Url: https://codereview.chromium.org/2383593002
|
|
BUG=pdfium:611
Review-Url: https://codereview.chromium.org/2377393002
|
|
BUG=pdfium:611
Review-Url: https://codereview.chromium.org/2382723003
|
|
Review-Url: https://codereview.chromium.org/2362063003
|
|
In all cases, bool can be used instead without problems.
Review-Url: https://codereview.chromium.org/2368693002
|
|
This CL updates all of the includes to be correctly sorted. A PRESUBMIT warning
is added (from chromium) that will warn if the includes are in the wrong order on upload.
Review-Url: https://codereview.chromium.org/2337293002
|
|
Reland of Fix leaked internal font (patchset #2 id:60001 of
https://codereview.chromium.org/2297303004/ )
In CFGAS_FontMgrImp::LoadFont(), a new internal font is created which
is never released. It needs to be correctly marked as internal font to
be released. Fix this by adding a new method to take the ownership
of the font and mark it as internal font properly.
The previous revert was caused by memory management errors
which were fixed at https://codereview.chromium.org/2322043002/
BUG=pdfium:242
Review-Url: https://codereview.chromium.org/2320213002
|
|
A few issues are fixed:
--Change variable |m_bLogic| in CFX_Font to |m_bShallowCopy| to
reflect its meaning better;
--For a shallow copy of font, we must guarantee that the copied font
will not be deleted until the shallow copy is deleted. So need to
increase the src font's refcount when copying it;
--The stream |m_pOwnedStream| needs to have matched new/delete
These errors need to be fixed before we can properly delete all the
fonts to address the leaks.
BUG=pdfium:242
Review-Url: https://codereview.chromium.org/2322043002
|
|
Two leak cases are addressed here:
--In CFGAS_FontMgrImp::LoadFont(), calling LoadFace() is unnecessary
since the following LoadFile() does the exact same thing. Calling
LoadFace() without releasing the loaded face results in a leak;
--|m_Hash2Fonts| in class CFGAS_FontMgrImp owns all the fonts stored
in it. The fonts need to be deleted along with the container.
BUG=pdfium:242
Review-Url: https://codereview.chromium.org/2322483003
|
|
https://codereview.chromium.org/2297303004/ )
Reason for revert:
asan bot doesn't like it, will investigate
Original issue's description:
> Fix leaked internal font
>
> In CFGAS_FontMgrImp::LoadFont(), a new internal font is created which
> is never released. It needs to be correctly marked as internal font to
> be released. Fix this by adding a boolean parameter and pass it along
> during the creation of the font.
>
> BUG=pdfium:242
>
> Committed: https://pdfium.googlesource.com/pdfium/+/6708106e6a3d54f3370c871ebf6643d1ecf58999
TBR=thestig@chromium.org,dsinclair@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=pdfium:242
Review-Url: https://codereview.chromium.org/2302213002
|
|
In CFGAS_FontMgrImp::LoadFont(), a new internal font is created which
is never released. It needs to be correctly marked as internal font to
be released. Fix this by adding a boolean parameter and pass it along
during the creation of the font.
BUG=pdfium:242
Review-Url: https://codereview.chromium.org/2297303004
|
|
Review-Url: https://codereview.chromium.org/2292503002
|
|
The GEFont points to the font manager which creates it and tries to unregister
itself. Currently the GEFont can be created by the default mapper and then
stored in a different mapper. If the default mapper is destroyed first, when
the second mapper cleans up the font there will be a call to unregister on
the default mapper causing a use-after-free.
The long term fix is to fixup the GEFont so it points to the correct mapper
to unregister from. This CL forces the destruction order in CXFA_FFApp to
cleanup the non-default mapper first.
BUG=chromium:637546
Review-Url: https://codereview.chromium.org/2259823004
|
|
Review-Url: https://codereview.chromium.org/2260533002
|
|
Use smart pointers instead of raw pointer to make memory management
easier for classes mainly under xfa/fxfa.
Also change the return type of IFGAS_FontMgr::Create() to smart
pointer type.
BUG=pdfium:518
Review-Url: https://codereview.chromium.org/2227883002
|
|
files.
This is the third CL to separate fx_ge into classes, one per file.
All fx_ge.h includes had to be replaced with new includes
The method definitions for CFX_FxgeDevice were not moved to a single file.
These methods are defined in two folders different from fxge/ge, so they were left untouched for now.
Review-Url: https://codereview.chromium.org/2223213002
|
|
This is the first CL in an attempt to split up the classes in fxge/include/fx_ge.h into their own files.
Review-Url: https://codereview.chromium.org/2217663002
|
|
For classes under xfa/fgas, xfa/fwl/basewidget, and xfa/fwl/core,
use smart pointers instead of raw pointer to make memory management
easier.
BUG=pdfium:518
Review-Url: https://codereview.chromium.org/2207093005
|
|
Move CFX_FolderFontInfo, CFX_FontMgr, and CFX_FontMapper into their own
classes. There are namespaces in each of the new files, having methods
from the original namespace in fx_ge_fontmap, according to what each
class needs.
Review-Url: https://codereview.chromium.org/2185533006
|
|
For the class owned member variables, use std::unique_ptr or
std::vector for memory management.
BUG=pdfium:518
Review-Url: https://codereview.chromium.org/2169793002
|
|
This CL removes unused methods and default parameters from the fgas/crt code.
Review-Url: https://codereview.chromium.org/2162503003
|
|
This CL converts all NULL's to nullptr. All instances of comparison to nullptr
have been removed.
Review-Url: https://codereview.chromium.org/2095653002
|
|
Fix nits along the way.
Review-Url: https://codereview.chromium.org/2083943003
|
|
These changes are specific to Mac and Skia builds. They are
needed for these builds to compile with clang_use_chrome_plugin.
BUG=pdfium:469
Review-Url: https://codereview.chromium.org/2081523002
|
|
This change mainly contains files in xfa/ and fxjse/ directories
which were not covered by previous changes.
This is part of the efforts to make PDFium code compilable
by Clang chromium style plugins. After this change, PDFium can be
compiled with "clang_use_chrome_plugin=true" for GN build. Since
clang_use_chrome_plugin is true by default, we no longer need to
set this parameter explicitly.
The changes are mainly the following:
-- move inline constructor/destructor of complex class/struct out-of-line;
-- add constructor/destructor of complex class/struct if not
explicitly defined;
-- add explicit out-of-line copy constructor when needed;
-- move inline virtual functions out-of-line;
-- Properly mark virtual functions with 'override';
-- some minor cleanups;
BUG=pdfium:469
Review-Url: https://codereview.chromium.org/2072803002
|
|
Remove a few other unused casts, simplify.
Review-Url: https://codereview.chromium.org/2052593003
|
|
And also CFGAS_StdFontMgrImp.
Review-Url: https://codereview.chromium.org/2033673002
|