| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef ScriptState_h | 5 #ifndef ScriptState_h |
| 6 #define ScriptState_h | 6 #define ScriptState_h |
| 7 | 7 |
| 8 #include "bindings/core/v8/ScopedPersistent.h" | 8 #include "bindings/core/v8/ScopedPersistent.h" |
| 9 #include "bindings/core/v8/V8PerContextData.h" | 9 #include "bindings/core/v8/V8PerContextData.h" |
| 10 #include "wtf/RefCounted.h" | 10 #include "wtf/RefCounted.h" |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 // once you no longer need V8PerContextData. Otherwise, the v8::Context will
leak. | 102 // once you no longer need V8PerContextData. Otherwise, the v8::Context will
leak. |
| 103 OwnPtr<V8PerContextData> m_perContextData; | 103 OwnPtr<V8PerContextData> m_perContextData; |
| 104 | 104 |
| 105 bool m_globalObjectDetached; | 105 bool m_globalObjectDetached; |
| 106 }; | 106 }; |
| 107 | 107 |
| 108 class ScriptStateForTesting : public ScriptState { | 108 class ScriptStateForTesting : public ScriptState { |
| 109 public: | 109 public: |
| 110 static PassRefPtr<ScriptStateForTesting> create(v8::Handle<v8::Context>, Pas
sRefPtr<DOMWrapperWorld>); | 110 static PassRefPtr<ScriptStateForTesting> create(v8::Handle<v8::Context>, Pas
sRefPtr<DOMWrapperWorld>); |
| 111 | 111 |
| 112 virtual ExecutionContext* executionContext() const OVERRIDE; | 112 virtual ExecutionContext* executionContext() const override; |
| 113 virtual void setExecutionContext(ExecutionContext*) OVERRIDE; | 113 virtual void setExecutionContext(ExecutionContext*) override; |
| 114 | 114 |
| 115 private: | 115 private: |
| 116 ScriptStateForTesting(v8::Handle<v8::Context>, PassRefPtr<DOMWrapperWorld>); | 116 ScriptStateForTesting(v8::Handle<v8::Context>, PassRefPtr<DOMWrapperWorld>); |
| 117 | 117 |
| 118 ExecutionContext* m_executionContext; | 118 ExecutionContext* m_executionContext; |
| 119 }; | 119 }; |
| 120 | 120 |
| 121 // ScriptStateProtectingContext keeps the context associated with the ScriptStat
e alive. | 121 // ScriptStateProtectingContext keeps the context associated with the ScriptStat
e alive. |
| 122 // You need to call clear() once you no longer need the context. Otherwise, the
context will leak. | 122 // You need to call clear() once you no longer need the context. Otherwise, the
context will leak. |
| 123 class ScriptStateProtectingContext { | 123 class ScriptStateProtectingContext { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 139 } | 139 } |
| 140 | 140 |
| 141 private: | 141 private: |
| 142 RefPtr<ScriptState> m_scriptState; | 142 RefPtr<ScriptState> m_scriptState; |
| 143 ScopedPersistent<v8::Context> m_context; | 143 ScopedPersistent<v8::Context> m_context; |
| 144 }; | 144 }; |
| 145 | 145 |
| 146 } | 146 } |
| 147 | 147 |
| 148 #endif // ScriptState_h | 148 #endif // ScriptState_h |
| OLD | NEW |