summaryrefslogtreecommitdiff
path: root/xfa
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-12-07 13:45:41 -0800
committerCommit bot <commit-bot@chromium.org>2016-12-07 13:45:41 -0800
commitcd5e12a9ea397b48056643a7b65126395eec3174 (patch)
treed1b6b0c0e1b8f8d996aa987e6386338bca5ba92b /xfa
parent7cda31ac2f2884166f044937619478a6103198cf (diff)
downloadpdfium-cd5e12a9ea397b48056643a7b65126395eec3174.tar.xz
Catch stray Retains() and Releases() outside of RetainPtr<>.
The previous CLs made the code clean, so now we can mark more things private, and add friends as appropriate. Review-Url: https://codereview.chromium.org/2560783003
Diffstat (limited to 'xfa')
-rw-r--r--xfa/fgas/crt/fgas_stream.cpp14
-rw-r--r--xfa/fxfa/parser/cxfa_widetextread.cpp2
-rw-r--r--xfa/fxfa/parser/cxfa_widetextread.h7
3 files changed, 18 insertions, 5 deletions
diff --git a/xfa/fgas/crt/fgas_stream.cpp b/xfa/fgas/crt/fgas_stream.cpp
index 966f615676..424b191cb8 100644
--- a/xfa/fgas/crt/fgas_stream.cpp
+++ b/xfa/fgas/crt/fgas_stream.cpp
@@ -194,8 +194,8 @@ enum FX_STREAMTYPE {
class CFGAS_Stream : public IFGAS_Stream {
public:
- CFGAS_Stream();
- ~CFGAS_Stream() override;
+ template <typename T, typename... Args>
+ friend CFX_RetainPtr<T> pdfium::MakeRetain(Args&&... args);
bool LoadFile(const FX_WCHAR* pszSrcFileName, uint32_t dwAccess);
bool LoadBuffer(uint8_t* pData, int32_t iTotalSize, uint32_t dwAccess);
@@ -227,6 +227,9 @@ class CFGAS_Stream : public IFGAS_Stream {
int32_t iLength) override;
protected:
+ CFGAS_Stream();
+ ~CFGAS_Stream() override;
+
FX_STREAMTYPE m_eStreamType;
IFGAS_StreamImp* m_pStreamImp;
uint32_t m_dwAccess;
@@ -239,8 +242,8 @@ class CFGAS_Stream : public IFGAS_Stream {
class CFGAS_TextStream : public IFGAS_Stream {
public:
- explicit CFGAS_TextStream(const CFX_RetainPtr<IFGAS_Stream>& pStream);
- ~CFGAS_TextStream() override;
+ template <typename T, typename... Args>
+ friend CFX_RetainPtr<T> pdfium::MakeRetain(Args&&... args);
// IFGAS_Stream
uint32_t GetAccessModes() const override;
@@ -262,6 +265,9 @@ class CFGAS_TextStream : public IFGAS_Stream {
int32_t iLength) override;
protected:
+ explicit CFGAS_TextStream(const CFX_RetainPtr<IFGAS_Stream>& pStream);
+ ~CFGAS_TextStream() override;
+
void InitStream();
uint16_t m_wCodePage;
diff --git a/xfa/fxfa/parser/cxfa_widetextread.cpp b/xfa/fxfa/parser/cxfa_widetextread.cpp
index 54442df7c0..34fa6b9c5e 100644
--- a/xfa/fxfa/parser/cxfa_widetextread.cpp
+++ b/xfa/fxfa/parser/cxfa_widetextread.cpp
@@ -14,6 +14,8 @@
CXFA_WideTextRead::CXFA_WideTextRead(const CFX_WideString& wsBuffer)
: m_wsBuffer(wsBuffer), m_iPosition(0) {}
+CXFA_WideTextRead::~CXFA_WideTextRead() {}
+
uint32_t CXFA_WideTextRead::GetAccessModes() const {
return FX_STREAMACCESS_Read | FX_STREAMACCESS_Text;
}
diff --git a/xfa/fxfa/parser/cxfa_widetextread.h b/xfa/fxfa/parser/cxfa_widetextread.h
index d3d3b3792a..2ccb042908 100644
--- a/xfa/fxfa/parser/cxfa_widetextread.h
+++ b/xfa/fxfa/parser/cxfa_widetextread.h
@@ -7,11 +7,13 @@
#ifndef XFA_FXFA_PARSER_CXFA_WIDETEXTREAD_H_
#define XFA_FXFA_PARSER_CXFA_WIDETEXTREAD_H_
+#include "core/fxcrt/cfx_retain_ptr.h"
#include "xfa/fgas/crt/fgas_stream.h"
class CXFA_WideTextRead : public IFGAS_Stream {
public:
- explicit CXFA_WideTextRead(const CFX_WideString& wsBuffer);
+ template <typename T, typename... Args>
+ friend CFX_RetainPtr<T> pdfium::MakeRetain(Args&&... args);
// IFGAS_Stream
uint32_t GetAccessModes() const override;
@@ -35,6 +37,9 @@ class CXFA_WideTextRead : public IFGAS_Stream {
CFX_WideString GetSrcText() const;
protected:
+ explicit CXFA_WideTextRead(const CFX_WideString& wsBuffer);
+ ~CXFA_WideTextRead() override;
+
CFX_WideString m_wsBuffer;
int32_t m_iPosition;
};