Commit b65e8848 authored by Gabriel Charette's avatar Gabriel Charette Committed by Commit Bot

[TaskScheduler] DCHECK no TrackedRef obtained after count has already reached zero.

Follow-up to https://crbug.com/827615#c17

R=fdoray@chromium.org, wez@chromium.org

Bug: 827615
Change-Id: I873b3eadd6be973b4e0d7b962d7cd720a663198e
Reviewed-on: https://chromium-review.googlesource.com/1020372
Commit-Queue: Gabriel Charette <gab@chromium.org>
Reviewed-by: default avatarWez <wez@chromium.org>
Reviewed-by: default avatarFrançois Doray <fdoray@chromium.org>
Cr-Commit-Position: refs/heads/master@{#552241}
parent 78206a88
...@@ -137,7 +137,14 @@ class TrackedRefFactory { ...@@ -137,7 +137,14 @@ class TrackedRefFactory {
ready_to_destroy_->Wait(); ready_to_destroy_->Wait();
} }
TrackedRef<T> GetTrackedRef() { return TrackedRef<T>(ptr_, this); } TrackedRef<T> GetTrackedRef() {
// TrackedRefs cannot be obtained after |live_tracked_refs_| has already
// reached zero. In other words, the owner of a TrackedRefFactory shouldn't
// vend new TrackedRefs while it's being destroyed (owners of TrackedRefs
// may still copy/move their refs around during the destruction phase).
DCHECK(!live_tracked_refs_.IsZero());
return TrackedRef<T>(ptr_, this);
}
private: private:
friend class TrackedRef<T>; friend class TrackedRef<T>;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment