Most PDFiumAPIStringBufferSizeInBytesAdapter users use it in almost
identical ways, just with different PDFium APIs. It would be nice to
consolidate the repeated code. This adapter is also bit hard to use. To
address these issues, add a templated CallPDFiumWideStringBufferApi()
wrapper to avoid the repeated code, and hide the complexities of the
adapter. Then move PDFiumAPIStringBufferSizeInBytesAdapter to a nested
internal namespace, because it is now just an implementation detail.
Similarly, add CallPDFiumStringBufferApi() for use with
PDFiumAPIStringBufferAdapter<std::string>, and make
PDFiumAPIStringBufferAdapter part of the internal namespace.
For the rare use cases that cannot use either of the two helper
functions above, expose PDFiumAPIStringBufferAdapter outside of the
internal namespace.
Change-Id: I542e442c23d52f7322ec79a1a516fb8c48b28bb5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2208604
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Daniel Hosseinian <dhoss@chromium.org>
Cr-Commit-Position: refs/heads/master@{#770824}