summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-08-30 15:37:47 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-08-30 19:47:58 +0000
commit674bbfe24ded465a4d27b268ca84f75976d556da (patch)
treed01575d7d0a7320af6011162f3955b9f9a45c459
parentccd5be05f61c85754daf5c8155f4932f6d35a55a (diff)
downloadpdfium-674bbfe24ded465a4d27b268ca84f75976d556da.tar.xz
Split auto restorer from fx_basic
This CL moves CFX_AutoRestorer into its own file, separate from fx_basic.h. Change-Id: I415cb9207416bd4744b8ac8e2d7466852db53f0a Reviewed-on: https://pdfium-review.googlesource.com/12390 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
-rw-r--r--BUILD.gn1
-rw-r--r--core/fpdfapi/parser/cpdf_syntax_parser.cpp1
-rw-r--r--core/fpdfapi/render/cpdf_renderstatus.cpp1
-rw-r--r--core/fxcrt/cfx_autorestorer.h20
-rw-r--r--core/fxcrt/fx_basic.h12
-rw-r--r--fpdfsdk/cpdfsdk_pageview.cpp1
-rw-r--r--fpdfsdk/formfiller/cffl_interactiveformfiller.cpp1
-rw-r--r--fpdfsdk/javascript/cjs_event_context.cpp1
-rw-r--r--fpdfsdk/pwl/cpwl_edit_impl.cpp1
-rw-r--r--xfa/fxfa/fm2js/cxfa_fmparser.cpp1
-rw-r--r--xfa/fxfa/parser/cxfa_scriptcontext.cpp1
11 files changed, 29 insertions, 12 deletions
diff --git a/BUILD.gn b/BUILD.gn
index 969c917924..0f8ddcd775 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -803,6 +803,7 @@ config("fxge_warnings") {
static_library("fxcrt") {
sources = [
+ "core/fxcrt/cfx_autorestorer.h",
"core/fxcrt/cfx_bitstream.cpp",
"core/fxcrt/cfx_bitstream.h",
"core/fxcrt/cfx_bytestring.cpp",
diff --git a/core/fpdfapi/parser/cpdf_syntax_parser.cpp b/core/fpdfapi/parser/cpdf_syntax_parser.cpp
index 7592438258..c0d21217a5 100644
--- a/core/fpdfapi/parser/cpdf_syntax_parser.cpp
+++ b/core/fpdfapi/parser/cpdf_syntax_parser.cpp
@@ -25,6 +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/fx_extension.h"
#include "third_party/base/numerics/safe_math.h"
#include "third_party/base/ptr_util.h"
diff --git a/core/fpdfapi/render/cpdf_renderstatus.cpp b/core/fpdfapi/render/cpdf_renderstatus.cpp
index 01deab0bea..1f949fb440 100644
--- a/core/fpdfapi/render/cpdf_renderstatus.cpp
+++ b/core/fpdfapi/render/cpdf_renderstatus.cpp
@@ -46,6 +46,7 @@
#include "core/fpdfapi/render/cpdf_type3cache.h"
#include "core/fpdfdoc/cpdf_occontext.h"
#include "core/fxcodec/fx_codec.h"
+#include "core/fxcrt/cfx_autorestorer.h"
#include "core/fxcrt/cfx_maybe_owned.h"
#include "core/fxcrt/fx_safe_types.h"
#include "core/fxge/cfx_defaultrenderdevice.h"
diff --git a/core/fxcrt/cfx_autorestorer.h b/core/fxcrt/cfx_autorestorer.h
new file mode 100644
index 0000000000..a8c5125c4e
--- /dev/null
+++ b/core/fxcrt/cfx_autorestorer.h
@@ -0,0 +1,20 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// 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_
+
+template <typename T>
+class CFX_AutoRestorer {
+ public:
+ explicit CFX_AutoRestorer(T* location)
+ : m_Location(location), m_OldValue(*location) {}
+ ~CFX_AutoRestorer() { *m_Location = m_OldValue; }
+
+ private:
+ T* const m_Location;
+ const T m_OldValue;
+};
+
+#endif // CORE_FXCRT_CFX_AUTORESTORER_H_
diff --git a/core/fxcrt/fx_basic.h b/core/fxcrt/fx_basic.h
index 167ef5ce70..8e3312d365 100644
--- a/core/fxcrt/fx_basic.h
+++ b/core/fxcrt/fx_basic.h
@@ -142,18 +142,6 @@ class IFX_Pause {
virtual bool NeedToPauseNow() = 0;
};
-template <typename T>
-class CFX_AutoRestorer {
- public:
- explicit CFX_AutoRestorer(T* location)
- : m_Location(location), m_OldValue(*location) {}
- ~CFX_AutoRestorer() { *m_Location = m_OldValue; }
-
- private:
- T* const m_Location;
- const T m_OldValue;
-};
-
uint32_t GetBits32(const uint8_t* pData, int bitpos, int nbits);
#endif // CORE_FXCRT_FX_BASIC_H_
diff --git a/fpdfsdk/cpdfsdk_pageview.cpp b/fpdfsdk/cpdfsdk_pageview.cpp
index 358f72705d..2155b5d3d8 100644
--- a/fpdfsdk/cpdfsdk_pageview.cpp
+++ b/fpdfsdk/cpdfsdk_pageview.cpp
@@ -13,6 +13,7 @@
#include "core/fpdfapi/render/cpdf_renderoptions.h"
#include "core/fpdfdoc/cpdf_annotlist.h"
#include "core/fpdfdoc/cpdf_interform.h"
+#include "core/fxcrt/cfx_autorestorer.h"
#include "fpdfsdk/cpdfsdk_annot.h"
#include "fpdfsdk/cpdfsdk_annotiteration.h"
#include "fpdfsdk/cpdfsdk_formfillenvironment.h"
diff --git a/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp b/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp
index e4e06d81dd..eabb899c27 100644
--- a/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp
+++ b/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp
@@ -8,6 +8,7 @@
#include "core/fpdfapi/page/cpdf_page.h"
#include "core/fpdfapi/parser/cpdf_document.h"
+#include "core/fxcrt/cfx_autorestorer.h"
#include "core/fxge/cfx_graphstatedata.h"
#include "core/fxge/cfx_pathdata.h"
#include "core/fxge/cfx_renderdevice.h"
diff --git a/fpdfsdk/javascript/cjs_event_context.cpp b/fpdfsdk/javascript/cjs_event_context.cpp
index abfb6da36f..9537ac984e 100644
--- a/fpdfsdk/javascript/cjs_event_context.cpp
+++ b/fpdfsdk/javascript/cjs_event_context.cpp
@@ -6,6 +6,7 @@
#include "fpdfsdk/javascript/cjs_event_context.h"
+#include "core/fxcrt/cfx_autorestorer.h"
#include "fpdfsdk/javascript/JS_EventHandler.h"
#include "fpdfsdk/javascript/cjs_runtime.h"
#include "fpdfsdk/javascript/resource.h"
diff --git a/fpdfsdk/pwl/cpwl_edit_impl.cpp b/fpdfsdk/pwl/cpwl_edit_impl.cpp
index 5d7a44c623..42eaa16667 100644
--- a/fpdfsdk/pwl/cpwl_edit_impl.cpp
+++ b/fpdfsdk/pwl/cpwl_edit_impl.cpp
@@ -22,6 +22,7 @@
#include "core/fpdfdoc/cpvt_section.h"
#include "core/fpdfdoc/cpvt_word.h"
#include "core/fpdfdoc/ipvt_fontmap.h"
+#include "core/fxcrt/cfx_autorestorer.h"
#include "core/fxcrt/fx_codepage.h"
#include "core/fxge/cfx_graphstatedata.h"
#include "core/fxge/cfx_pathdata.h"
diff --git a/xfa/fxfa/fm2js/cxfa_fmparser.cpp b/xfa/fxfa/fm2js/cxfa_fmparser.cpp
index 18c37c5b6a..65517fb79d 100644
--- a/xfa/fxfa/fm2js/cxfa_fmparser.cpp
+++ b/xfa/fxfa/fm2js/cxfa_fmparser.cpp
@@ -10,6 +10,7 @@
#include <utility>
#include <vector>
+#include "core/fxcrt/cfx_autorestorer.h"
#include "third_party/base/ptr_util.h"
namespace {
diff --git a/xfa/fxfa/parser/cxfa_scriptcontext.cpp b/xfa/fxfa/parser/cxfa_scriptcontext.cpp
index 57caa9981b..24b1e3c9fe 100644
--- a/xfa/fxfa/parser/cxfa_scriptcontext.cpp
+++ b/xfa/fxfa/parser/cxfa_scriptcontext.cpp
@@ -8,6 +8,7 @@
#include <utility>
+#include "core/fxcrt/cfx_autorestorer.h"
#include "core/fxcrt/fx_extension.h"
#include "fxjs/cfxjse_arguments.h"
#include "fxjs/cfxjse_class.h"