OLD | NEW |
(Empty) | |
| 1 // Copyright 2011, Google Inc. |
| 2 // All rights reserved. |
| 3 // |
| 4 // Redistribution and use in source and binary forms, with or without |
| 5 // modification, are permitted provided that the following conditions are |
| 6 // met: |
| 7 // |
| 8 // * Redistributions of source code must retain the above copyright |
| 9 // notice, this list of conditions and the following disclaimer. |
| 10 // * Redistributions in binary form must reproduce the above |
| 11 // copyright notice, this list of conditions and the following disclaimer |
| 12 // in the documentation and/or other materials provided with the |
| 13 // distribution. |
| 14 // * Neither the name of Google Inc. nor the names of its |
| 15 // contributors may be used to endorse or promote products derived from |
| 16 // this software without specific prior written permission. |
| 17 // |
| 18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 19 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 20 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 21 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 22 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 23 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 24 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 |
| 30 #ifndef DartIsolateState_h |
| 31 #define DartIsolateState_h |
| 32 |
| 33 #include <dart_api.h> |
| 34 |
| 35 namespace WebCore { |
| 36 |
| 37 struct DartIsolateLink; |
| 38 class ScriptExecutionContext; |
| 39 |
| 40 // This class manages Dart isolate state for this renderer process. It maintains
a stack of |
| 41 // isolates that are currently active on the main thread's stack frame. |
| 42 class DartIsolateState { |
| 43 public: |
| 44 // Creates a new isolate and sets it as the current. |
| 45 static Dart_Isolate create(ScriptExecutionContext*, void*); |
| 46 |
| 47 // Pushes the given isolate as the current one. |
| 48 static void push(Dart_Isolate); |
| 49 |
| 50 // Returns the currently active isolate. |
| 51 static Dart_Isolate current(); |
| 52 |
| 53 // Pops the currently active isolate and restores the previous one (if any). |
| 54 // Fails if no current isolate. |
| 55 static void pop(); |
| 56 |
| 57 // Shutdowns the given isolate. |
| 58 static void shutdown(Dart_Isolate); |
| 59 |
| 60 class Scope { |
| 61 public: |
| 62 explicit Scope(Dart_Isolate isolate) { push(isolate); } |
| 63 ~Scope() { pop(); } |
| 64 }; |
| 65 |
| 66 private: |
| 67 static void pushLink(Dart_Isolate); |
| 68 static void popLink(); |
| 69 |
| 70 static DartIsolateLink* m_current; |
| 71 }; |
| 72 |
| 73 } |
| 74 |
| 75 #endif // DartIsolateState_h |
OLD | NEW |