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 29 matching lines...) Expand all Loading... |
40 #include <v8.h> | 40 #include <v8.h> |
41 #include "wtf/HashMap.h" | 41 #include "wtf/HashMap.h" |
42 #include "wtf/PassOwnPtr.h" | 42 #include "wtf/PassOwnPtr.h" |
43 #include "wtf/Vector.h" | 43 #include "wtf/Vector.h" |
44 #include "wtf/text/AtomicString.h" | 44 #include "wtf/text/AtomicString.h" |
45 #include "wtf/text/AtomicStringHash.h" | 45 #include "wtf/text/AtomicStringHash.h" |
46 | 46 |
47 namespace WebCore { | 47 namespace WebCore { |
48 | 48 |
49 class CustomElementDefinition; | 49 class CustomElementDefinition; |
| 50 class V8DOMActivityLogger; |
50 class V8PerContextData; | 51 class V8PerContextData; |
51 struct V8NPObject; | 52 struct V8NPObject; |
52 typedef WTF::Vector<V8NPObject*> V8NPObjectVector; | 53 typedef WTF::Vector<V8NPObject*> V8NPObjectVector; |
53 typedef WTF::HashMap<int, V8NPObjectVector> V8NPObjectMap; | 54 typedef WTF::HashMap<int, V8NPObjectVector> V8NPObjectMap; |
54 | 55 |
55 enum V8ContextEmbedderDataField { | 56 enum V8ContextEmbedderDataField { |
56 v8ContextDebugIdIndex = static_cast<int>(gin::kDebugIdIndex), | 57 v8ContextDebugIdIndex = static_cast<int>(gin::kDebugIdIndex), |
57 v8ContextPerContextDataIndex = static_cast<int>(gin::kPerContextDataStartInd
ex + gin::kEmbedderBlink), | 58 v8ContextPerContextDataIndex = static_cast<int>(gin::kPerContextDataStartInd
ex + gin::kEmbedderBlink), |
58 }; | 59 }; |
59 | 60 |
(...skipping 23 matching lines...) Expand all Loading... |
83 } | 84 } |
84 | 85 |
85 v8::Local<v8::Object> prototypeForType(const WrapperTypeInfo*); | 86 v8::Local<v8::Object> prototypeForType(const WrapperTypeInfo*); |
86 | 87 |
87 V8NPObjectMap* v8NPObjectMap() { return &m_v8NPObjectMap; } | 88 V8NPObjectMap* v8NPObjectMap() { return &m_v8NPObjectMap; } |
88 | 89 |
89 void addCustomElementBinding(CustomElementDefinition*, PassOwnPtr<CustomElem
entBinding>); | 90 void addCustomElementBinding(CustomElementDefinition*, PassOwnPtr<CustomElem
entBinding>); |
90 void clearCustomElementBinding(CustomElementDefinition*); | 91 void clearCustomElementBinding(CustomElementDefinition*); |
91 CustomElementBinding* customElementBinding(CustomElementDefinition*); | 92 CustomElementBinding* customElementBinding(CustomElementDefinition*); |
92 | 93 |
| 94 V8DOMActivityLogger* activityLogger() const { return m_activityLogger; } |
| 95 void setActivityLogger(V8DOMActivityLogger* activityLogger) { m_activityLogg
er = activityLogger; } |
| 96 |
93 private: | 97 private: |
94 V8PerContextData(v8::Handle<v8::Context>); | 98 V8PerContextData(v8::Handle<v8::Context>); |
95 | 99 |
96 v8::Local<v8::Object> createWrapperFromCacheSlowCase(const WrapperTypeInfo*)
; | 100 v8::Local<v8::Object> createWrapperFromCacheSlowCase(const WrapperTypeInfo*)
; |
97 v8::Local<v8::Function> constructorForTypeSlowCase(const WrapperTypeInfo*); | 101 v8::Local<v8::Function> constructorForTypeSlowCase(const WrapperTypeInfo*); |
98 | 102 |
99 // For each possible type of wrapper, we keep a boilerplate object. | 103 // For each possible type of wrapper, we keep a boilerplate object. |
100 // The boilerplate is used to create additional wrappers of the same type. | 104 // The boilerplate is used to create additional wrappers of the same type. |
101 typedef V8PersistentValueMap<const WrapperTypeInfo*, v8::Object, false> Wrap
perBoilerplateMap; | 105 typedef V8PersistentValueMap<const WrapperTypeInfo*, v8::Object, false> Wrap
perBoilerplateMap; |
102 WrapperBoilerplateMap m_wrapperBoilerplates; | 106 WrapperBoilerplateMap m_wrapperBoilerplates; |
103 | 107 |
104 typedef V8PersistentValueMap<const WrapperTypeInfo*, v8::Function, false> Co
nstructorMap; | 108 typedef V8PersistentValueMap<const WrapperTypeInfo*, v8::Function, false> Co
nstructorMap; |
105 ConstructorMap m_constructorMap; | 109 ConstructorMap m_constructorMap; |
106 | 110 |
107 V8NPObjectMap m_v8NPObjectMap; | 111 V8NPObjectMap m_v8NPObjectMap; |
108 | 112 |
109 v8::Isolate* m_isolate; | 113 v8::Isolate* m_isolate; |
110 OwnPtr<gin::ContextHolder> m_contextHolder; | 114 OwnPtr<gin::ContextHolder> m_contextHolder; |
111 | 115 |
112 ScopedPersistent<v8::Context> m_context; | 116 ScopedPersistent<v8::Context> m_context; |
113 ScopedPersistent<v8::Value> m_errorPrototype; | 117 ScopedPersistent<v8::Value> m_errorPrototype; |
114 | 118 |
115 typedef WTF::HashMap<CustomElementDefinition*, OwnPtr<CustomElementBinding>
> CustomElementBindingMap; | 119 typedef WTF::HashMap<CustomElementDefinition*, OwnPtr<CustomElementBinding>
> CustomElementBindingMap; |
116 OwnPtr<CustomElementBindingMap> m_customElementBindings; | 120 OwnPtr<CustomElementBindingMap> m_customElementBindings; |
| 121 |
| 122 // This is owned by a static hash map in V8DOMActivityLogger. |
| 123 V8DOMActivityLogger* m_activityLogger; |
117 }; | 124 }; |
118 | 125 |
119 class V8PerContextDebugData { | 126 class V8PerContextDebugData { |
120 public: | 127 public: |
121 static bool setContextDebugData(v8::Handle<v8::Context>, const char* worldNa
me, int debugId); | 128 static bool setContextDebugData(v8::Handle<v8::Context>, const char* worldNa
me, int debugId); |
122 static int contextDebugId(v8::Handle<v8::Context>); | 129 static int contextDebugId(v8::Handle<v8::Context>); |
123 }; | 130 }; |
124 | 131 |
125 } // namespace WebCore | 132 } // namespace WebCore |
126 | 133 |
127 #endif // V8PerContextData_h | 134 #endif // V8PerContextData_h |
OLD | NEW |