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

Unified Diff: Source/platform/Timer.h

Issue 850063002: Do not fire timers for finalizing objects. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Mark pages as lazily swept Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | Source/platform/heap/Heap.h » ('j') | Source/platform/heap/Heap.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/Timer.h
diff --git a/Source/platform/Timer.h b/Source/platform/Timer.h
index 58d96925a3673d41573c07d2b4229131645b83ad..54360dddb4f4582f419dec7ab4d1263d9bfbc615 100644
--- a/Source/platform/Timer.h
+++ b/Source/platform/Timer.h
@@ -122,7 +122,16 @@ public:
: m_object(o), m_function(f) { }
private:
- virtual void fired() override { (m_object->*m_function)(this); }
+ virtual void fired() override
+ {
+ // Oilpan: if a timer fires while Oilpan heaps are being lazily
+ // swept, it is not safe to proceed if the object is dead.
+ // Assume this timer will be stopped once the object is finalized.
+ if (IsGarbageCollectedType<TimerFiredClass>::value && !Heap::isFinalizedObjectAlive(m_object))
+ return;
+
+ (m_object->*m_function)(this);
+ }
// FIXME: oilpan: TimerBase should be moved to the heap and m_object should be traced.
// This raw pointer is safe as long as Timer<X> is held by the X itself (That's the case
« no previous file with comments | « no previous file | Source/platform/heap/Heap.h » ('j') | Source/platform/heap/Heap.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698