diff options
Diffstat (limited to 'xfa/fxfa/fm2js/cxfa_fmtojavascriptdepth.h')
-rw-r--r-- | xfa/fxfa/fm2js/cxfa_fmtojavascriptdepth.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/xfa/fxfa/fm2js/cxfa_fmtojavascriptdepth.h b/xfa/fxfa/fm2js/cxfa_fmtojavascriptdepth.h new file mode 100644 index 0000000000..14f87a68f5 --- /dev/null +++ b/xfa/fxfa/fm2js/cxfa_fmtojavascriptdepth.h @@ -0,0 +1,22 @@ +// 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 XFA_FXFA_FM2JS_CXFA_FMTOJAVASCRIPTDEPTH_H_ +#define XFA_FXFA_FM2JS_CXFA_FMTOJAVASCRIPTDEPTH_H_ + +class CXFA_FMToJavaScriptDepth { + public: + CXFA_FMToJavaScriptDepth() { depth_++; } + ~CXFA_FMToJavaScriptDepth() { depth_--; } + + bool IsWithinMaxDepth() const { return depth_ <= max_depth_; } + + static void Reset(); + + private: + static unsigned long depth_; + static unsigned long max_depth_; +}; + +#endif // XFA_FXFA_FM2JS_CXFA_FMTOJAVASCRIPTDEPTH_H_ |