OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 { | 74 { |
75 if (!V8PerIsolateData::from(m_isolate)->decrementRecursionLevel()) | 75 if (!V8PerIsolateData::from(m_isolate)->decrementRecursionLevel()) |
76 didLeaveScriptContext(); | 76 didLeaveScriptContext(); |
77 } | 77 } |
78 | 78 |
79 static int recursionLevel(v8::Isolate* isolate) | 79 static int recursionLevel(v8::Isolate* isolate) |
80 { | 80 { |
81 return V8PerIsolateData::from(isolate)->recursionLevel(); | 81 return V8PerIsolateData::from(isolate)->recursionLevel(); |
82 } | 82 } |
83 | 83 |
84 #ifndef NDEBUG | 84 #if ENABLE(ASSERT) |
85 static bool properlyUsed(v8::Isolate* isolate) | 85 static bool properlyUsed(v8::Isolate* isolate) |
86 { | 86 { |
87 return recursionLevel(isolate) > 0 || V8PerIsolateData::from(isolate)->i
nternalScriptRecursionLevel() > 0; | 87 return recursionLevel(isolate) > 0 || V8PerIsolateData::from(isolate)->i
nternalScriptRecursionLevel() > 0; |
88 } | 88 } |
89 #endif | 89 #endif |
90 | 90 |
91 class MicrotaskSuppression { | 91 class MicrotaskSuppression { |
92 public: | 92 public: |
93 MicrotaskSuppression(v8::Isolate* isolate) | 93 MicrotaskSuppression(v8::Isolate* isolate) |
94 #ifndef NDEBUG | 94 #if ENABLE(ASSERT) |
95 : m_isolate(isolate) | 95 : m_isolate(isolate) |
96 #endif | 96 #endif |
97 { | 97 { |
98 ASSERT(!ScriptForbiddenScope::isScriptForbidden()); | 98 ASSERT(!ScriptForbiddenScope::isScriptForbidden()); |
99 #ifndef NDEBUG | 99 #if ENABLE(ASSERT) |
100 V8PerIsolateData::from(m_isolate)->incrementInternalScriptRecursionL
evel(); | 100 V8PerIsolateData::from(m_isolate)->incrementInternalScriptRecursionL
evel(); |
101 #endif | 101 #endif |
102 } | 102 } |
103 | 103 |
104 ~MicrotaskSuppression() | 104 ~MicrotaskSuppression() |
105 { | 105 { |
106 #ifndef NDEBUG | 106 #if ENABLE(ASSERT) |
107 V8PerIsolateData::from(m_isolate)->decrementInternalScriptRecursionL
evel(); | 107 V8PerIsolateData::from(m_isolate)->decrementInternalScriptRecursionL
evel(); |
108 #endif | 108 #endif |
109 } | 109 } |
110 | 110 |
111 private: | 111 private: |
112 #ifndef NDEBUG | 112 #if ENABLE(ASSERT) |
113 v8::Isolate* m_isolate; | 113 v8::Isolate* m_isolate; |
114 #endif | 114 #endif |
115 }; | 115 }; |
116 | 116 |
117 private: | 117 private: |
118 void didLeaveScriptContext(); | 118 void didLeaveScriptContext(); |
119 | 119 |
120 v8::Isolate* m_isolate; | 120 v8::Isolate* m_isolate; |
121 ExecutionContext& m_executionContext; | 121 ExecutionContext& m_executionContext; |
122 }; | 122 }; |
123 | 123 |
124 } // namespace WebCore | 124 } // namespace WebCore |
125 | 125 |
126 #endif // V8RecursionScope_h | 126 #endif // V8RecursionScope_h |
OLD | NEW |