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

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

Issue 1909813002: Enable per thread heap for database thread (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 static inline bool isHeapObjectAlive(T* object) 195 static inline bool isHeapObjectAlive(T* object)
196 { 196 {
197 static_assert(sizeof(T), "T must be fully defined"); 197 static_assert(sizeof(T), "T must be fully defined");
198 // The strongification of collections relies on the fact that once a 198 // The strongification of collections relies on the fact that once a
199 // collection has been strongified, there is no way that it can contain 199 // collection has been strongified, there is no way that it can contain
200 // non-live entries, so no entries will be removed. Since you can't set 200 // non-live entries, so no entries will be removed. Since you can't set
201 // the mark bit on a null pointer, that means that null pointers are 201 // the mark bit on a null pointer, that means that null pointers are
202 // always 'alive'. 202 // always 'alive'.
203 if (!object) 203 if (!object)
204 return true; 204 return true;
205 // TODO(keishi): some tests create CrossThreadPersistent on non attached threads.
haraken 2016/05/24 16:15:28 Do you know what tests are doing that? But concep
206 DCHECK(!ThreadState::current() || &ThreadState::current()->heap() == &pa geFromObject(object)->arena()->getThreadState()->heap());
205 return ObjectAliveTrait<T>::isHeapObjectAlive(object); 207 return ObjectAliveTrait<T>::isHeapObjectAlive(object);
206 } 208 }
207 template<typename T> 209 template<typename T>
208 static inline bool isHeapObjectAlive(const Member<T>& member) 210 static inline bool isHeapObjectAlive(const Member<T>& member)
209 { 211 {
210 return isHeapObjectAlive(member.get()); 212 return isHeapObjectAlive(member.get());
211 } 213 }
212 template<typename T> 214 template<typename T>
213 static inline bool isHeapObjectAlive(const WeakMember<T>& member) 215 static inline bool isHeapObjectAlive(const WeakMember<T>& member)
214 { 216 {
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
594 void VisitorHelper<Derived>::handleWeakCell(Visitor* self, void* object) 596 void VisitorHelper<Derived>::handleWeakCell(Visitor* self, void* object)
595 { 597 {
596 T** cell = reinterpret_cast<T**>(object); 598 T** cell = reinterpret_cast<T**>(object);
597 if (*cell && !ObjectAliveTrait<T>::isHeapObjectAlive(*cell)) 599 if (*cell && !ObjectAliveTrait<T>::isHeapObjectAlive(*cell))
598 *cell = nullptr; 600 *cell = nullptr;
599 } 601 }
600 602
601 } // namespace blink 603 } // namespace blink
602 604
603 #endif // Heap_h 605 #endif // Heap_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698