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 13 matching lines...) Expand all Loading... |
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
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/core/v8/CustomElementBinding.h" | |
35 #include "bindings/core/v8/ScopedPersistent.h" | 34 #include "bindings/core/v8/ScopedPersistent.h" |
| 35 #include "bindings/core/v8/V0CustomElementBinding.h" |
36 #include "bindings/core/v8/V8GlobalValueMap.h" | 36 #include "bindings/core/v8/V8GlobalValueMap.h" |
37 #include "bindings/core/v8/WrapperTypeInfo.h" | 37 #include "bindings/core/v8/WrapperTypeInfo.h" |
38 #include "core/CoreExport.h" | 38 #include "core/CoreExport.h" |
39 #include "gin/public/context_holder.h" | 39 #include "gin/public/context_holder.h" |
40 #include "gin/public/gin_embedders.h" | 40 #include "gin/public/gin_embedders.h" |
41 #include "wtf/Allocator.h" | 41 #include "wtf/Allocator.h" |
42 #include "wtf/HashMap.h" | 42 #include "wtf/HashMap.h" |
43 #include "wtf/PassOwnPtr.h" | 43 #include "wtf/PassOwnPtr.h" |
44 #include "wtf/Vector.h" | 44 #include "wtf/Vector.h" |
45 #include "wtf/text/AtomicString.h" | 45 #include "wtf/text/AtomicString.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 } | 77 } |
78 | 78 |
79 v8::Local<v8::Function> constructorForType(const WrapperTypeInfo* type) | 79 v8::Local<v8::Function> constructorForType(const WrapperTypeInfo* type) |
80 { | 80 { |
81 v8::Local<v8::Function> interfaceObject = m_constructorMap.Get(type); | 81 v8::Local<v8::Function> interfaceObject = m_constructorMap.Get(type); |
82 return (!interfaceObject.IsEmpty()) ? interfaceObject : constructorForTy
peSlowCase(type); | 82 return (!interfaceObject.IsEmpty()) ? interfaceObject : constructorForTy
peSlowCase(type); |
83 } | 83 } |
84 | 84 |
85 v8::Local<v8::Object> prototypeForType(const WrapperTypeInfo*); | 85 v8::Local<v8::Object> prototypeForType(const WrapperTypeInfo*); |
86 | 86 |
87 void addCustomElementBinding(PassOwnPtr<CustomElementBinding>); | 87 void addCustomElementBinding(PassOwnPtr<V0CustomElementBinding>); |
88 | 88 |
89 V8DOMActivityLogger* activityLogger() const { return m_activityLogger; } | 89 V8DOMActivityLogger* activityLogger() const { return m_activityLogger; } |
90 void setActivityLogger(V8DOMActivityLogger* activityLogger) { m_activityLogg
er = activityLogger; } | 90 void setActivityLogger(V8DOMActivityLogger* activityLogger) { m_activityLogg
er = activityLogger; } |
91 | 91 |
92 v8::Local<v8::Value> compiledPrivateScript(String); | 92 v8::Local<v8::Value> compiledPrivateScript(String); |
93 void setCompiledPrivateScript(String, v8::Local<v8::Value>); | 93 void setCompiledPrivateScript(String, v8::Local<v8::Value>); |
94 | 94 |
95 private: | 95 private: |
96 V8PerContextData(v8::Local<v8::Context>); | 96 V8PerContextData(v8::Local<v8::Context>); |
97 | 97 |
98 v8::Local<v8::Object> createWrapperFromCacheSlowCase(const WrapperTypeInfo*)
; | 98 v8::Local<v8::Object> createWrapperFromCacheSlowCase(const WrapperTypeInfo*)
; |
99 v8::Local<v8::Function> constructorForTypeSlowCase(const WrapperTypeInfo*); | 99 v8::Local<v8::Function> constructorForTypeSlowCase(const WrapperTypeInfo*); |
100 | 100 |
101 v8::Isolate* m_isolate; | 101 v8::Isolate* m_isolate; |
102 | 102 |
103 // For each possible type of wrapper, we keep a boilerplate object. | 103 // For each possible type of wrapper, we keep a boilerplate object. |
104 // 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. |
105 typedef V8GlobalValueMap<const WrapperTypeInfo*, v8::Object, v8::kNotWeak> W
rapperBoilerplateMap; | 105 typedef V8GlobalValueMap<const WrapperTypeInfo*, v8::Object, v8::kNotWeak> W
rapperBoilerplateMap; |
106 WrapperBoilerplateMap m_wrapperBoilerplates; | 106 WrapperBoilerplateMap m_wrapperBoilerplates; |
107 | 107 |
108 typedef V8GlobalValueMap<const WrapperTypeInfo*, v8::Function, v8::kNotWeak>
ConstructorMap; | 108 typedef V8GlobalValueMap<const WrapperTypeInfo*, v8::Function, v8::kNotWeak>
ConstructorMap; |
109 ConstructorMap m_constructorMap; | 109 ConstructorMap m_constructorMap; |
110 | 110 |
111 OwnPtr<gin::ContextHolder> m_contextHolder; | 111 OwnPtr<gin::ContextHolder> m_contextHolder; |
112 | 112 |
113 ScopedPersistent<v8::Context> m_context; | 113 ScopedPersistent<v8::Context> m_context; |
114 ScopedPersistent<v8::Value> m_errorPrototype; | 114 ScopedPersistent<v8::Value> m_errorPrototype; |
115 | 115 |
116 typedef Vector<OwnPtr<CustomElementBinding>> CustomElementBindingList; | 116 typedef Vector<OwnPtr<V0CustomElementBinding>> V0CustomElementBindingList; |
117 CustomElementBindingList m_customElementBindings; | 117 V0CustomElementBindingList m_customElementBindings; |
118 | 118 |
119 // This is owned by a static hash map in V8DOMActivityLogger. | 119 // This is owned by a static hash map in V8DOMActivityLogger. |
120 V8DOMActivityLogger* m_activityLogger; | 120 V8DOMActivityLogger* m_activityLogger; |
121 | 121 |
122 V8GlobalValueMap<String, v8::Value, v8::kNotWeak> m_compiledPrivateScript; | 122 V8GlobalValueMap<String, v8::Value, v8::kNotWeak> m_compiledPrivateScript; |
123 }; | 123 }; |
124 | 124 |
125 } // namespace blink | 125 } // namespace blink |
126 | 126 |
127 #endif // V8PerContextData_h | 127 #endif // V8PerContextData_h |
OLD | NEW |