OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 public: | 130 public: |
131 DOMObjectHolderBase(v8::Isolate* isolate, v8::Handle<v8::Value> wrapper) | 131 DOMObjectHolderBase(v8::Isolate* isolate, v8::Handle<v8::Value> wrapper) |
132 : m_wrapper(isolate, wrapper) | 132 : m_wrapper(isolate, wrapper) |
133 , m_world(0) | 133 , m_world(0) |
134 { | 134 { |
135 } | 135 } |
136 virtual ~DOMObjectHolderBase() { } | 136 virtual ~DOMObjectHolderBase() { } |
137 | 137 |
138 DOMWrapperWorld* world() const { return m_world; } | 138 DOMWrapperWorld* world() const { return m_world; } |
139 void setWorld(DOMWrapperWorld* world) { m_world = world; } | 139 void setWorld(DOMWrapperWorld* world) { m_world = world; } |
140 void setWeak(void (*callback)(const v8::WeakCallbackData<v8::Value, DOMO
bjectHolderBase>&)) | 140 void setPhantom(void (*callback)(const v8::PhantomCallbackData<DOMObject
HolderBase>&)) |
141 { | 141 { |
142 m_wrapper.setWeak(this, callback); | 142 m_wrapper.setPhantom(this, callback); |
143 } | 143 } |
144 | 144 |
145 private: | 145 private: |
146 ScopedPersistent<v8::Value> m_wrapper; | 146 ScopedPersistent<v8::Value> m_wrapper; |
147 DOMWrapperWorld* m_world; | 147 DOMWrapperWorld* m_world; |
148 }; | 148 }; |
149 | 149 |
150 template<typename T> | 150 template<typename T> |
151 class DOMObjectHolder : public DOMObjectHolderBase { | 151 class DOMObjectHolder : public DOMObjectHolderBase { |
152 public: | 152 public: |
(...skipping 15 matching lines...) Expand all Loading... |
168 public: | 168 public: |
169 template<typename T> | 169 template<typename T> |
170 void registerDOMObjectHolder(v8::Isolate* isolate, T* object, v8::Handle<v8:
:Value> wrapper) | 170 void registerDOMObjectHolder(v8::Isolate* isolate, T* object, v8::Handle<v8:
:Value> wrapper) |
171 { | 171 { |
172 registerDOMObjectHolderInternal(DOMObjectHolder<T>::create(isolate, obje
ct, wrapper)); | 172 registerDOMObjectHolderInternal(DOMObjectHolder<T>::create(isolate, obje
ct, wrapper)); |
173 } | 173 } |
174 | 174 |
175 private: | 175 private: |
176 DOMWrapperWorld(v8::Isolate*, int worldId, int extensionGroup); | 176 DOMWrapperWorld(v8::Isolate*, int worldId, int extensionGroup); |
177 | 177 |
178 static void weakCallbackForDOMObjectHolder(const v8::WeakCallbackData<v8::Va
lue, DOMObjectHolderBase>&); | 178 static void phantomCallbackForDOMObjectHolder(const v8::PhantomCallbackData<
DOMObjectHolderBase>&); |
179 void registerDOMObjectHolderInternal(PassOwnPtr<DOMObjectHolderBase>); | 179 void registerDOMObjectHolderInternal(PassOwnPtr<DOMObjectHolderBase>); |
180 void unregisterDOMObjectHolder(DOMObjectHolderBase*); | 180 void unregisterDOMObjectHolder(DOMObjectHolderBase*); |
181 | 181 |
182 static unsigned isolatedWorldCount; | 182 static unsigned isolatedWorldCount; |
183 static DOMWrapperWorld* worldOfInitializingWindow; | 183 static DOMWrapperWorld* worldOfInitializingWindow; |
184 | 184 |
185 const int m_worldId; | 185 const int m_worldId; |
186 const int m_extensionGroup; | 186 const int m_extensionGroup; |
187 OwnPtr<DOMDataStore> m_domDataStore; | 187 OwnPtr<DOMDataStore> m_domDataStore; |
188 HashSet<OwnPtr<DOMObjectHolderBase> > m_domObjectHolders; | 188 HashSet<OwnPtr<DOMObjectHolderBase> > m_domObjectHolders; |
189 }; | 189 }; |
190 | 190 |
191 } // namespace blink | 191 } // namespace blink |
192 | 192 |
193 #endif // DOMWrapperWorld_h | 193 #endif // DOMWrapperWorld_h |
OLD | NEW |