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

Side by Side Diff: Source/platform/heap/Handle.h

Issue 319593004: Oilpan:Allow custom handling of classes that contain weak pointers that are embedded in collections. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Feedback from Haraken Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/platform/heap/Heap.h » ('j') | Source/platform/heap/Heap.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2014 Google Inc. All rights reserved. 2 * Copyright (C) 2014 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 1022 matching lines...) Expand 10 before | Expand all | Expand 10 after
1033 // FIXME: Similarly, there is no need for a distinction between PeekOutType 1033 // FIXME: Similarly, there is no need for a distinction between PeekOutType
1034 // and PassOutType without reference counting. 1034 // and PassOutType without reference counting.
1035 typedef T* PeekOutType; 1035 typedef T* PeekOutType;
1036 typedef T* PassOutType; 1036 typedef T* PassOutType;
1037 1037
1038 template<typename U> 1038 template<typename U>
1039 static void store(const U& value, WebCore::WeakMember<T>& storage) { storage = value; } 1039 static void store(const U& value, WebCore::WeakMember<T>& storage) { storage = value; }
1040 1040
1041 static PeekOutType peek(const WebCore::WeakMember<T>& value) { return value; } 1041 static PeekOutType peek(const WebCore::WeakMember<T>& value) { return value; }
1042 static PassOutType passOut(const WebCore::WeakMember<T>& value) { return val ue; } 1042 static PassOutType passOut(const WebCore::WeakMember<T>& value) { return val ue; }
1043 static bool shouldRemoveFromCollection(WebCore::Visitor* visitor, WebCore::W eakMember<T>& value) { return !visitor->isAlive(value); }
1044 static void traceInCollection(WebCore::Visitor* visitor, WebCore::WeakMember <T>& weakMember, WebCore::ShouldWeakPointersBeMarkedStrongly strongify)
1045 {
1046 if (strongify == WebCore::WeakPointersActStrong)
Mads Ager (chromium) 2014/06/06 09:59:16 In the heap tests code, it looks like you added a
Erik Corry 2014/06/06 12:37:21 That would go into a loop, since the visitor metho
1047 visitor->trace(reinterpret_cast<WebCore::Member<T>&>(weakMember)); / / Strongified visit.
1048 }
1043 }; 1049 };
1044 1050
1045 template<typename T> struct PtrHash<WebCore::Member<T> > : PtrHash<T*> { 1051 template<typename T> struct PtrHash<WebCore::Member<T> > : PtrHash<T*> {
1046 template<typename U> 1052 template<typename U>
1047 static unsigned hash(const U& key) { return PtrHash<T*>::hash(key); } 1053 static unsigned hash(const U& key) { return PtrHash<T*>::hash(key); }
1048 static bool equal(T* a, const WebCore::Member<T>& b) { return a == b; } 1054 static bool equal(T* a, const WebCore::Member<T>& b) { return a == b; }
1049 static bool equal(const WebCore::Member<T>& a, T* b) { return a == b; } 1055 static bool equal(const WebCore::Member<T>& a, T* b) { return a == b; }
1050 template<typename U, typename V> 1056 template<typename U, typename V>
1051 static bool equal(const U& a, const V& b) { return a == b; } 1057 static bool equal(const U& a, const V& b) { return a == b; }
1052 }; 1058 };
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
1147 struct NeedsTracing<ListHashSetNode<T, WebCore::HeapListHashSetAllocator<T, inli neCapacity> > *> { 1153 struct NeedsTracing<ListHashSetNode<T, WebCore::HeapListHashSetAllocator<T, inli neCapacity> > *> {
1148 // All heap allocated node pointers need visiting to keep the nodes alive, 1154 // All heap allocated node pointers need visiting to keep the nodes alive,
1149 // regardless of whether they contain pointers to other heap allocated 1155 // regardless of whether they contain pointers to other heap allocated
1150 // objects. 1156 // objects.
1151 static const bool value = true; 1157 static const bool value = true;
1152 }; 1158 };
1153 1159
1154 } // namespace WTF 1160 } // namespace WTF
1155 1161
1156 #endif 1162 #endif
OLDNEW
« no previous file with comments | « no previous file | Source/platform/heap/Heap.h » ('j') | Source/platform/heap/Heap.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698