OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium 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 #ifndef StackFrameDepth_h | 5 #ifndef StackFrameDepth_h |
6 #define StackFrameDepth_h | 6 #define StackFrameDepth_h |
7 | 7 |
8 #include "platform/PlatformExport.h" | 8 #include "platform/PlatformExport.h" |
9 #include "wtf/Allocator.h" | 9 #include "wtf/Allocator.h" |
10 #include "wtf/Assertions.h" | 10 #include "wtf/Assertions.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 } | 81 } |
82 #if COMPILER(MSVC) | 82 #if COMPILER(MSVC) |
83 #pragma warning(pop) | 83 #pragma warning(pop) |
84 #endif | 84 #endif |
85 | 85 |
86 private: | 86 private: |
87 // The maximum depth of eager, unrolled trace() calls that is | 87 // The maximum depth of eager, unrolled trace() calls that is |
88 // considered safe and allowed. | 88 // considered safe and allowed. |
89 static const int kSafeStackFrameSize = 32 * 1024; | 89 static const int kSafeStackFrameSize = 32 * 1024; |
90 | 90 |
| 91 static uintptr_t getFallbackStackLimit(); |
| 92 |
91 static uintptr_t s_stackFrameLimit; | 93 static uintptr_t s_stackFrameLimit; |
92 #if ENABLE(ASSERT) | 94 #if ENABLE(ASSERT) |
93 static bool s_isEnabled; | 95 static bool s_isEnabled; |
94 static bool s_isUsingFallbackStackSize; | 96 static bool s_isUsingFallbackStackSize; |
95 #endif | 97 #endif |
96 }; | 98 }; |
97 | 99 |
98 class StackFrameDepthScope { | 100 class StackFrameDepthScope { |
99 STACK_ALLOCATED(); | 101 STACK_ALLOCATED(); |
100 WTF_MAKE_NONCOPYABLE(StackFrameDepthScope); | 102 WTF_MAKE_NONCOPYABLE(StackFrameDepthScope); |
101 public: | 103 public: |
102 StackFrameDepthScope() | 104 StackFrameDepthScope() |
103 { | 105 { |
104 StackFrameDepth::enableStackLimit(); | 106 StackFrameDepth::enableStackLimit(); |
105 ASSERT(StackFrameDepth::isSafeToRecurse()); | 107 ASSERT(StackFrameDepth::isSafeToRecurse()); |
106 } | 108 } |
107 | 109 |
108 ~StackFrameDepthScope() | 110 ~StackFrameDepthScope() |
109 { | 111 { |
110 StackFrameDepth::disableStackLimit(); | 112 StackFrameDepth::disableStackLimit(); |
111 } | 113 } |
112 }; | 114 }; |
113 | 115 |
114 } // namespace blink | 116 } // namespace blink |
115 | 117 |
116 #endif // StackFrameDepth_h | 118 #endif // StackFrameDepth_h |
OLD | NEW |