summaryrefslogtreecommitdiff
path: root/core/fpdfapi/fpdf_page
AgeCommit message (Collapse)Author
2016-10-04Move core/fpdfapi/fpdf_page to core/fpdfapi/pagedsinclair
BUG=pdfium:603 Review-Url: https://codereview.chromium.org/2386423004
2016-10-04Move core/fpdfapi/fpdf_font to core/fpdfapi/fontdsinclair
BUG=pdfium:603 Review-Url: https://codereview.chromium.org/2392773003
2016-10-04Move core/fpdfapi/fpdf_edit to core/fpdfapi/editdsinclair
BUG=pdfium:603 Review-Url: https://codereview.chromium.org/2386263003
2016-10-03Add ptr_util.h from base until std::make_unique<> availabletsepez
Review-Url: https://codereview.chromium.org/2386273004
2016-10-03Detect resursive loading of type3 font char to avoid infinite loopweili
The original way of detecting loops was passing a level parameter through various functions. This missed some cases which also lead to load type3 font char, for example, FindFont() may call CheckType3FontMetrics() which may eventually lead to LoadChar(). The new way is to store the char loading depth, and abort when the depth exceeds the max. BUG=chromium:651304 Review-Url: https://codereview.chromium.org/2384853002
2016-09-29Move core/fxge/include to core/fxgedsinclair
BUG=pdfium:611 Review-Url: https://codereview.chromium.org/2377393002
2016-09-29Move core/fxcrt/include to core/fxcrtdsinclair
BUG=pdfium:611 Review-Url: https://codereview.chromium.org/2382723003
2016-09-29Move core/fxcodec/codec/include and core/fxcodec/include files updsinclair
BUG=pdfium:611 Review-Url: https://codereview.chromium.org/2381063002
2016-09-29Move core/fpdfapi/include to core/fpdfapidsinclair
BUG=pdfium:611 Review-Url: https://codereview.chromium.org/2376153004
2016-09-29Move core/fpdfapi/fpdf_parser/include to core/fpdfapi/fpdf_parserdsinclair
BUG=pdfium:611 Review-Url: https://codereview.chromium.org/2383543002
2016-09-29Move core/fpdfapi/fpdf_page/include to core/fpdfapi/fpdf_pagedsinclair
BUG=pdfium:611 Review-Url: https://codereview.chromium.org/2379033002
2016-09-29Move core/fpdfapi/fpdf_font/include to core/fpdfapi/fpdf_fontdsinclair
BUG=pdfium:611 Review-Url: https://codereview.chromium.org/2375283003
2016-09-29Move core/fpdfapi/fpdf_edit/include to core/fpdfapi/fpdf_editdsinclair
BUG=pdfium:611 Review-Url: https://codereview.chromium.org/2381863003
2016-09-29Move core/fdrm/crypto/include to core/fdrm/cryptodsinclair
BUG=pdfium:611 Review-Url: https://codereview.chromium.org/2374413002
2016-09-28Use string pools in some dictionaries, names, and strings.tsepez
BUG=pdfium:597 Review-Url: https://codereview.chromium.org/2345063002
2016-09-28Revert "Rename CPDF_CountedObject to CFX_WeakPtr::Handle"tsepez
This reverts commit fe0179ded8202939ea4f2b92a879b8dede7821ea. This is blocking incremental revision, will try again. Review-Url: https://codereview.chromium.org/2377033003
2016-09-27Remove unused cpdf_generalstatedata.htsepez
File was left behind when CPDF_GeneralStateData became CPDF_GeneralState::StateData internal class. Review-Url: https://codereview.chromium.org/2377843002
2016-09-23Make CPDF_Font::Create() return a std::unique_ptr.tsepez
Review-Url: https://codereview.chromium.org/2364643003
2016-09-22Make CPDF_ColorSpace::Load() return a unique_ptrtsepez
Specialize default_delete to avoid having to say ReleaseDeleter<CPDF_ColorSpace> throughout the code. Review-Url: https://codereview.chromium.org/2368433003
2016-09-22Rename CPDF_CountedObject to CFX_WeakPtr::Handlechromium/2869tsepez
This better describes its purpose, and reduces confusion with the CFX_CountRef class, which is unrelated. The WeakPtr class itself that manipulates handles is NYI. Review-Url: https://codereview.chromium.org/2366673003
2016-09-22Null CPDF_CountedObj::m_pObj prior to deletiontsepez
This gives additional protection in case of re-entry. Also make CFX_CountRef more robust in face of errors. BUG=649229 Review-Url: https://codereview.chromium.org/2364673002
2016-09-21Remove some objnum locals with AddIndirectObjecttsepez
Also, it's idempotent, so simplify some logic in callers to not care if objnum is zero. The alternate forms are rarely used, using the objnum form makes it clear that SetReferenceFor() can't possibly register the object as a side-effect. Review-Url: https://codereview.chromium.org/2361713002
2016-09-21Make ownership explicit in CPDF_ContentMarkItem.tsepez
The old SetParam() method had "maybe take ownership" semanitcs based upon the type argument. Make GetParam() handle the None case and simplify callers based upon that behaviour. Review-Url: https://codereview.chromium.org/2358043003
2016-09-20Fix memory leaking on ClosePage.art-snake
BUG=79367, 48791 The fonts was not cleared after unloading pages. Test pdf: http://www.nasa.gov/pdf/750614main_NASA_FY_2014_Budget_Estimates-508.pdf For this file, we have ~5 fonts per page, which equal ~1 Mb per page. In this PDF we have 670 pages, as result after slow scrolling(reading) full document we have ~600 Mb fonts data in memory. Memory usage of PDF Plugin: before this CL: ~660 Mb after this CL: ~100 Mb This is last part of reverted CL: Original CL: https://codereview.chromium.org/2158023002 Revert reason: BUG=647612 Fix bug CL: https://codereview.chromium.org/2350193003 Previous CL: https://codereview.chromium.org/2350243002 Review-Url: https://codereview.chromium.org/2351193002
2016-09-20Fix stack exhaustion in CPDF_PSProc::Parse()tsepez
BUG=648059 Review-Url: https://codereview.chromium.org/2350013003
2016-09-19Clean up CPDF_Stream.tsepez
Replace the CPDF_Stream(nullptr, 0, nullptr) pattern with a default ctor. Remove unused parameters from CPDF_Stream::SetData(). Both are always passed as FALSE. CPDF_Stream declared its own m_GenNum, which shadowed the one in CPDF_Object. It was used only to distinguish file/memory streams, so add a bool explicitly for this purpose. Remove the union, it would be sad if we confused user data with a C++ object with virtual function calls. Use unique_ptrs with appropriate deleters to manage memory. Review-Url: https://codereview.chromium.org/2347993002
2016-09-19Revert of Pdfium: Fix fonts leaking on ClosePage. (patchset #10 id:180001 of ↵dsinclair
https://codereview.chromium.org/2158023002/ ) Reason for revert: Causes heap-use-after-free. See crbug.com/647612. Original issue's description: > Fix memory leaking on ClosePage. > CFX_FontCache refactoring: > after this CL: Only one global CFX_FontCache used. Any cached items from it, are released, when its are not used. > > BUG=79367,48791 > > The fonts was not cleared after unloading pages. > > Test pdf: > > http://www.nasa.gov/pdf/750614main_NASA_FY_2014_Budget_Estimates-508.pdf > > For this file, we have ~5 fonts per page, which equal ~1 Mb per page. > In this PDF we have 670 pages, as result after slow scrolling(reading) full document we have ~600 Mb fonts data in memory. > > memory usage of PDF Plugin: > before this CL: ~660 Mb > after this CL: ~100 Mb > > Committed: https://pdfium.googlesource.com/pdfium/+/cde5101eb15b24519e89fa500fe37038bc8e2201 TBR=tsepez@chromium.org,brucedawson@chromium.org,npm@chromium.org,art-snake@yandex-team.ru # Not skipping CQ checks because original CL landed more than 1 days ago. BUG=79367,48791 Review-Url: https://codereview.chromium.org/2350763002
2016-09-15Fix memory leaking on ClosePage.chromium/2862art-snake
CFX_FontCache refactoring: after this CL: Only one global CFX_FontCache used. Any cached items from it, are released, when its are not used. BUG=79367,48791 The fonts was not cleared after unloading pages. Test pdf: http://www.nasa.gov/pdf/750614main_NASA_FY_2014_Budget_Estimates-508.pdf For this file, we have ~5 fonts per page, which equal ~1 Mb per page. In this PDF we have 670 pages, as result after slow scrolling(reading) full document we have ~600 Mb fonts data in memory. memory usage of PDF Plugin: before this CL: ~660 Mb after this CL: ~100 Mb Review-Url: https://codereview.chromium.org/2158023002
2016-09-15Rename dictionary set and get methodsdsinclair
This Cl makes the Get and Set methods consistenly use {G|S}et<Type>For. BUG=pdfium:596 Review-Url: https://codereview.chromium.org/2334323005
2016-09-13Sort include entries.dsinclair
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
2016-09-06Make CPDF_TextStateData private to CPDF_TextState.chromium/2853tsepez
Review-Url: https://codereview.chromium.org/2313083002
2016-09-06Move CPDF_GraphState to CFX_GraphStatetsepez
The FX layer is spying on its private data, so make the job of ref-counting it live in FX as well, instead of up a layer at pdfapi. Pre-cursor to making this private and passing the graph state itself everywhere. Review-Url: https://codereview.chromium.org/2314223002
2016-09-06Make CPDF_ContentMarkData private to CPDF_ContentMarktsepez
Review-Url: https://codereview.chromium.org/2312743005
2016-09-06Make ColorStateData private to CPDF_ColorStatetsepez
Review-Url: https://codereview.chromium.org/2311313002
2016-09-03Use safe bool conversion operators in fpdf_page/chromium/2852chromium/2851chromium/2850tsepez
Review-Url: https://codereview.chromium.org/2310693002
2016-09-02Make CPDF_ClipPath have a CPDF_ClipPathData rather than inheriting.tsepez
Make Data private to the ClipPath class which manages it transparently for its callers. This prevents the callers from having to remember to make a copy before dirtying the shared data, since the operations that modify state will do this under the covers for us. Review-Url: https://codereview.chromium.org/2301263003
2016-09-02Remove CFX_Matrix::Copy() in favor of assignmenttsepez
The default assignment operator will suffice and allows us to write matrix1 = matrix2; Review-Url: https://codereview.chromium.org/2307953003
2016-09-02Make CPDF_GeneralStateData private.tsepez
All interaction goes through the CPDF_GeneralState, which manages the underlying storage transparently to the callers. Make StateData use a real string and a real matrix rather than C-style arrays. Review-Url: https://codereview.chromium.org/2302683002
2016-09-02Make CPDF_Path have a CFX_Path rather than inheritingtsepez
Review-Url: https://codereview.chromium.org/2305103002
2016-09-02Make CPDF_GeneralState have a CPDF_GeneralStateDatachromium/2848tsepez
Remove a const cast along the way and propagate to callers. Review-Url: https://codereview.chromium.org/2303553002
2016-09-01Make CPDF_ContentMark have a CPDF_ContentMarkData.tsepez
This one doesn't require an explict Emplace(), as the object seems to get constructed only as a side-effect of making a private copy. Review-Url: https://codereview.chromium.org/2298953002
2016-08-31Make CPDF_ColorState have a CFX_ColorStateData rather than inheritingtsepez
Review-Url: https://codereview.chromium.org/2294133002
2016-08-31Make CPDF_GraphState have a CPDF_GraphStateData instead of inheriting.tsepez
Get callers out of the copy-before-write business, and let the class manage it instead. Review-Url: https://codereview.chromium.org/2292363002
2016-08-30Make CPDF_TextState have a CPDF_TextStateData rather than inheriting one.tsepez
Review-Url: https://codereview.chromium.org/2287313004
2016-08-30More better const-ness in CFX_CountRef<>tsepez
There are a couple of places where code is calling GetObject() that should be calling GetPrivateCopy(), but works because the value may not be shared at the time. This just makes it safer. Review-Url: https://codereview.chromium.org/2290863002
2016-08-29Revert "Add -> operators to CFX_CountRef."tsepez
This reverts commit c10c23a2b1999b1cb0354fd4db9837dc63a3d833. TBR=dsinclair@chromium.org Review-Url: https://codereview.chromium.org/2285283003
2016-08-29Revert "Replace wrapper methods in CPDF_Path with -> operator."tsepez
This reverts commit d09a09751f724ecdb1a0bc307447a3d0c212ebff. TBR=dsinclair@chromium.org Review-Url: https://codereview.chromium.org/2291833002
2016-08-29Revert "Use ->() in CPDF_ColorState"tsepez
This reverts commit 91ddd3f7501429222f648b986a99f3959a398889. Reason for revert: may introduce sublte bugs, more thought required. TBR=dsinclair@chromium.org Review-Url: https://codereview.chromium.org/2294553002
2016-08-29Use ->() in CPDF_ColorStatetsepez
Move methods to CPDF_ColorStateData. Move MakePrivateCopy() methods to call sites. Remove now-empty cpdf_colorstate.cpp file. Review-Url: https://codereview.chromium.org/2291763002
2016-08-29Replace wrapper methods in CPDF_Path with -> operator.tsepez
These just invoked exaclty the same methodes in the underlying xxxData class, which we can now do with just a ->() Move some methods to the xxxData class, where they belong. In doing so, put MakePrivateCopy() calls at each callsite for those methods that made a copy. Review-Url: https://codereview.chromium.org/2286983002