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

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

Issue 648423003: Enforce ScriptForbiddenScope and make it non-fatal. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Trim superfluous includes Created 6 years, 2 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 // V8RecursionScope::MicrotaskSuppression -- this skips work that is spec'd to 55 // V8RecursionScope::MicrotaskSuppression -- this skips work that is spec'd to
56 // happen at the end of the outer-most script stack frame of calls into page scr ipt: 56 // happen at the end of the outer-most script stack frame of calls into page scr ipt:
57 // 57 //
58 // http://www.whatwg.org/specs/web-apps/current-work/#perform-a-microtask-checkp oint 58 // http://www.whatwg.org/specs/web-apps/current-work/#perform-a-microtask-checkp oint
59 class V8RecursionScope { 59 class V8RecursionScope {
60 WTF_MAKE_NONCOPYABLE(V8RecursionScope); 60 WTF_MAKE_NONCOPYABLE(V8RecursionScope);
61 public: 61 public:
62 explicit V8RecursionScope(v8::Isolate* isolate) 62 explicit V8RecursionScope(v8::Isolate* isolate)
63 : m_isolate(isolate) 63 : m_isolate(isolate)
64 { 64 {
65 RELEASE_ASSERT(!ScriptForbiddenScope::isScriptForbidden());
65 V8PerIsolateData::from(m_isolate)->incrementRecursionLevel(); 66 V8PerIsolateData::from(m_isolate)->incrementRecursionLevel();
66 RELEASE_ASSERT(!ScriptForbiddenScope::isScriptForbidden());
67 // If you want V8 to autorun microtasks, this class needs to have a 67 // If you want V8 to autorun microtasks, this class needs to have a
68 // v8::Isolate::SuppressMicrotaskExecutionScope member. 68 // v8::Isolate::SuppressMicrotaskExecutionScope member.
69 ASSERT(!isolate->WillAutorunMicrotasks()); 69 ASSERT(!isolate->WillAutorunMicrotasks());
70 } 70 }
71 71
72 ~V8RecursionScope() 72 ~V8RecursionScope()
73 { 73 {
74 if (!V8PerIsolateData::from(m_isolate)->decrementRecursionLevel()) 74 if (!V8PerIsolateData::from(m_isolate)->decrementRecursionLevel())
75 didLeaveScriptContext(); 75 didLeaveScriptContext();
76 } 76 }
(...skipping 10 matching lines...) Expand all
87 } 87 }
88 #endif 88 #endif
89 89
90 class MicrotaskSuppression { 90 class MicrotaskSuppression {
91 public: 91 public:
92 MicrotaskSuppression(v8::Isolate* isolate) 92 MicrotaskSuppression(v8::Isolate* isolate)
93 #if ENABLE(ASSERT) 93 #if ENABLE(ASSERT)
94 : m_isolate(isolate) 94 : m_isolate(isolate)
95 #endif 95 #endif
96 { 96 {
97 ASSERT(!ScriptForbiddenScope::isScriptForbidden()); 97 ASSERT(!ScriptForbiddenScope::isScriptForbidden());
haraken 2014/10/14 01:09:17 Can we try to make this RELEASE_ASSERT in a follow
dcheng 2014/10/14 05:47:30 I think it makes sense to try this, but I would li
98 #if ENABLE(ASSERT) 98 #if ENABLE(ASSERT)
99 V8PerIsolateData::from(m_isolate)->incrementInternalScriptRecursionL evel(); 99 V8PerIsolateData::from(m_isolate)->incrementInternalScriptRecursionL evel();
100 #endif 100 #endif
101 } 101 }
102 102
103 ~MicrotaskSuppression() 103 ~MicrotaskSuppression()
104 { 104 {
105 #if ENABLE(ASSERT) 105 #if ENABLE(ASSERT)
106 V8PerIsolateData::from(m_isolate)->decrementInternalScriptRecursionL evel(); 106 V8PerIsolateData::from(m_isolate)->decrementInternalScriptRecursionL evel();
107 #endif 107 #endif
108 } 108 }
109 109
110 private: 110 private:
111 #if ENABLE(ASSERT) 111 #if ENABLE(ASSERT)
112 v8::Isolate* m_isolate; 112 v8::Isolate* m_isolate;
113 #endif 113 #endif
114 }; 114 };
115 115
116 private: 116 private:
117 void didLeaveScriptContext(); 117 void didLeaveScriptContext();
118 118
119 v8::Isolate* m_isolate; 119 v8::Isolate* m_isolate;
120 }; 120 };
121 121
122 } // namespace blink 122 } // namespace blink
123 123
124 #endif // V8RecursionScope_h 124 #endif // V8RecursionScope_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698