| 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 14 matching lines...) Expand all Loading... |
| 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 DOMWrapperWorld_h | 31 #ifndef DOMWrapperWorld_h |
| 32 #define DOMWrapperWorld_h | 32 #define DOMWrapperWorld_h |
| 33 | 33 |
| 34 #include "bindings/core/v8/ScriptState.h" | 34 #include "bindings/core/v8/ScriptState.h" |
| 35 #include "wtf/HashSet.h" |
| 35 #include "wtf/MainThread.h" | 36 #include "wtf/MainThread.h" |
| 36 #include "wtf/PassRefPtr.h" | 37 #include "wtf/PassRefPtr.h" |
| 37 #include "wtf/RefCounted.h" | 38 #include "wtf/RefCounted.h" |
| 38 #include "wtf/RefPtr.h" | 39 #include "wtf/RefPtr.h" |
| 39 #include "wtf/text/WTFString.h" | 40 #include "wtf/text/WTFString.h" |
| 40 #include <v8.h> | 41 #include <v8.h> |
| 41 | 42 |
| 42 namespace blink { | 43 namespace blink { |
| 43 | 44 |
| 44 class DOMDataStore; | 45 class DOMDataStore; |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 return adoptPtr(new DOMObjectHolder(isolate, object, wrapper)); | 135 return adoptPtr(new DOMObjectHolder(isolate, object, wrapper)); |
| 135 } | 136 } |
| 136 | 137 |
| 137 private: | 138 private: |
| 138 DOMObjectHolder(v8::Isolate* isolate, T* object, v8::Handle<v8::Value> w
rapper) | 139 DOMObjectHolder(v8::Isolate* isolate, T* object, v8::Handle<v8::Value> w
rapper) |
| 139 : DOMObjectHolderBase(isolate, wrapper) | 140 : DOMObjectHolderBase(isolate, wrapper) |
| 140 , m_object(object) | 141 , m_object(object) |
| 141 { | 142 { |
| 142 } | 143 } |
| 143 | 144 |
| 144 Persistent<T> m_object; | 145 OwnPtr<T> m_object; |
| 145 }; | 146 }; |
| 146 | 147 |
| 147 public: | 148 public: |
| 148 template<typename T> | 149 template<typename T> |
| 149 void registerDOMObjectHolder(v8::Isolate* isolate, T* object, v8::Handle<v8:
:Value> wrapper) | 150 void registerDOMObjectHolder(v8::Isolate* isolate, T* object, v8::Handle<v8:
:Value> wrapper) |
| 150 { | 151 { |
| 151 registerDOMObjectHolderInternal(DOMObjectHolder<T>::create(isolate, obje
ct, wrapper)); | 152 registerDOMObjectHolderInternal(DOMObjectHolder<T>::create(isolate, obje
ct, wrapper)); |
| 152 } | 153 } |
| 153 | 154 |
| 154 private: | 155 private: |
| 155 DOMWrapperWorld(int worldId, int extensionGroup); | 156 DOMWrapperWorld(int worldId, int extensionGroup); |
| 156 | 157 |
| 157 static void weakCallbackForDOMObjectHolder(const v8::WeakCallbackData<v8::Va
lue, DOMObjectHolderBase>&); | 158 static void weakCallbackForDOMObjectHolder(const v8::WeakCallbackData<v8::Va
lue, DOMObjectHolderBase>&); |
| 158 void registerDOMObjectHolderInternal(PassOwnPtr<DOMObjectHolderBase>); | 159 void registerDOMObjectHolderInternal(PassOwnPtr<DOMObjectHolderBase>); |
| 159 void unregisterDOMObjectHolder(DOMObjectHolderBase*); | 160 void unregisterDOMObjectHolder(DOMObjectHolderBase*); |
| 160 | 161 |
| 161 static unsigned isolatedWorldCount; | 162 static unsigned isolatedWorldCount; |
| 162 static DOMWrapperWorld* worldOfInitializingWindow; | 163 static DOMWrapperWorld* worldOfInitializingWindow; |
| 163 | 164 |
| 164 const int m_worldId; | 165 const int m_worldId; |
| 165 const int m_extensionGroup; | 166 const int m_extensionGroup; |
| 166 OwnPtr<DOMDataStore> m_domDataStore; | 167 OwnPtr<DOMDataStore> m_domDataStore; |
| 167 HashSet<OwnPtr<DOMObjectHolderBase> > m_domObjectHolders; | 168 HashSet<OwnPtr<DOMObjectHolderBase> > m_domObjectHolders; |
| 168 }; | 169 }; |
| 169 | 170 |
| 170 } // namespace blink | 171 } // namespace blink |
| 171 | 172 |
| 172 #endif // DOMWrapperWorld_h | 173 #endif // DOMWrapperWorld_h |
| OLD | NEW |