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

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

Issue 1190863003: Oilpan: Allocation should be allowed in pre-finalizers (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 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 | Annotate | Revision Log
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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 using Address = uint8_t*; 67 using Address = uint8_t*;
68 68
69 using FinalizationCallback = void (*)(void*); 69 using FinalizationCallback = void (*)(void*);
70 using VisitorCallback = void (*)(Visitor*, void* self); 70 using VisitorCallback = void (*)(Visitor*, void* self);
71 using TraceCallback = VisitorCallback; 71 using TraceCallback = VisitorCallback;
72 using WeakCallback = VisitorCallback; 72 using WeakCallback = VisitorCallback;
73 using EphemeronCallback = VisitorCallback; 73 using EphemeronCallback = VisitorCallback;
74 74
75 // Declare that a class has a pre-finalizer function. The function is called in 75 // Declare that a class has a pre-finalizer function. The function is called in
76 // the object's owner thread, and can access Member<>s to other 76 // the object's owner thread, and can access Member<>s to other
77 // garbage-collected objects allocated in the thread. However we must not 77 // garbage-collected objects allocated in the thread. However we must not
sof 2015/06/18 12:18:03 Could you update the documentation for prefinalize
haraken 2015/06/18 16:30:13 Done.
78 // allocate new garbage-collected objects, nor update Member<> and Persistent<> 78 // allocate new garbage-collected objects, nor update Member<> and Persistent<>
79 // pointers. 79 // pointers.
80 // 80 //
81 // This feature is similar to the HeapHashMap<WeakMember<Foo>, OwnPtr<Disposer>> 81 // This feature is similar to the HeapHashMap<WeakMember<Foo>, OwnPtr<Disposer>>
82 // idiom. The difference between this and the idiom is that pre-finalizer 82 // idiom. The difference between this and the idiom is that pre-finalizer
83 // function is called whenever an object is destructed with this feature. The 83 // function is called whenever an object is destructed with this feature. The
84 // HeapHashMap<WeakMember<Foo>, OwnPtr<Disposer>> idiom requires an assumption 84 // HeapHashMap<WeakMember<Foo>, OwnPtr<Disposer>> idiom requires an assumption
85 // that the HeapHashMap outlives objects pointed by WeakMembers. 85 // that the HeapHashMap outlives objects pointed by WeakMembers.
86 // FIXME: Replace all of the HeapHashMap<WeakMember<Foo>, OwnPtr<Disposer>> 86 // FIXME: Replace all of the HeapHashMap<WeakMember<Foo>, OwnPtr<Disposer>>
87 // idiom usages with the pre-finalizer if the replacement won't cause 87 // idiom usages with the pre-finalizer if the replacement won't cause
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 void incrementMarkedObjectsAge(); 522 void incrementMarkedObjectsAge();
523 523
524 void snapshotFreeListIfNecessary(); 524 void snapshotFreeListIfNecessary();
525 525
526 void collectAndReportMarkSweepStats() const; 526 void collectAndReportMarkSweepStats() const;
527 void reportMarkSweepStats(const char* statsName, const ClassAgeCountsMap&) c onst; 527 void reportMarkSweepStats(const char* statsName, const ClassAgeCountsMap&) c onst;
528 #endif 528 #endif
529 529
530 void pushThreadLocalWeakCallback(void*, WeakCallback); 530 void pushThreadLocalWeakCallback(void*, WeakCallback);
531 bool popAndInvokeThreadLocalWeakCallback(Visitor*); 531 bool popAndInvokeThreadLocalWeakCallback(Visitor*);
532 void threadLocalWeakProcessing();
532 533
533 size_t objectPayloadSizeForTesting(); 534 size_t objectPayloadSizeForTesting();
534 void prepareHeapForTermination(); 535 void prepareHeapForTermination();
535 536
536 // Request to call a pref-finalizer of the target object before the object 537 // Request to call a pref-finalizer of the target object before the object
537 // is destructed. The class T must have USING_PRE_FINALIZER(). The 538 // is destructed. The class T must have USING_PRE_FINALIZER(). The
538 // argument should be |*this|. Registering a lot of objects affects GC 539 // argument should be |*this|. Registering a lot of objects affects GC
539 // performance. We should register an object only if the object really 540 // performance. We should register an object only if the object really
540 // requires pre-finalizer, and we should unregister the object if 541 // requires pre-finalizer, and we should unregister the object if
541 // pre-finalizer is unnecessary. 542 // pre-finalizer is unnecessary.
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
772 }; 773 };
773 774
774 template<> class ThreadStateFor<AnyThread> { 775 template<> class ThreadStateFor<AnyThread> {
775 public: 776 public:
776 static ThreadState* state() { return ThreadState::current(); } 777 static ThreadState* state() { return ThreadState::current(); }
777 }; 778 };
778 779
779 } // namespace blink 780 } // namespace blink
780 781
781 #endif // ThreadState_h 782 #endif // ThreadState_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698