Index: cc/base/delayed_unique_notifier.cc |
diff --git a/cc/base/delayed_unique_notifier.cc b/cc/base/delayed_unique_notifier.cc |
index c2972677da6fafcb2a4e4b935c4c8b5a0d7b179c..1824226c2a6d19838d817c06a0824714784ff00e 100644 |
--- a/cc/base/delayed_unique_notifier.cc |
+++ b/cc/base/delayed_unique_notifier.cc |
@@ -43,6 +43,15 @@ void DelayedUniqueNotifier::Cancel() { |
next_notification_time_ = base::TimeTicks(); |
} |
+void DelayedUniqueNotifier::Shutdown() { |
+ // This function must destroy any weak ptrs since after being cancelled, this |
+ // class may be destroyed on another thread during compositor shutdown. |
+ weak_ptr_factory_.InvalidateWeakPtrs(); |
+ // Deliberately leaves notification_pending_ = true forever so new tasks with |
+ // weak ptrs can not be created. |
+ notification_pending_ = true; |
+} |
+ |
bool DelayedUniqueNotifier::HasPendingNotification() const { |
return notification_pending_ && !next_notification_time_.is_null(); |
} |