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

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

Issue 1397073002: [Oilpan] Create UnsafePtr to store on-heap pointers in Vector (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Work for nits Created 5 years, 2 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 | « third_party/WebKit/Source/platform/heap/Handle.h ('k') | 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) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 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 25 matching lines...) Expand all
36 #include "platform/heap/HeapPage.h" 36 #include "platform/heap/HeapPage.h"
37 #include "platform/heap/ThreadState.h" 37 #include "platform/heap/ThreadState.h"
38 #include "platform/heap/Visitor.h" 38 #include "platform/heap/Visitor.h"
39 #include "wtf/AddressSanitizer.h" 39 #include "wtf/AddressSanitizer.h"
40 #include "wtf/Assertions.h" 40 #include "wtf/Assertions.h"
41 #include "wtf/Atomics.h" 41 #include "wtf/Atomics.h"
42 #include "wtf/Forward.h" 42 #include "wtf/Forward.h"
43 43
44 namespace blink { 44 namespace blink {
45 45
46 template<typename T> class Member;
47 template<typename T> class WeakMember;
48 template<typename T> class UntracedMember;
49
46 template<typename T, bool = NeedsAdjustAndMark<T>::value> class ObjectAliveTrait ; 50 template<typename T, bool = NeedsAdjustAndMark<T>::value> class ObjectAliveTrait ;
47 51
48 template<typename T> 52 template<typename T>
49 class ObjectAliveTrait<T, false> { 53 class ObjectAliveTrait<T, false> {
50 public: 54 public:
51 static bool isHeapObjectAlive(T* object) 55 static bool isHeapObjectAlive(T* object)
52 { 56 {
53 static_assert(sizeof(T), "T must be fully defined"); 57 static_assert(sizeof(T), "T must be fully defined");
54 return HeapObjectHeader::fromPayload(object)->isMarked(); 58 return HeapObjectHeader::fromPayload(object)->isMarked();
55 } 59 }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 static inline bool isHeapObjectAlive(const Member<T>& member) 97 static inline bool isHeapObjectAlive(const Member<T>& member)
94 { 98 {
95 return isHeapObjectAlive(member.get()); 99 return isHeapObjectAlive(member.get());
96 } 100 }
97 template<typename T> 101 template<typename T>
98 static inline bool isHeapObjectAlive(const WeakMember<T>& member) 102 static inline bool isHeapObjectAlive(const WeakMember<T>& member)
99 { 103 {
100 return isHeapObjectAlive(member.get()); 104 return isHeapObjectAlive(member.get());
101 } 105 }
102 template<typename T> 106 template<typename T>
107 static inline bool isHeapObjectAlive(const UntracedMember<T>& member)
108 {
109 return isHeapObjectAlive(member.get());
110 }
111 template<typename T>
103 static inline bool isHeapObjectAlive(const RawPtr<T>& ptr) 112 static inline bool isHeapObjectAlive(const RawPtr<T>& ptr)
104 { 113 {
105 return isHeapObjectAlive(ptr.get()); 114 return isHeapObjectAlive(ptr.get());
106 } 115 }
107 116
108 // Is the finalizable GC object still alive, but slated for lazy sweeping? 117 // Is the finalizable GC object still alive, but slated for lazy sweeping?
109 // If a lazy sweep is in progress, returns true if the object was found 118 // If a lazy sweep is in progress, returns true if the object was found
110 // to be not reachable during the marking phase, but it has yet to be swept 119 // to be not reachable during the marking phase, but it has yet to be swept
111 // and finalized. The predicate returns false in all other cases. 120 // and finalized. The predicate returns false in all other cases.
112 // 121 //
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 void VisitorHelper<Derived>::handleWeakCell(Visitor* self, void* object) 517 void VisitorHelper<Derived>::handleWeakCell(Visitor* self, void* object)
509 { 518 {
510 T** cell = reinterpret_cast<T**>(object); 519 T** cell = reinterpret_cast<T**>(object);
511 if (*cell && !ObjectAliveTrait<T>::isHeapObjectAlive(*cell)) 520 if (*cell && !ObjectAliveTrait<T>::isHeapObjectAlive(*cell))
512 *cell = nullptr; 521 *cell = nullptr;
513 } 522 }
514 523
515 } // namespace blink 524 } // namespace blink
516 525
517 #endif // Heap_h 526 #endif // Heap_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/heap/Handle.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698