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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 // other hand, if this method returns false, nothing is guaranteed (we might | 156 // other hand, if this method returns false, nothing is guaranteed (we might |
157 // be in the main world). | 157 // be in the main world). |
158 static bool CanUseMainWorldWrapper() { | 158 static bool CanUseMainWorldWrapper() { |
159 return !WTF::MayNotBeMainThread() && | 159 return !WTF::MayNotBeMainThread() && |
160 !DOMWrapperWorld::NonMainWorldsExistInMainThread(); | 160 !DOMWrapperWorld::NonMainWorldsExistInMainThread(); |
161 } | 161 } |
162 | 162 |
163 static bool HolderContainsWrapper(v8::Local<v8::Object> holder, | 163 static bool HolderContainsWrapper(v8::Local<v8::Object> holder, |
164 const ScriptWrappable* wrappable) { | 164 const ScriptWrappable* wrappable) { |
165 // Verify our assumptions about the main world. | 165 // Verify our assumptions about the main world. |
166 ASSERT(wrappable); | 166 DCHECK(wrappable); |
167 ASSERT(!wrappable->ContainsWrapper() || !wrappable->IsEqualTo(holder) || | 167 DCHECK(!wrappable->ContainsWrapper() || !wrappable->IsEqualTo(holder) || |
168 Current(v8::Isolate::GetCurrent()).is_main_world_); | 168 Current(v8::Isolate::GetCurrent()).is_main_world_); |
169 return wrappable->IsEqualTo(holder); | 169 return wrappable->IsEqualTo(holder); |
170 } | 170 } |
171 | 171 |
172 bool is_main_world_; | 172 bool is_main_world_; |
173 WTF::Optional<DOMWrapperMap<ScriptWrappable>> wrapper_map_; | 173 WTF::Optional<DOMWrapperMap<ScriptWrappable>> wrapper_map_; |
174 }; | 174 }; |
175 | 175 |
176 template <> | 176 template <> |
177 inline void DOMWrapperMap<ScriptWrappable>::PersistentValueMapTraits::Dispose( | 177 inline void DOMWrapperMap<ScriptWrappable>::PersistentValueMapTraits::Dispose( |
178 v8::Isolate*, | 178 v8::Isolate*, |
179 v8::Global<v8::Object> value, | 179 v8::Global<v8::Object> value, |
180 ScriptWrappable*) { | 180 ScriptWrappable*) { |
181 ToWrapperTypeInfo(value)->WrapperDestroyed(); | 181 ToWrapperTypeInfo(value)->WrapperDestroyed(); |
182 } | 182 } |
183 | 183 |
184 template <> | 184 template <> |
185 inline void | 185 inline void |
186 DOMWrapperMap<ScriptWrappable>::PersistentValueMapTraits::DisposeWeak( | 186 DOMWrapperMap<ScriptWrappable>::PersistentValueMapTraits::DisposeWeak( |
187 const v8::WeakCallbackInfo<WeakCallbackDataType>& data) { | 187 const v8::WeakCallbackInfo<WeakCallbackDataType>& data) { |
188 auto wrapper_type_info = reinterpret_cast<WrapperTypeInfo*>( | 188 auto wrapper_type_info = reinterpret_cast<WrapperTypeInfo*>( |
189 data.GetInternalField(kV8DOMWrapperTypeIndex)); | 189 data.GetInternalField(kV8DOMWrapperTypeIndex)); |
190 wrapper_type_info->WrapperDestroyed(); | 190 wrapper_type_info->WrapperDestroyed(); |
191 } | 191 } |
192 | 192 |
193 } // namespace blink | 193 } // namespace blink |
194 | 194 |
195 #endif // DOMDataStore_h | 195 #endif // DOMDataStore_h |
OLD | NEW |