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

Unified Diff: Source/platform/AsyncMethodRunner.h

Issue 1108663002: Do not invoke async method on a GC-unreachable object. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Clarify that added is-alive check will be redundant once object is on the heap Created 5 years, 8 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/AsyncMethodRunner.h
diff --git a/Source/platform/AsyncMethodRunner.h b/Source/platform/AsyncMethodRunner.h
index 41201d131ad19c46a1f66d799023da7a1b3ab0ed..a496b53832b60fd04af01fcfe60e1a6269844891 100644
--- a/Source/platform/AsyncMethodRunner.h
+++ b/Source/platform/AsyncMethodRunner.h
@@ -120,11 +120,18 @@ public:
}
private:
- void fired(Timer<AsyncMethodRunner<TargetClass>>*) { (m_object->*m_method)(); }
+ void fired(Timer<AsyncMethodRunner<TargetClass>>*)
+ {
+ // TODO(Oilpan): when AsyncMethodRunner is on the heap, this check becomes
+ // redundant; handled directly by Timer<> instead.
+ if (!TimerIsObjectAliveTrait<TargetClass>::isHeapObjectAlive(m_object))
+ return;
+ (m_object->*m_method)();
+ }
Timer<AsyncMethodRunner<TargetClass>> m_timer;
- // FIXME: oilpan: AsyncMethodRunner should be moved to the heap and m_object should be traced.
+ // TODO(Oilpan): AsyncMethodRunner should be moved to the heap and m_object should be traced.
// This raw pointer is safe as long as AsyncMethodRunner<X> is held by the X itself
// (That's the case in the current code base).
GC_PLUGIN_IGNORE("363031")
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698