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

Unified Diff: third_party/WebKit/Source/platform/heap/ThreadState.h

Issue 2599533002: Introduce ThreadState::isOnThreadHeap() helper predicate. (Closed)
Patch Set: Created 4 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/platform/heap/Member.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/heap/ThreadState.h
diff --git a/third_party/WebKit/Source/platform/heap/ThreadState.h b/third_party/WebKit/Source/platform/heap/ThreadState.h
index a8c771b8db65a1b8b443db26b52c31adad5d5228..284a3de876ca52e6c0b12235a3698d34e5d7d520 100644
--- a/third_party/WebKit/Source/platform/heap/ThreadState.h
+++ b/third_party/WebKit/Source/platform/heap/ThreadState.h
@@ -573,6 +573,15 @@ class PLATFORM_EXPORT ThreadState {
static const char* gcReasonString(BlinkGC::GCReason);
+ // Returns |true| if |object| resides on this thread's heap.
+ // It is well-defined to call this method on any heap allocated
+ // reference, provided its associated heap hasn't been detached
+ // and shut down. Its behavior is undefined for any other pointer
+ // value.
+ bool isOnThreadHeap(const void* object) const {
+ return &fromObject(object)->heap() == &heap();
+ }
+
private:
template <typename T>
friend class PrefinalizerRegistration;
« no previous file with comments | « third_party/WebKit/Source/platform/heap/Member.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698