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

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

Issue 2599533002: Introduce ThreadState::isOnThreadHeap() helper predicate. (Closed)
Patch Set: Created 3 years, 12 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/Member.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 555 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 DCHECK(!state->sweepForbidden()); 566 DCHECK(!state->sweepForbidden());
567 DCHECK(!state->m_orderedPreFinalizers.contains( 567 DCHECK(!state->m_orderedPreFinalizers.contains(
568 PreFinalizer(self, T::invokePreFinalizer))); 568 PreFinalizer(self, T::invokePreFinalizer)));
569 state->m_orderedPreFinalizers.add( 569 state->m_orderedPreFinalizers.add(
570 PreFinalizer(self, T::invokePreFinalizer)); 570 PreFinalizer(self, T::invokePreFinalizer));
571 } 571 }
572 }; 572 };
573 573
574 static const char* gcReasonString(BlinkGC::GCReason); 574 static const char* gcReasonString(BlinkGC::GCReason);
575 575
576 // Returns |true| if |object| resides on this thread's heap.
577 // It is well-defined to call this method on any heap allocated
578 // reference, provided its associated heap hasn't been detached
579 // and shut down. Its behavior is undefined for any other pointer
580 // value.
581 bool isOnThreadHeap(const void* object) const {
582 return &fromObject(object)->heap() == &heap();
583 }
584
576 private: 585 private:
577 template <typename T> 586 template <typename T>
578 friend class PrefinalizerRegistration; 587 friend class PrefinalizerRegistration;
579 enum SnapshotType { HeapSnapshot, FreelistSnapshot }; 588 enum SnapshotType { HeapSnapshot, FreelistSnapshot };
580 589
581 explicit ThreadState(BlinkGC::ThreadHeapMode); 590 explicit ThreadState(BlinkGC::ThreadHeapMode);
582 ~ThreadState(); 591 ~ThreadState();
583 592
584 NO_SANITIZE_ADDRESS void copyStackUntilSafePointScope(); 593 NO_SANITIZE_ADDRESS void copyStackUntilSafePointScope();
585 void clearSafePointScopeMarker() { 594 void clearSafePointScopeMarker() {
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
765 class ThreadStateFor<AnyThread> { 774 class ThreadStateFor<AnyThread> {
766 STATIC_ONLY(ThreadStateFor); 775 STATIC_ONLY(ThreadStateFor);
767 776
768 public: 777 public:
769 static ThreadState* state() { return ThreadState::current(); } 778 static ThreadState* state() { return ThreadState::current(); }
770 }; 779 };
771 780
772 } // namespace blink 781 } // namespace blink
773 782
774 #endif // ThreadState_h 783 #endif // ThreadState_h
OLDNEW
« 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