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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 typedef WTF::Vector<V8NPObject*> V8NPObjectVector; | 54 typedef WTF::Vector<V8NPObject*> V8NPObjectVector; |
55 typedef WTF::HashMap<int, V8NPObjectVector> V8NPObjectMap; | 55 typedef WTF::HashMap<int, V8NPObjectVector> V8NPObjectMap; |
56 | 56 |
57 enum V8ContextEmbedderDataField { | 57 enum V8ContextEmbedderDataField { |
58 v8ContextDebugIdIndex = static_cast<int>(gin::kDebugIdIndex), | 58 v8ContextDebugIdIndex = static_cast<int>(gin::kDebugIdIndex), |
59 v8ContextPerContextDataIndex = static_cast<int>(gin::kPerContextDataStartInd
ex + gin::kEmbedderBlink), | 59 v8ContextPerContextDataIndex = static_cast<int>(gin::kPerContextDataStartInd
ex + gin::kEmbedderBlink), |
60 }; | 60 }; |
61 | 61 |
62 class V8PerContextData { | 62 class V8PerContextData { |
63 public: | 63 public: |
64 static PassOwnPtr<V8PerContextData> create(v8::Handle<v8::Context> context,
DOMWrapperWorld* world) | 64 static PassOwnPtr<V8PerContextData> create(v8::Handle<v8::Context> context,
PassRefPtr<DOMWrapperWorld> world) |
65 { | 65 { |
66 return adoptPtr(new V8PerContextData(context, world)); | 66 return adoptPtr(new V8PerContextData(context, world)); |
67 } | 67 } |
68 | 68 |
69 static V8PerContextData* from(v8::Handle<v8::Context>); | 69 static V8PerContextData* from(v8::Handle<v8::Context>); |
70 static DOMWrapperWorld* world(v8::Handle<v8::Context>); | 70 static DOMWrapperWorld* world(v8::Handle<v8::Context>); |
71 | 71 |
72 ~V8PerContextData(); | 72 ~V8PerContextData(); |
73 | 73 |
74 v8::Handle<v8::Context> context() { return m_context.newLocal(m_isolate); } | 74 v8::Handle<v8::Context> context() { return m_context.newLocal(m_isolate); } |
(...skipping 19 matching lines...) Expand all Loading... |
94 | 94 |
95 V8NPObjectMap* v8NPObjectMap() { return &m_v8NPObjectMap; } | 95 V8NPObjectMap* v8NPObjectMap() { return &m_v8NPObjectMap; } |
96 V8DOMActivityLogger* activityLogger() { return m_activityLogger; } | 96 V8DOMActivityLogger* activityLogger() { return m_activityLogger; } |
97 void setActivityLogger(V8DOMActivityLogger* logger) { m_activityLogger = log
ger; } | 97 void setActivityLogger(V8DOMActivityLogger* logger) { m_activityLogger = log
ger; } |
98 | 98 |
99 void addCustomElementBinding(CustomElementDefinition*, PassOwnPtr<CustomElem
entBinding>); | 99 void addCustomElementBinding(CustomElementDefinition*, PassOwnPtr<CustomElem
entBinding>); |
100 void clearCustomElementBinding(CustomElementDefinition*); | 100 void clearCustomElementBinding(CustomElementDefinition*); |
101 CustomElementBinding* customElementBinding(CustomElementDefinition*); | 101 CustomElementBinding* customElementBinding(CustomElementDefinition*); |
102 | 102 |
103 private: | 103 private: |
104 V8PerContextData(v8::Handle<v8::Context>, DOMWrapperWorld*); | 104 V8PerContextData(v8::Handle<v8::Context>, PassRefPtr<DOMWrapperWorld>); |
105 | 105 |
106 v8::Local<v8::Object> createWrapperFromCacheSlowCase(const WrapperTypeInfo*)
; | 106 v8::Local<v8::Object> createWrapperFromCacheSlowCase(const WrapperTypeInfo*)
; |
107 v8::Local<v8::Function> constructorForTypeSlowCase(const WrapperTypeInfo*); | 107 v8::Local<v8::Function> constructorForTypeSlowCase(const WrapperTypeInfo*); |
108 | 108 |
109 // For each possible type of wrapper, we keep a boilerplate object. | 109 // For each possible type of wrapper, we keep a boilerplate object. |
110 // The boilerplate is used to create additional wrappers of the same type. | 110 // The boilerplate is used to create additional wrappers of the same type. |
111 typedef WTF::HashMap<const WrapperTypeInfo*, UnsafePersistent<v8::Object> >
WrapperBoilerplateMap; | 111 typedef WTF::HashMap<const WrapperTypeInfo*, UnsafePersistent<v8::Object> >
WrapperBoilerplateMap; |
112 WrapperBoilerplateMap m_wrapperBoilerplates; | 112 WrapperBoilerplateMap m_wrapperBoilerplates; |
113 | 113 |
114 typedef WTF::HashMap<const WrapperTypeInfo*, UnsafePersistent<v8::Function>
> ConstructorMap; | 114 typedef WTF::HashMap<const WrapperTypeInfo*, UnsafePersistent<v8::Function>
> ConstructorMap; |
(...skipping 17 matching lines...) Expand all Loading... |
132 | 132 |
133 class V8PerContextDebugData { | 133 class V8PerContextDebugData { |
134 public: | 134 public: |
135 static bool setContextDebugData(v8::Handle<v8::Context>, const char* worldNa
me, int debugId); | 135 static bool setContextDebugData(v8::Handle<v8::Context>, const char* worldNa
me, int debugId); |
136 static int contextDebugId(v8::Handle<v8::Context>); | 136 static int contextDebugId(v8::Handle<v8::Context>); |
137 }; | 137 }; |
138 | 138 |
139 } // namespace WebCore | 139 } // namespace WebCore |
140 | 140 |
141 #endif // V8PerContextData_h | 141 #endif // V8PerContextData_h |
OLD | NEW |