| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008, 2009, 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2008, 2009, 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 WTF_MAKE_NONCOPYABLE(ScriptStateProtectedPtr); | 102 WTF_MAKE_NONCOPYABLE(ScriptStateProtectedPtr); |
| 103 public: | 103 public: |
| 104 ScriptStateProtectedPtr() | 104 ScriptStateProtectedPtr() |
| 105 : m_scriptState(0) | 105 : m_scriptState(0) |
| 106 { | 106 { |
| 107 } | 107 } |
| 108 | 108 |
| 109 ScriptStateProtectedPtr(ScriptState* scriptState) | 109 ScriptStateProtectedPtr(ScriptState* scriptState) |
| 110 : m_scriptState(scriptState) | 110 : m_scriptState(scriptState) |
| 111 { | 111 { |
| 112 v8::HandleScope handleScope; | 112 v8::HandleScope handleScope(scriptState->isolate()); |
| 113 // Keep the context from being GC'ed. ScriptState is guaranteed to be li
ve while the context is live. | 113 // Keep the context from being GC'ed. ScriptState is guaranteed to be li
ve while the context is live. |
| 114 m_context.set(scriptState->isolate(), scriptState->context()); | 114 m_context.set(scriptState->isolate(), scriptState->context()); |
| 115 } | 115 } |
| 116 | 116 |
| 117 ScriptState* get() const { return m_scriptState; } | 117 ScriptState* get() const { return m_scriptState; } |
| 118 | 118 |
| 119 private: | 119 private: |
| 120 ScriptState* m_scriptState; | 120 ScriptState* m_scriptState; |
| 121 ScopedPersistent<v8::Context> m_context; | 121 ScopedPersistent<v8::Context> m_context; |
| 122 }; | 122 }; |
| 123 | 123 |
| 124 ScriptState* mainWorldScriptState(Frame*); | 124 ScriptState* mainWorldScriptState(Frame*); |
| 125 | 125 |
| 126 ScriptState* scriptStateFromWorkerGlobalScope(WorkerGlobalScope*); | 126 ScriptState* scriptStateFromWorkerGlobalScope(WorkerGlobalScope*); |
| 127 | 127 |
| 128 } | 128 } |
| 129 | 129 |
| 130 #endif // ScriptState_h | 130 #endif // ScriptState_h |
| OLD | NEW |