Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(69)

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/DOMDataStore.h

Issue 1873323002: Have bindings layer assume and insist that all interface types are GCed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 ASSERT(wrappable); 208 ASSERT(wrappable);
209 ASSERT(!wrappable->containsWrapper() || !wrappable->isEqualTo(holder) || current(v8::Isolate::GetCurrent()).m_isMainWorld); 209 ASSERT(!wrappable->containsWrapper() || !wrappable->isEqualTo(holder) || current(v8::Isolate::GetCurrent()).m_isMainWorld);
210 return wrappable->isEqualTo(holder); 210 return wrappable->isEqualTo(holder);
211 } 211 }
212 212
213 bool m_isMainWorld; 213 bool m_isMainWorld;
214 OwnPtr<DOMWrapperMap<ScriptWrappable>> m_wrapperMap; 214 OwnPtr<DOMWrapperMap<ScriptWrappable>> m_wrapperMap;
215 }; 215 };
216 216
217 template<> 217 template<>
218 inline void DOMWrapperMap<ScriptWrappable>::PersistentValueMapTraits::Dispose(v8 ::Isolate*, v8::Global<v8::Object> value, ScriptWrappable* key) 218 inline void DOMWrapperMap<ScriptWrappable>::PersistentValueMapTraits::Dispose(v8 ::Isolate*, v8::Global<v8::Object> value, ScriptWrappable*)
219 { 219 {
220 auto wrapperTypeInfo = toWrapperTypeInfo(value); 220 toWrapperTypeInfo(value)->wrapperDestroyed();
221 if (wrapperTypeInfo->isGarbageCollected())
222 wrapperTypeInfo->derefObject();
223 else
224 wrapperTypeInfo->derefObject(toScriptWrappable(value));
225 } 221 }
226 222
227 template<> 223 template<>
228 inline void DOMWrapperMap<ScriptWrappable>::PersistentValueMapTraits::DisposeWea k(const v8::WeakCallbackInfo<WeakCallbackDataType>& data) 224 inline void DOMWrapperMap<ScriptWrappable>::PersistentValueMapTraits::DisposeWea k(const v8::WeakCallbackInfo<WeakCallbackDataType>& data)
229 { 225 {
230 auto wrapperTypeInfo = reinterpret_cast<WrapperTypeInfo*>(data.GetInternalFi eld(v8DOMWrapperTypeIndex)); 226 auto wrapperTypeInfo = reinterpret_cast<WrapperTypeInfo*>(data.GetInternalFi eld(v8DOMWrapperTypeIndex));
231 if (wrapperTypeInfo->isGarbageCollected()) 227 wrapperTypeInfo->wrapperDestroyed();
232 wrapperTypeInfo->derefObject();
233 else
234 wrapperTypeInfo->derefObject(KeyFromWeakCallbackInfo(data));
235 } 228 }
236 229
237 } // namespace blink 230 } // namespace blink
238 231
239 #endif // DOMDataStore_h 232 #endif // DOMDataStore_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698