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

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

Issue 318023002: Oilpan: Prepare to make ExecutionContext GarbageCollectedMixin. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: isGC 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 | « Source/modules/webdatabase/SQLCallbackWrapper.h ('k') | Source/platform/heap/HeapTest.cpp » ('j') | no next file with comments »
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 16 matching lines...) Expand all
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 Handle_h 31 #ifndef Handle_h
32 #define Handle_h 32 #define Handle_h
33 33
34 #include "platform/heap/Heap.h" 34 #include "platform/heap/Heap.h"
35 #include "platform/heap/ThreadState.h" 35 #include "platform/heap/ThreadState.h"
36 #include "platform/heap/Visitor.h" 36 #include "platform/heap/Visitor.h"
37 #include "wtf/Functional.h"
37 #include "wtf/HashFunctions.h" 38 #include "wtf/HashFunctions.h"
38 #include "wtf/Locker.h" 39 #include "wtf/Locker.h"
39 #include "wtf/RawPtr.h" 40 #include "wtf/RawPtr.h"
40 #include "wtf/RefCounted.h" 41 #include "wtf/RefCounted.h"
41 #include "wtf/TypeTraits.h" 42 #include "wtf/TypeTraits.h"
42 43
43 namespace WebCore { 44 namespace WebCore {
44 45
45 template<typename T> class HeapTerminatedArray; 46 template<typename T> class HeapTerminatedArray;
46 47
(...skipping 1098 matching lines...) Expand 10 before | Expand all | Expand 10 after
1145 }; 1146 };
1146 1147
1147 template<typename T, size_t inlineCapacity> 1148 template<typename T, size_t inlineCapacity>
1148 struct NeedsTracing<ListHashSetNode<T, WebCore::HeapListHashSetAllocator<T, inli neCapacity> > *> { 1149 struct NeedsTracing<ListHashSetNode<T, WebCore::HeapListHashSetAllocator<T, inli neCapacity> > *> {
1149 // All heap allocated node pointers need visiting to keep the nodes alive, 1150 // All heap allocated node pointers need visiting to keep the nodes alive,
1150 // regardless of whether they contain pointers to other heap allocated 1151 // regardless of whether they contain pointers to other heap allocated
1151 // objects. 1152 // objects.
1152 static const bool value = true; 1153 static const bool value = true;
1153 }; 1154 };
1154 1155
1156 // For wtf/Functional.h
1157 template<typename T, bool isGarbageCollected> struct PointerParamStorageTraits;
1158
1159 template<typename T> struct PointerParamStorageTraits<T*, false> {
1160 typedef T* StorageType;
1161
1162 static StorageType wrap(T* value) { return value; }
1163 static T* unwrap(const StorageType& value) { return value; }
1164 };
1165
1166 template<typename T> struct PointerParamStorageTraits<T*, true> {
1167 typedef WebCore::CrossThreadPersistent<T> StorageType;
1168
1169 static StorageType wrap(T* value) { return value; }
1170 static T* unwrap(const StorageType& value) { return value.get(); }
1171 };
1172
1173 // FIXME: This doesn't support collections and const types. See
1174 // COMPILE_ASSERT_IS_GARBAGE_COLLECTED.
1175 template<typename T> struct ParamStorageTraits<T*> : public PointerParamStorageT raits<T*, WTF::IsSubclassOfTemplate<T, WebCore::GarbageCollected>::value || WebC ore::IsGarbageCollectedMixin<T>::value> {
1176 };
1177
1178 // We assume RawPtr<T> is used only for garbage-collected types.
1179 template<typename T> struct ParamStorageTraits<RawPtr<T> > {
1180 typedef WebCore::CrossThreadPersistent<T> StorageType;
1181
1182 static StorageType wrap(RawPtr<T> value) { return value.get(); }
1183 static T* unwrap(const StorageType& value) { return value.get(); }
1184 };
1185
1155 } // namespace WTF 1186 } // namespace WTF
1156 1187
1157 #endif 1188 #endif
OLDNEW
« no previous file with comments | « Source/modules/webdatabase/SQLCallbackWrapper.h ('k') | Source/platform/heap/HeapTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698