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

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

Issue 1265103003: Invalidate cross-thread persistents on heap termination. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: simplify the invalidation as ref-clearing Created 5 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « Source/platform/heap/PersistentNode.cpp ('k') | Source/platform/heap/ThreadState.cpp » ('j') | 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 526 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 537
538 void collectAndReportMarkSweepStats() const; 538 void collectAndReportMarkSweepStats() const;
539 void reportMarkSweepStats(const char* statsName, const ClassAgeCountsMap&) c onst; 539 void reportMarkSweepStats(const char* statsName, const ClassAgeCountsMap&) c onst;
540 #endif 540 #endif
541 541
542 void pushThreadLocalWeakCallback(void*, WeakCallback); 542 void pushThreadLocalWeakCallback(void*, WeakCallback);
543 bool popAndInvokeThreadLocalWeakCallback(Visitor*); 543 bool popAndInvokeThreadLocalWeakCallback(Visitor*);
544 void threadLocalWeakProcessing(); 544 void threadLocalWeakProcessing();
545 545
546 size_t objectPayloadSizeForTesting(); 546 size_t objectPayloadSizeForTesting();
547 void prepareHeapForTermination();
548 547
549 // Register the pre-finalizer for the |self| object. This method is normally 548 // Register the pre-finalizer for the |self| object. This method is normally
550 // called in the constructor of the |self| object. The class T must have 549 // called in the constructor of the |self| object. The class T must have
551 // USING_PRE_FINALIZER(). 550 // USING_PRE_FINALIZER().
552 template<typename T> 551 template<typename T>
553 void registerPreFinalizer(T* self) 552 void registerPreFinalizer(T* self)
554 { 553 {
555 static_assert(sizeof(&T::invokePreFinalizer) > 0, "USING_PRE_FINALIZER(T ) must be defined."); 554 static_assert(sizeof(&T::invokePreFinalizer) > 0, "USING_PRE_FINALIZER(T ) must be defined.");
556 ASSERT(checkThread()); 555 ASSERT(checkThread());
557 ASSERT(!sweepForbidden()); 556 ASSERT(!sweepForbidden());
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
698 // When ThreadState is detaching from non-main thread its 697 // When ThreadState is detaching from non-main thread its
699 // heap is expected to be empty (because it is going away). 698 // heap is expected to be empty (because it is going away).
700 // Perform registered cleanup tasks and garbage collection 699 // Perform registered cleanup tasks and garbage collection
701 // to sweep away any objects that are left on this heap. 700 // to sweep away any objects that are left on this heap.
702 // We assert that nothing must remain after this cleanup. 701 // We assert that nothing must remain after this cleanup.
703 // If assertion does not hold we crash as we are potentially 702 // If assertion does not hold we crash as we are potentially
704 // in the dangling pointer situation. 703 // in the dangling pointer situation.
705 void cleanup(); 704 void cleanup();
706 void cleanupPages(); 705 void cleanupPages();
707 706
707 void prepareForThreadStateTermination();
708
708 void invokePreFinalizers(); 709 void invokePreFinalizers();
709 710
710 void takeSnapshot(SnapshotType); 711 void takeSnapshot(SnapshotType);
711 #if ENABLE(GC_PROFILING) 712 #if ENABLE(GC_PROFILING)
712 void snapshotFreeList(); 713 void snapshotFreeList();
713 #endif 714 #endif
714 void clearHeapAges(); 715 void clearHeapAges();
715 int heapIndexOfVectorHeapLeastRecentlyExpanded(int beginHeapIndex, int endHe apIndex); 716 int heapIndexOfVectorHeapLeastRecentlyExpanded(int beginHeapIndex, int endHe apIndex);
716 717
717 using InterruptorVector = Vector<OwnPtr<Interruptor>>; 718 using InterruptorVector = Vector<OwnPtr<Interruptor>>;
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
802 }; 803 };
803 804
804 template<> class ThreadStateFor<AnyThread> { 805 template<> class ThreadStateFor<AnyThread> {
805 public: 806 public:
806 static ThreadState* state() { return ThreadState::current(); } 807 static ThreadState* state() { return ThreadState::current(); }
807 }; 808 };
808 809
809 } // namespace blink 810 } // namespace blink
810 811
811 #endif // ThreadState_h 812 #endif // ThreadState_h
OLDNEW
« no previous file with comments | « Source/platform/heap/PersistentNode.cpp ('k') | Source/platform/heap/ThreadState.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698