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

Side by Side Diff: Source/bindings/core/v8/V8RecursionScope.h

Issue 397733004: Allow assertions to be enabled in Blink Release builds. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased. Created 6 years, 5 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 | Annotate | Revision Log
OLDNEW
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
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
OLDNEW
« no previous file with comments | « Source/bindings/core/v8/V8PerIsolateData.cpp ('k') | Source/bindings/core/v8/V8StringResource.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698