summaryrefslogtreecommitdiff
path: root/fpdfsdk/fpdfview.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2017-05-01 13:21:39 -0700
committerChromium commit bot <commit-bot@chromium.org>2017-05-01 20:42:12 +0000
commit40baddef7fda756c29b813dc1fd67b28d745aa8c (patch)
treec718f1deb8a554bcbbb38f57d0de86a0219f0bff /fpdfsdk/fpdfview.cpp
parenta0a69233cafa0ec22fd6c776851e3ee069ca66bf (diff)
downloadpdfium-40baddef7fda756c29b813dc1fd67b28d745aa8c.tar.xz
Remove more |new|s, part 6chromium/3087
Change-Id: I4adbeafa7ecfd509abca08d97be132fd709e1261 Reviewed-on: https://pdfium-review.googlesource.com/4691 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'fpdfsdk/fpdfview.cpp')
-rw-r--r--fpdfsdk/fpdfview.cpp18
1 files changed, 8 insertions, 10 deletions
diff --git a/fpdfsdk/fpdfview.cpp b/fpdfsdk/fpdfview.cpp
index c928ebe445..72ef75ce07 100644
--- a/fpdfsdk/fpdfview.cpp
+++ b/fpdfsdk/fpdfview.cpp
@@ -140,9 +140,8 @@ void RenderPageImpl(CPDF_PageRenderContext* pContext,
class CPDF_CustomAccess final : public IFX_SeekableReadStream {
public:
- static CFX_RetainPtr<CPDF_CustomAccess> Create(FPDF_FILEACCESS* pFileAccess) {
- return CFX_RetainPtr<CPDF_CustomAccess>(new CPDF_CustomAccess(pFileAccess));
- }
+ template <typename T, typename... Args>
+ friend CFX_RetainPtr<T> pdfium::MakeRetain(Args&&... args);
// IFX_SeekableReadStream
FX_FILESIZE GetSize() override;
@@ -180,9 +179,9 @@ bool CPDF_CustomAccess::ReadBlock(void* buffer,
#ifdef PDF_ENABLE_XFA
class CFPDF_FileStream : public IFX_SeekableStream {
public:
- static CFX_RetainPtr<CFPDF_FileStream> Create(FPDF_FILEHANDLER* pFS) {
- return CFX_RetainPtr<CFPDF_FileStream>(new CFPDF_FileStream(pFS));
- }
+ template <typename T, typename... Args>
+ friend CFX_RetainPtr<T> pdfium::MakeRetain(Args&&... args);
+
~CFPDF_FileStream() override;
// IFX_SeekableStream:
@@ -328,13 +327,13 @@ CFX_DIBitmap* CFXBitmapFromFPDFBitmap(FPDF_BITMAP bitmap) {
CFX_RetainPtr<IFX_SeekableReadStream> MakeSeekableReadStream(
FPDF_FILEACCESS* pFileAccess) {
- return CPDF_CustomAccess::Create(pFileAccess);
+ return pdfium::MakeRetain<CPDF_CustomAccess>(pFileAccess);
}
#ifdef PDF_ENABLE_XFA
CFX_RetainPtr<IFX_SeekableStream> MakeSeekableStream(
FPDF_FILEHANDLER* pFilehandler) {
- return CFPDF_FileStream::Create(pFilehandler);
+ return pdfium::MakeRetain<CFPDF_FileStream>(pFilehandler);
}
#endif // PDF_ENABLE_XFA
@@ -594,8 +593,7 @@ DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_LoadMemDocument(const void* data_buf,
DLLEXPORT FPDF_DOCUMENT STDCALL
FPDF_LoadCustomDocument(FPDF_FILEACCESS* pFileAccess,
FPDF_BYTESTRING password) {
- CFX_RetainPtr<CPDF_CustomAccess> pFile =
- CPDF_CustomAccess::Create(pFileAccess);
+ auto pFile = pdfium::MakeRetain<CPDF_CustomAccess>(pFileAccess);
auto pParser = pdfium::MakeUnique<CPDF_Parser>();
pParser->SetPassword(password);