Home | History | Annotate | Download | only in fm2js
      1 // Copyright 2017 PDFium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 #ifndef XFA_FXFA_FM2JS_CXFA_FMTOJAVASCRIPTDEPTH_H_
      6 #define XFA_FXFA_FM2JS_CXFA_FMTOJAVASCRIPTDEPTH_H_
      7 
      8 class CXFA_FMToJavaScriptDepth {
      9  public:
     10   CXFA_FMToJavaScriptDepth() { depth_++; }
     11   ~CXFA_FMToJavaScriptDepth() { depth_--; }
     12 
     13   bool IsWithinMaxDepth() const { return depth_ <= max_depth_; }
     14 
     15   static void Reset();
     16 
     17  private:
     18   static unsigned long depth_;
     19   static unsigned long max_depth_;
     20 };
     21 
     22 #endif  // XFA_FXFA_FM2JS_CXFA_FMTOJAVASCRIPTDEPTH_H_
     23