SkPDF: Hold page objects, not SkPDFDevices.

Page Contents:
    serialize early, at endPage()

SkPDFDocument:
   Rather than holding all SkPDFDevices until onClose(), store
   fGlyphUseage and array of pages objects.

perform_font_subsetting function removed:
   First half moved to onEndPage.
   Second half moved to onClose.

create_pdf_page function removed:
   Merged into onEndPage.

generate_page_tree:
   Refactored to use SkTArray<sk_sp<T>> over SkTDArray<T*>.
   (the former is explicit about ownership, the latter is unclear.)

   No longer populates a structure of objects to be dumped,
   unnecessary since dump is always called after serialization.
   Takes ownership of fPages and returns root of tree-ified version.
   Less reference churn.

SkPDFGlyphSetMap:
    use new-style iterator.

BUG=skia:5087
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1823683005

Review URL: https://codereview.chromium.org/1823683005
4 files changed