Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(199)

Side by Side Diff: core/include/fxcrt/fx_basic.h

Issue 1360103002: Get rid of gotos in CPDF_SyntaxParser and FlateUncompress(). (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: address comments, more cleanups Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 // Used with nonstd::unique_ptr to Release() objects that can't be deleted. 948 // Used with nonstd::unique_ptr to Release() objects that can't be deleted.
951 template <class T> 949 template <class T>
952 struct ReleaseDeleter { 950 struct ReleaseDeleter {
953 inline void operator()(T* ptr) const { ptr->Release(); } 951 inline void operator()(T* ptr) const { ptr->Release(); }
954 }; 952 };
955 953
956 // TODO(thestig) Remove in favor of nonstd::unique_ptr. 954 // TODO(thestig) Remove in favor of nonstd::unique_ptr.
957 template <class T> 955 template <class T>
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
1147 FX_FLOAT c; 1145 FX_FLOAT c;
1148 FX_FLOAT d; 1146 FX_FLOAT d;
1149 FX_FLOAT e; 1147 FX_FLOAT e;
1150 FX_FLOAT f; 1148 FX_FLOAT f;
1151 FX_FLOAT g; 1149 FX_FLOAT g;
1152 FX_FLOAT h; 1150 FX_FLOAT h;
1153 FX_FLOAT i; 1151 FX_FLOAT i;
1154 }; 1152 };
1155 1153
1156 #endif // CORE_INCLUDE_FXCRT_FX_BASIC_H_ 1154 #endif // CORE_INCLUDE_FXCRT_FX_BASIC_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698