Chromium Code Reviews| 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 52 // instrumentation is needed. ScriptController allocates V8RecursionScope for yo u. | 52 // instrumentation is needed. ScriptController allocates V8RecursionScope for yo u. |
| 53 // Calls of type (2) should always stack-allocate a V8RecursionScope in the same | 53 // Calls of type (2) should always stack-allocate a V8RecursionScope in the same |
| 54 // block as the call into script. Calls of type (3) should stack allocate a | 54 // block as the call into script. Calls of type (3) should stack allocate a |
| 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 V8RecursionScope(v8::Isolate* isolate, ExecutionContext* context) | 62 V8RecursionScope(v8::Isolate* isolate) |
|
haraken
2014/09/11 01:18:53
Add explicit.
jsbell
2014/09/11 22:14:51
Done.
| |
| 63 : m_isolate(isolate) | 63 : m_isolate(isolate) |
| 64 , m_executionContext(*context) | |
| 65 { | 64 { |
| 66 V8PerIsolateData::from(m_isolate)->incrementRecursionLevel(); | 65 V8PerIsolateData::from(m_isolate)->incrementRecursionLevel(); |
| 67 RELEASE_ASSERT(!ScriptForbiddenScope::isScriptForbidden()); | 66 RELEASE_ASSERT(!ScriptForbiddenScope::isScriptForbidden()); |
| 68 // 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 |
| 69 // v8::Isolate::SuppressMicrotaskExecutionScope member. | 68 // v8::Isolate::SuppressMicrotaskExecutionScope member. |
| 70 ASSERT(!isolate->WillAutorunMicrotasks()); | 69 ASSERT(!isolate->WillAutorunMicrotasks()); |
| 71 } | 70 } |
| 72 | 71 |
| 73 ~V8RecursionScope() | 72 ~V8RecursionScope() |
| 74 { | 73 { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 111 private: | 110 private: |
| 112 #if ENABLE(ASSERT) | 111 #if ENABLE(ASSERT) |
| 113 v8::Isolate* m_isolate; | 112 v8::Isolate* m_isolate; |
| 114 #endif | 113 #endif |
| 115 }; | 114 }; |
| 116 | 115 |
| 117 private: | 116 private: |
| 118 void didLeaveScriptContext(); | 117 void didLeaveScriptContext(); |
| 119 | 118 |
| 120 v8::Isolate* m_isolate; | 119 v8::Isolate* m_isolate; |
| 121 ExecutionContext& m_executionContext; | |
| 122 }; | 120 }; |
| 123 | 121 |
| 124 } // namespace blink | 122 } // namespace blink |
| 125 | 123 |
| 126 #endif // V8RecursionScope_h | 124 #endif // V8RecursionScope_h |
| OLD | NEW |