summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-09-21 14:51:57 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-09-21 19:16:29 +0000
commitb89669975f6156fce4ced5c8998125a845f8e7dc (patch)
tree185c2badc52530ec1baddb854824bc5891e476a1 /core
parentdb0312e6acd7cc15fef0f64e05bd463cb74c70e4 (diff)
downloadpdfium-b89669975f6156fce4ced5c8998125a845f8e7dc.tar.xz
Move CFX_AutoRestorer to fxcrt::AutoRestorer
This CL renames CFX_AutoRestorer to just AutoRestorer and places in the fxcrt namespace. Bug: pdfium:898 Change-Id: Id9f36df94e95f3b2a55054bc198ca1bfd249ee3d Reviewed-on: https://pdfium-review.googlesource.com/14450 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'core')
-rw-r--r--core/fpdfapi/parser/cpdf_syntax_parser.cpp10
-rw-r--r--core/fpdfapi/render/cpdf_renderstatus.cpp4
-rw-r--r--core/fxcrt/autorestorer.h (renamed from core/fxcrt/cfx_autorestorer.h)18
3 files changed, 19 insertions, 13 deletions
diff --git a/core/fpdfapi/parser/cpdf_syntax_parser.cpp b/core/fpdfapi/parser/cpdf_syntax_parser.cpp
index 4412105c7b..4556dc9627 100644
--- a/core/fpdfapi/parser/cpdf_syntax_parser.cpp
+++ b/core/fpdfapi/parser/cpdf_syntax_parser.cpp
@@ -25,7 +25,7 @@
#include "core/fpdfapi/parser/cpdf_string.h"
#include "core/fpdfapi/parser/fpdf_parser_decode.h"
#include "core/fpdfapi/parser/fpdf_parser_utility.h"
-#include "core/fxcrt/cfx_autorestorer.h"
+#include "core/fxcrt/autorestorer.h"
#include "core/fxcrt/cfx_binarybuf.h"
#include "core/fxcrt/fx_extension.h"
#include "third_party/base/numerics/safe_math.h"
@@ -55,7 +55,7 @@ CPDF_SyntaxParser::~CPDF_SyntaxParser() {
}
bool CPDF_SyntaxParser::GetCharAt(FX_FILESIZE pos, uint8_t& ch) {
- CFX_AutoRestorer<FX_FILESIZE> save_pos(&m_Pos);
+ AutoRestorer<FX_FILESIZE> save_pos(&m_Pos);
m_Pos = pos;
return GetNextChar(ch);
}
@@ -352,7 +352,7 @@ ByteString CPDF_SyntaxParser::GetNextWord(bool* bIsNumber) {
}
ByteString CPDF_SyntaxParser::PeekNextWord(bool* bIsNumber) {
- const CFX_AutoRestorer<FX_FILESIZE> save_pos(&m_Pos);
+ AutoRestorer<FX_FILESIZE> save_pos(&m_Pos);
return GetNextWord(bIsNumber);
}
@@ -379,7 +379,7 @@ std::unique_ptr<CPDF_Object> CPDF_SyntaxParser::GetObjectInternal(
uint32_t gennum,
bool bDecrypt,
ParseType parse_type) {
- CFX_AutoRestorer<int> restorer(&s_CurrentRecursionDepth);
+ AutoRestorer<int> restorer(&s_CurrentRecursionDepth);
if (++s_CurrentRecursionDepth > kParserMaxRecursionDepth)
return nullptr;
@@ -485,7 +485,7 @@ std::unique_ptr<CPDF_Object> CPDF_SyntaxParser::GetObjectInternal(
// contents to the un-decrypted form.
if (m_pCryptoHandler && bDecrypt && pDict->IsSignatureDict() &&
dwSignValuePos) {
- CFX_AutoRestorer<FX_FILESIZE> save_pos(&m_Pos);
+ AutoRestorer<FX_FILESIZE> save_pos(&m_Pos);
m_Pos = dwSignValuePos;
pDict->SetFor("Contents", GetObject(pObjList, objnum, gennum, false));
}
diff --git a/core/fpdfapi/render/cpdf_renderstatus.cpp b/core/fpdfapi/render/cpdf_renderstatus.cpp
index 6d7e7f1372..26eed112c5 100644
--- a/core/fpdfapi/render/cpdf_renderstatus.cpp
+++ b/core/fpdfapi/render/cpdf_renderstatus.cpp
@@ -45,7 +45,7 @@
#include "core/fpdfapi/render/cpdf_transferfunc.h"
#include "core/fpdfapi/render/cpdf_type3cache.h"
#include "core/fpdfdoc/cpdf_occontext.h"
-#include "core/fxcrt/cfx_autorestorer.h"
+#include "core/fxcrt/autorestorer.h"
#include "core/fxcrt/cfx_fixedbufgrow.h"
#include "core/fxcrt/cfx_maybe_owned.h"
#include "core/fxcrt/fx_safe_types.h"
@@ -1079,7 +1079,7 @@ void CPDF_RenderStatus::RenderSingleObject(CPDF_PageObject* pObj,
#if defined _SKIA_SUPPORT_
DebugVerifyDeviceIsPreMultiplied();
#endif
- CFX_AutoRestorer<int> restorer(&s_CurrentRecursionDepth);
+ AutoRestorer<int> restorer(&s_CurrentRecursionDepth);
if (++s_CurrentRecursionDepth > kRenderMaxRecursionDepth) {
return;
}
diff --git a/core/fxcrt/cfx_autorestorer.h b/core/fxcrt/autorestorer.h
index a8c5125c4e..745a56fff2 100644
--- a/core/fxcrt/cfx_autorestorer.h
+++ b/core/fxcrt/autorestorer.h
@@ -2,19 +2,25 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CORE_FXCRT_CFX_AUTORESTORER_H_
-#define CORE_FXCRT_CFX_AUTORESTORER_H_
+#ifndef CORE_FXCRT_AUTORESTORER_H_
+#define CORE_FXCRT_AUTORESTORER_H_
+
+namespace fxcrt {
template <typename T>
-class CFX_AutoRestorer {
+class AutoRestorer {
public:
- explicit CFX_AutoRestorer(T* location)
+ explicit AutoRestorer(T* location)
: m_Location(location), m_OldValue(*location) {}
- ~CFX_AutoRestorer() { *m_Location = m_OldValue; }
+ ~AutoRestorer() { *m_Location = m_OldValue; }
private:
T* const m_Location;
const T m_OldValue;
};
-#endif // CORE_FXCRT_CFX_AUTORESTORER_H_
+} // namespace fxcrt
+
+using fxcrt::AutoRestorer;
+
+#endif // CORE_FXCRT_AUTORESTORER_H_