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

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

Issue 1989153003: Limit WTF::getPtr() to native pointer types. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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
« no previous file with comments | « no previous file | no next file » | 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 22 matching lines...) Expand all
33 33
34 #include "platform/heap/Heap.h" 34 #include "platform/heap/Heap.h"
35 #include "platform/heap/HeapAllocator.h" 35 #include "platform/heap/HeapAllocator.h"
36 #include "platform/heap/InlinedGlobalMarkingVisitor.h" 36 #include "platform/heap/InlinedGlobalMarkingVisitor.h"
37 #include "platform/heap/PersistentNode.h" 37 #include "platform/heap/PersistentNode.h"
38 #include "platform/heap/ThreadState.h" 38 #include "platform/heap/ThreadState.h"
39 #include "platform/heap/TraceTraits.h" 39 #include "platform/heap/TraceTraits.h"
40 #include "platform/heap/Visitor.h" 40 #include "platform/heap/Visitor.h"
41 #include "wtf/Allocator.h" 41 #include "wtf/Allocator.h"
42 #include "wtf/Atomics.h" 42 #include "wtf/Atomics.h"
43 #include "wtf/Functional.h"
44 #include "wtf/HashFunctions.h" 43 #include "wtf/HashFunctions.h"
45 #include "wtf/TypeTraits.h" 44 #include "wtf/TypeTraits.h"
46 45
47 #if defined(LEAK_SANITIZER) 46 #if defined(LEAK_SANITIZER)
48 #include "wtf/LeakAnnotations.h" 47 #include "wtf/LeakAnnotations.h"
49 #endif 48 #endif
50 49
51 namespace blink { 50 namespace blink {
52 51
53 // Marker used to annotate persistent objects and collections with, 52 // Marker used to annotate persistent objects and collections with,
(...skipping 1099 matching lines...) Expand 10 before | Expand all | Expand 10 after
1153 STATIC_ONLY(NeedsTracing); 1152 STATIC_ONLY(NeedsTracing);
1154 static const bool value = true; 1153 static const bool value = true;
1155 }; 1154 };
1156 1155
1157 template<typename T> 1156 template<typename T>
1158 struct IsWeak<blink::WeakMember<T>> { 1157 struct IsWeak<blink::WeakMember<T>> {
1159 STATIC_ONLY(IsWeak); 1158 STATIC_ONLY(IsWeak);
1160 static const bool value = true; 1159 static const bool value = true;
1161 }; 1160 };
1162 1161
1163 template<typename T> inline T* getPtr(const blink::Member<T>& p)
1164 {
1165 return p.get();
1166 }
1167
1168 template<typename T> inline T* getPtr(const blink::Persistent<T>& p)
1169 {
1170 return p.get();
1171 }
1172
1173 // For wtf/Functional.h 1162 // For wtf/Functional.h
1174 template<typename T, bool isGarbageCollected> struct PointerParamStorageTraits; 1163 template<typename T, bool isGarbageCollected> struct PointerParamStorageTraits;
1175 1164
1176 // The condition of 'T must be fully defined' (except for void) is checked in 1165 // The condition of 'T must be fully defined' (except for void) is checked in
1177 // blink::IsGarbageCollectedType<T>::value. 1166 // blink::IsGarbageCollectedType<T>::value.
1178 template<typename T> 1167 template<typename T>
1179 struct PointerParamStorageTraits<T*, false> { 1168 struct PointerParamStorageTraits<T*, false> {
1180 STATIC_ONLY(PointerParamStorageTraits); 1169 STATIC_ONLY(PointerParamStorageTraits);
1181 using StorageType = T*; 1170 using StorageType = T*;
1182 1171
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
1226 // into it. 1215 // into it.
1227 // 1216 //
1228 // TODO(sof): remove this hack once wtf/Functional.h can also work with a ty pe like 1217 // TODO(sof): remove this hack once wtf/Functional.h can also work with a ty pe like
1229 // CrossThreadWeakPersistent<>. 1218 // CrossThreadWeakPersistent<>.
1230 static WeakPtr<T> unwrap(const StorageType& value) { return WeakPtr<T>(WeakR eference<T>::create(value.get())); } 1219 static WeakPtr<T> unwrap(const StorageType& value) { return WeakPtr<T>(WeakR eference<T>::create(value.get())); }
1231 }; 1220 };
1232 1221
1233 } // namespace WTF 1222 } // namespace WTF
1234 1223
1235 #endif 1224 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698