| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 15 matching lines...) Expand all Loading... |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 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. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef V8PerContextData_h | 31 #ifndef V8PerContextData_h |
| 32 #define V8PerContextData_h | 32 #define V8PerContextData_h |
| 33 | 33 |
| 34 #include "bindings/v8/ScopedPersistent.h" | 34 #include "bindings/v8/ScopedPersistent.h" |
| 35 #include "bindings/v8/V8DOMActivityLogger.h" | 35 #include "bindings/v8/V8DOMActivityLogger.h" |
| 36 #include "bindings/v8/V8PerContextDebugData.h" |
| 36 #include "bindings/v8/WrapperTypeInfo.h" | 37 #include "bindings/v8/WrapperTypeInfo.h" |
| 37 #include <v8.h> | 38 #include <v8.h> |
| 38 #include "wtf/HashMap.h" | 39 #include "wtf/HashMap.h" |
| 39 #include "wtf/PassOwnPtr.h" | 40 #include "wtf/PassOwnPtr.h" |
| 40 #include "wtf/Vector.h" | 41 #include "wtf/Vector.h" |
| 41 | 42 |
| 42 namespace WebCore { | 43 namespace WebCore { |
| 43 | 44 |
| 44 struct V8NPObject; | 45 struct V8NPObject; |
| 45 typedef WTF::Vector<V8NPObject*> V8NPObjectVector; | 46 typedef WTF::Vector<V8NPObject*> V8NPObjectVector; |
| 46 typedef WTF::HashMap<int, V8NPObjectVector> V8NPObjectMap; | 47 typedef WTF::HashMap<int, V8NPObjectVector> V8NPObjectMap; |
| 47 | 48 |
| 48 enum V8ContextEmbedderDataField { | |
| 49 v8ContextDebugIdIndex, | |
| 50 v8ContextPerContextDataIndex, | |
| 51 v8ContextIsolatedWorld, | |
| 52 // Rather than adding more embedder data fields to v8::Context, | |
| 53 // consider adding the data to V8PerContextData instead. | |
| 54 }; | |
| 55 | |
| 56 class V8PerContextData { | 49 class V8PerContextData { |
| 57 public: | 50 public: |
| 58 static PassOwnPtr<V8PerContextData> create(v8::Persistent<v8::Context> conte
xt) | 51 static PassOwnPtr<V8PerContextData> create(v8::Persistent<v8::Context> conte
xt) |
| 59 { | 52 { |
| 60 return adoptPtr(new V8PerContextData(context)); | 53 return adoptPtr(new V8PerContextData(context)); |
| 61 } | 54 } |
| 62 | 55 |
| 63 ~V8PerContextData() | 56 ~V8PerContextData() |
| 64 { | 57 { |
| 65 dispose(); | 58 dispose(); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 V8NPObjectMap m_v8NPObjectMap; | 119 V8NPObjectMap m_v8NPObjectMap; |
| 127 // We cache a pointer to the V8DOMActivityLogger associated with the world | 120 // We cache a pointer to the V8DOMActivityLogger associated with the world |
| 128 // corresponding to this context. The ownership of the pointer is retained | 121 // corresponding to this context. The ownership of the pointer is retained |
| 129 // by the DOMActivityLoggerMap in DOMWrapperWorld. | 122 // by the DOMActivityLoggerMap in DOMWrapperWorld. |
| 130 V8DOMActivityLogger* m_activityLogger; | 123 V8DOMActivityLogger* m_activityLogger; |
| 131 v8::Persistent<v8::Context> m_context; | 124 v8::Persistent<v8::Context> m_context; |
| 132 ScopedPersistent<v8::Value> m_errorPrototype; | 125 ScopedPersistent<v8::Value> m_errorPrototype; |
| 133 ScopedPersistent<v8::Value> m_objectPrototype; | 126 ScopedPersistent<v8::Value> m_objectPrototype; |
| 134 }; | 127 }; |
| 135 | 128 |
| 136 class V8PerContextDebugData { | |
| 137 public: | |
| 138 static bool setContextDebugData(v8::Handle<v8::Context>, const char* worldNa
me, int debugId); | |
| 139 static int contextDebugId(v8::Handle<v8::Context>); | |
| 140 }; | |
| 141 | |
| 142 } // namespace WebCore | 129 } // namespace WebCore |
| 143 | 130 |
| 144 #endif // V8PerContextData_h | 131 #endif // V8PerContextData_h |
| OLD | NEW |