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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |
OLD | NEW |