| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #ifndef CORE_INCLUDE_FXCRT_FX_BASIC_H_ | 7 #ifndef CORE_INCLUDE_FXCRT_FX_BASIC_H_ |
| 8 #define CORE_INCLUDE_FXCRT_FX_BASIC_H_ | 8 #define CORE_INCLUDE_FXCRT_FX_BASIC_H_ |
| 9 | 9 |
| 10 #include "fx_memory.h" | 10 #include "fx_memory.h" |
| (...skipping 918 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 929 }; | 929 }; |
| 930 class IFX_Pause { | 930 class IFX_Pause { |
| 931 public: | 931 public: |
| 932 virtual ~IFX_Pause() {} | 932 virtual ~IFX_Pause() {} |
| 933 virtual FX_BOOL NeedToPauseNow() = 0; | 933 virtual FX_BOOL NeedToPauseNow() = 0; |
| 934 }; | 934 }; |
| 935 | 935 |
| 936 template <typename T> | 936 template <typename T> |
| 937 class CFX_AutoRestorer { | 937 class CFX_AutoRestorer { |
| 938 public: | 938 public: |
| 939 explicit CFX_AutoRestorer(T* location) { | 939 explicit CFX_AutoRestorer(T* location) |
| 940 m_Location = location; | 940 : m_Location(location), m_OldValue(*location) {} |
| 941 m_OldValue = *location; | |
| 942 } | |
| 943 ~CFX_AutoRestorer() { *m_Location = m_OldValue; } | 941 ~CFX_AutoRestorer() { *m_Location = m_OldValue; } |
| 944 | 942 |
| 945 private: | 943 private: |
| 946 T* m_Location; | 944 T* const m_Location; |
| 947 T m_OldValue; | 945 const T m_OldValue; |
| 948 }; | 946 }; |
| 949 | 947 |
| 950 struct FxFreeDeleter { | 948 struct FxFreeDeleter { |
| 951 inline void operator()(void* ptr) const { FX_Free(ptr); } | 949 inline void operator()(void* ptr) const { FX_Free(ptr); } |
| 952 }; | 950 }; |
| 953 | 951 |
| 954 // Used with nonstd::unique_ptr to Release() objects that can't be deleted. | 952 // Used with nonstd::unique_ptr to Release() objects that can't be deleted. |
| 955 template <class T> | 953 template <class T> |
| 956 struct ReleaseDeleter { | 954 struct ReleaseDeleter { |
| 957 inline void operator()(T* ptr) const { ptr->Release(); } | 955 inline void operator()(T* ptr) const { ptr->Release(); } |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1151 FX_FLOAT c; | 1149 FX_FLOAT c; |
| 1152 FX_FLOAT d; | 1150 FX_FLOAT d; |
| 1153 FX_FLOAT e; | 1151 FX_FLOAT e; |
| 1154 FX_FLOAT f; | 1152 FX_FLOAT f; |
| 1155 FX_FLOAT g; | 1153 FX_FLOAT g; |
| 1156 FX_FLOAT h; | 1154 FX_FLOAT h; |
| 1157 FX_FLOAT i; | 1155 FX_FLOAT i; |
| 1158 }; | 1156 }; |
| 1159 | 1157 |
| 1160 #endif // CORE_INCLUDE_FXCRT_FX_BASIC_H_ | 1158 #endif // CORE_INCLUDE_FXCRT_FX_BASIC_H_ |
| OLD | NEW |