summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-05-22 22:06:49 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-05-22 22:06:49 +0000
commit86688dea3b0d30741a95fd15b5f9ee57b2ae86f1 (patch)
treea858f201cdc8d0823496dcfcf15d22bff1c402a8
parent96c9517296c94cfa643d6197c8227879d88876d9 (diff)
downloadpdfium-86688dea3b0d30741a95fd15b5f9ee57b2ae86f1.tar.xz
Make friend RetainPtr<T> statements consistently public.
Also make destructors private for RetainPtr sub-classes, and add missing destructors. Change-Id: I451bf0aae2dae943b1f450d0aa4ca5124dc578fd Reviewed-on: https://pdfium-review.googlesource.com/32853 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
-rw-r--r--core/fpdfapi/parser/cpdf_read_validator.h6
-rw-r--r--core/fpdfapi/render/cpdf_dibsource.h7
-rw-r--r--core/fpdfapi/render/cpdf_dibtransferfunc.h3
-rw-r--r--core/fpdfdoc/cpdf_occontext.h4
-rw-r--r--core/fxcrt/cfx_seekablestreamproxy.h1
-rw-r--r--core/fxcrt/css/cfx_csscomputedstyle.h6
-rw-r--r--core/fxge/dib/cfx_dibitmap.h3
-rw-r--r--core/fxge/dib/cfx_filtereddib.h3
-rw-r--r--core/fxge/win32/cfx_windowsdib.h3
-rw-r--r--fpdfsdk/cpdfsdk_customaccess.cpp2
-rw-r--r--fpdfsdk/cpdfsdk_customaccess.h1
-rw-r--r--fpdfsdk/cpdfsdk_filewriteadapter.h1
-rw-r--r--fpdfsdk/cpdfsdk_helpers.cpp3
-rw-r--r--fpdfsdk/cpdfsdk_memoryaccess.h4
-rw-r--r--fpdfsdk/fpdf_dataavail.cpp5
-rw-r--r--testing/fx_string_testhelpers.cpp13
-rw-r--r--testing/fx_string_testhelpers.h10
-rw-r--r--xfa/fgas/font/cfgas_gefont.h2
18 files changed, 43 insertions, 34 deletions
diff --git a/core/fpdfapi/parser/cpdf_read_validator.h b/core/fpdfapi/parser/cpdf_read_validator.h
index 31c33fa36a..281a2ea194 100644
--- a/core/fpdfapi/parser/cpdf_read_validator.h
+++ b/core/fpdfapi/parser/cpdf_read_validator.h
@@ -10,9 +10,6 @@
class CPDF_ReadValidator : public IFX_SeekableReadStream {
public:
- template <typename T, typename... Args>
- friend RetainPtr<T> pdfium::MakeRetain(Args&&... args);
-
class Session {
public:
explicit Session(CPDF_ReadValidator* validator);
@@ -28,6 +25,9 @@ class CPDF_ReadValidator : public IFX_SeekableReadStream {
hints_ = hints;
}
+ template <typename T, typename... Args>
+ friend RetainPtr<T> pdfium::MakeRetain(Args&&... args);
+
bool read_error() const { return read_error_; }
bool has_unavailable_data() const { return has_unavailable_data_; }
diff --git a/core/fpdfapi/render/cpdf_dibsource.h b/core/fpdfapi/render/cpdf_dibsource.h
index 4646bf2fe9..50d9c6ef9c 100644
--- a/core/fpdfapi/render/cpdf_dibsource.h
+++ b/core/fpdfapi/render/cpdf_dibsource.h
@@ -41,12 +41,10 @@ struct DIB_COMP_DATA {
class CPDF_DIBSource : public CFX_DIBSource {
public:
- template <typename T, typename... Args>
- friend RetainPtr<T> pdfium::MakeRetain(Args&&... args);
-
enum class LoadState : uint8_t { kFail, kSuccess, kContinue };
- ~CPDF_DIBSource() override;
+ template <typename T, typename... Args>
+ friend RetainPtr<T> pdfium::MakeRetain(Args&&... args);
bool Load(CPDF_Document* pDoc, const CPDF_Stream* pStream);
@@ -80,6 +78,7 @@ class CPDF_DIBSource : public CFX_DIBSource {
private:
CPDF_DIBSource();
+ ~CPDF_DIBSource() override;
LoadState StartLoadMask();
LoadState StartLoadMaskDIB();
diff --git a/core/fpdfapi/render/cpdf_dibtransferfunc.h b/core/fpdfapi/render/cpdf_dibtransferfunc.h
index 34f5bb1abe..61abd2e23c 100644
--- a/core/fpdfapi/render/cpdf_dibtransferfunc.h
+++ b/core/fpdfapi/render/cpdf_dibtransferfunc.h
@@ -20,8 +20,6 @@ class CPDF_DIBTransferFunc : public CFX_FilteredDIB {
template <typename T, typename... Args>
friend RetainPtr<T> pdfium::MakeRetain(Args&&... args);
- ~CPDF_DIBTransferFunc() override;
-
// CFX_FilteredDIB
FXDIB_Format GetDestFormat() override;
FX_ARGB* GetDestPalette() override;
@@ -35,6 +33,7 @@ class CPDF_DIBTransferFunc : public CFX_FilteredDIB {
private:
explicit CPDF_DIBTransferFunc(
const RetainPtr<CPDF_TransferFunc>& pTransferFunc);
+ ~CPDF_DIBTransferFunc() override;
RetainPtr<CPDF_TransferFunc> m_pTransferFunc;
const uint8_t* m_RampR;
diff --git a/core/fpdfdoc/cpdf_occontext.h b/core/fpdfdoc/cpdf_occontext.h
index 07b41cc552..c47b93311d 100644
--- a/core/fpdfdoc/cpdf_occontext.h
+++ b/core/fpdfdoc/cpdf_occontext.h
@@ -19,11 +19,11 @@ class CPDF_PageObject;
class CPDF_OCContext : public Retainable {
public:
+ enum UsageType { View = 0, Design, Print, Export };
+
template <typename T, typename... Args>
friend RetainPtr<T> pdfium::MakeRetain(Args&&... args);
- enum UsageType { View = 0, Design, Print, Export };
-
bool CheckOCGVisible(const CPDF_Dictionary* pOCGDict);
bool CheckObjectVisible(const CPDF_PageObject* pObj);
diff --git a/core/fxcrt/cfx_seekablestreamproxy.h b/core/fxcrt/cfx_seekablestreamproxy.h
index d389baf13f..9b6b3a11c9 100644
--- a/core/fxcrt/cfx_seekablestreamproxy.h
+++ b/core/fxcrt/cfx_seekablestreamproxy.h
@@ -23,6 +23,7 @@ class CFX_SeekableStreamProxy : public IFX_SeekableReadStream {
template <typename T, typename... Args>
friend RetainPtr<T> pdfium::MakeRetain(Args&&... args);
+ // IFX_SeekableReadStream:
FX_FILESIZE GetSize() override;
FX_FILESIZE GetPosition() override;
bool IsEOF() override;
diff --git a/core/fxcrt/css/cfx_csscomputedstyle.h b/core/fxcrt/css/cfx_csscomputedstyle.h
index 4b44a6d87c..5080a7a3c2 100644
--- a/core/fxcrt/css/cfx_csscomputedstyle.h
+++ b/core/fxcrt/css/cfx_csscomputedstyle.h
@@ -55,6 +55,9 @@ class CFX_CSSComputedStyle : public Retainable {
bool m_bHasPadding;
};
+ template <typename T, typename... Args>
+ friend RetainPtr<T> pdfium::MakeRetain(Args&&... args);
+
int32_t CountFontFamilies() const;
const WideString GetFontFamily(int32_t index) const;
uint16_t GetFontWeight() const;
@@ -97,9 +100,6 @@ class CFX_CSSComputedStyle : public Retainable {
NonInheritedData m_NonInheritedData;
private:
- template <typename T, typename... Args>
- friend RetainPtr<T> pdfium::MakeRetain(Args&&... args);
-
CFX_CSSComputedStyle();
~CFX_CSSComputedStyle() override;
diff --git a/core/fxge/dib/cfx_dibitmap.h b/core/fxge/dib/cfx_dibitmap.h
index 105a22d76e..008a549bac 100644
--- a/core/fxge/dib/cfx_dibitmap.h
+++ b/core/fxge/dib/cfx_dibitmap.h
@@ -18,8 +18,6 @@ class CFX_DIBitmap : public CFX_DIBSource {
template <typename T, typename... Args>
friend RetainPtr<T> pdfium::MakeRetain(Args&&... args);
- ~CFX_DIBitmap() override;
-
bool Create(int width,
int height,
FXDIB_Format format,
@@ -111,6 +109,7 @@ class CFX_DIBitmap : public CFX_DIBSource {
protected:
CFX_DIBitmap();
CFX_DIBitmap(const CFX_DIBitmap& src);
+ ~CFX_DIBitmap() override;
#if defined _SKIA_SUPPORT_PATHS_
enum class Format { kCleared, kPreMultiplied, kUnPreMultiplied };
diff --git a/core/fxge/dib/cfx_filtereddib.h b/core/fxge/dib/cfx_filtereddib.h
index e998c7169a..9c1efa544d 100644
--- a/core/fxge/dib/cfx_filtereddib.h
+++ b/core/fxge/dib/cfx_filtereddib.h
@@ -17,8 +17,6 @@ class CFX_FilteredDIB : public CFX_DIBSource {
template <typename T, typename... Args>
friend RetainPtr<T> pdfium::MakeRetain(Args&&... args);
- ~CFX_FilteredDIB() override;
-
virtual FXDIB_Format GetDestFormat() = 0;
virtual uint32_t* GetDestPalette() = 0;
virtual void TranslateScanline(const uint8_t* src_buf,
@@ -32,6 +30,7 @@ class CFX_FilteredDIB : public CFX_DIBSource {
protected:
CFX_FilteredDIB();
+ ~CFX_FilteredDIB() override;
// CFX_DIBSource
const uint8_t* GetScanline(int line) const override;
diff --git a/core/fxge/win32/cfx_windowsdib.h b/core/fxge/win32/cfx_windowsdib.h
index 7c2447ded2..3120b8f543 100644
--- a/core/fxge/win32/cfx_windowsdib.h
+++ b/core/fxge/win32/cfx_windowsdib.h
@@ -32,8 +32,6 @@ class CFX_WindowsDIB : public CFX_DIBitmap {
template <typename T, typename... Args>
friend RetainPtr<T> pdfium::MakeRetain(Args&&... args);
- ~CFX_WindowsDIB() override;
-
static ByteString GetBitmapInfo(const RetainPtr<CFX_DIBitmap>& pBitmap);
static HBITMAP GetDDBitmap(const RetainPtr<CFX_DIBitmap>& pBitmap, HDC hDC);
@@ -49,6 +47,7 @@ class CFX_WindowsDIB : public CFX_DIBitmap {
protected:
CFX_WindowsDIB(HDC hDC, int width, int height);
+ ~CFX_WindowsDIB() override;
HDC m_hMemDC;
HBITMAP m_hBitmap;
diff --git a/fpdfsdk/cpdfsdk_customaccess.cpp b/fpdfsdk/cpdfsdk_customaccess.cpp
index 0545ae44fa..9a16a873ae 100644
--- a/fpdfsdk/cpdfsdk_customaccess.cpp
+++ b/fpdfsdk/cpdfsdk_customaccess.cpp
@@ -9,6 +9,8 @@
CPDFSDK_CustomAccess::CPDFSDK_CustomAccess(FPDF_FILEACCESS* pFileAccess)
: m_FileAccess(*pFileAccess) {}
+CPDFSDK_CustomAccess::~CPDFSDK_CustomAccess() = default;
+
FX_FILESIZE CPDFSDK_CustomAccess::GetSize() {
return m_FileAccess.m_FileLen;
}
diff --git a/fpdfsdk/cpdfsdk_customaccess.h b/fpdfsdk/cpdfsdk_customaccess.h
index dabbdf2b39..cc38eb88f4 100644
--- a/fpdfsdk/cpdfsdk_customaccess.h
+++ b/fpdfsdk/cpdfsdk_customaccess.h
@@ -21,6 +21,7 @@ class CPDFSDK_CustomAccess final : public IFX_SeekableReadStream {
private:
explicit CPDFSDK_CustomAccess(FPDF_FILEACCESS* pFileAccess);
+ ~CPDFSDK_CustomAccess() override;
FPDF_FILEACCESS m_FileAccess;
};
diff --git a/fpdfsdk/cpdfsdk_filewriteadapter.h b/fpdfsdk/cpdfsdk_filewriteadapter.h
index a5b4dc89f9..e452d1cc20 100644
--- a/fpdfsdk/cpdfsdk_filewriteadapter.h
+++ b/fpdfsdk/cpdfsdk_filewriteadapter.h
@@ -16,6 +16,7 @@ class CPDFSDK_FileWriteAdapter : public IFX_WriteStream {
template <typename T, typename... Args>
friend RetainPtr<T> pdfium::MakeRetain(Args&&... args);
+ // IFX_WriteStream:
bool WriteBlock(const void* data, size_t size) override;
bool WriteString(const ByteStringView& str) override;
diff --git a/fpdfsdk/cpdfsdk_helpers.cpp b/fpdfsdk/cpdfsdk_helpers.cpp
index 5498909c32..0836325263 100644
--- a/fpdfsdk/cpdfsdk_helpers.cpp
+++ b/fpdfsdk/cpdfsdk_helpers.cpp
@@ -43,8 +43,6 @@ class FPDF_FileHandlerContext : public IFX_SeekableStream {
template <typename T, typename... Args>
friend RetainPtr<T> pdfium::MakeRetain(Args&&... args);
- ~FPDF_FileHandlerContext() override;
-
// IFX_SeekableStream:
FX_FILESIZE GetSize() override;
bool IsEOF() override;
@@ -58,6 +56,7 @@ class FPDF_FileHandlerContext : public IFX_SeekableStream {
protected:
explicit FPDF_FileHandlerContext(FPDF_FILEHANDLER* pFS);
+ ~FPDF_FileHandlerContext() override;
FPDF_FILEHANDLER* m_pFS;
FX_FILESIZE m_nCurPos;
diff --git a/fpdfsdk/cpdfsdk_memoryaccess.h b/fpdfsdk/cpdfsdk_memoryaccess.h
index 9d5a365804..ed9c80acb5 100644
--- a/fpdfsdk/cpdfsdk_memoryaccess.h
+++ b/fpdfsdk/cpdfsdk_memoryaccess.h
@@ -14,13 +14,13 @@ class CPDFSDK_MemoryAccess final : public IFX_SeekableReadStream {
template <typename T, typename... Args>
friend RetainPtr<T> pdfium::MakeRetain(Args&&... args);
- ~CPDFSDK_MemoryAccess() override;
-
+ // IFX_SeekableReadStream:
FX_FILESIZE GetSize() override;
bool ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override;
private:
CPDFSDK_MemoryAccess(const uint8_t* pBuf, FX_FILESIZE size);
+ ~CPDFSDK_MemoryAccess() override;
const uint8_t* const m_pBuf;
const FX_FILESIZE m_size;
diff --git a/fpdfsdk/fpdf_dataavail.cpp b/fpdfsdk/fpdf_dataavail.cpp
index 55d39a0d46..6f201d69f1 100644
--- a/fpdfsdk/fpdf_dataavail.cpp
+++ b/fpdfsdk/fpdf_dataavail.cpp
@@ -64,8 +64,6 @@ class FPDF_FileAccessContext : public IFX_SeekableReadStream {
template <typename T, typename... Args>
friend RetainPtr<T> pdfium::MakeRetain(Args&&... args);
- ~FPDF_FileAccessContext() override {}
-
void Set(FPDF_FILEACCESS* pFile) { m_pFileAccess = pFile; }
// IFX_SeekableReadStream
@@ -73,11 +71,12 @@ class FPDF_FileAccessContext : public IFX_SeekableReadStream {
bool ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override {
return !!m_pFileAccess->m_GetBlock(m_pFileAccess->m_Param, offset,
- (uint8_t*)buffer, size);
+ static_cast<uint8_t*>(buffer), size);
}
private:
FPDF_FileAccessContext() : m_pFileAccess(nullptr) {}
+ ~FPDF_FileAccessContext() override = default;
FPDF_FILEACCESS* m_pFileAccess;
};
diff --git a/testing/fx_string_testhelpers.cpp b/testing/fx_string_testhelpers.cpp
index 443cc89ed1..e2ce9353fb 100644
--- a/testing/fx_string_testhelpers.cpp
+++ b/testing/fx_string_testhelpers.cpp
@@ -16,3 +16,16 @@ std::ostream& operator<<(std::ostream& os, const CFX_DateTime& dt) {
<< std::to_string(dt.GetMillisecond());
return os;
}
+
+CFX_InvalidSeekableReadStream::CFX_InvalidSeekableReadStream(
+ FX_FILESIZE data_size)
+ : data_size_(data_size) {}
+
+CFX_InvalidSeekableReadStream::~CFX_InvalidSeekableReadStream() = default;
+
+CFX_BufferSeekableReadStream::CFX_BufferSeekableReadStream(
+ const unsigned char* src,
+ size_t src_size)
+ : data_(src), data_size_(src_size) {}
+
+CFX_BufferSeekableReadStream::~CFX_BufferSeekableReadStream() = default;
diff --git a/testing/fx_string_testhelpers.h b/testing/fx_string_testhelpers.h
index 5a269a3cf6..cb59cfbc03 100644
--- a/testing/fx_string_testhelpers.h
+++ b/testing/fx_string_testhelpers.h
@@ -25,10 +25,10 @@ class CFX_InvalidSeekableReadStream : public IFX_SeekableReadStream {
FX_FILESIZE GetSize() override { return data_size_; }
private:
- explicit CFX_InvalidSeekableReadStream(FX_FILESIZE data_size)
- : data_size_(data_size) {}
+ explicit CFX_InvalidSeekableReadStream(FX_FILESIZE data_size);
+ ~CFX_InvalidSeekableReadStream() override;
- FX_FILESIZE data_size_;
+ const FX_FILESIZE data_size_;
};
class CFX_BufferSeekableReadStream : public IFX_SeekableReadStream {
@@ -55,8 +55,8 @@ class CFX_BufferSeekableReadStream : public IFX_SeekableReadStream {
}
private:
- CFX_BufferSeekableReadStream(const unsigned char* src, size_t src_size)
- : data_(src), data_size_(src_size) {}
+ CFX_BufferSeekableReadStream(const unsigned char* src, size_t src_size);
+ ~CFX_BufferSeekableReadStream() override;
const unsigned char* data_;
size_t data_size_;
diff --git a/xfa/fgas/font/cfgas_gefont.h b/xfa/fgas/font/cfgas_gefont.h
index f4d729d3a5..bc24cebe47 100644
--- a/xfa/fgas/font/cfgas_gefont.h
+++ b/xfa/fgas/font/cfgas_gefont.h
@@ -22,8 +22,6 @@ class CFX_UnicodeEncoding;
class CFGAS_GEFont : public Retainable {
public:
- template <typename T>
- friend class RetainPtr;
template <typename T, typename... Args>
friend RetainPtr<T> pdfium::MakeRetain(Args&&... args);