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

Unified Diff: content/child/scheduler/task_queue_manager.h

Issue 1072473002: Speculative patch: Make it safe to delete the TQM inside a Task (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: responding to feedback 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
Index: content/child/scheduler/task_queue_manager.h
diff --git a/content/child/scheduler/task_queue_manager.h b/content/child/scheduler/task_queue_manager.h
index e8563ee6fd1bf369e9ba180383a388f91dd72eda..861ea07f84d0e9dc9f055eeeb7e476edd6a933d8 100644
--- a/content/child/scheduler/task_queue_manager.h
+++ b/content/child/scheduler/task_queue_manager.h
@@ -128,6 +128,12 @@ class CONTENT_EXPORT TaskQueueManager {
friend class internal::LazyNow;
friend class internal::TaskQueue;
+ class DeletionSentinel : public base::RefCounted<DeletionSentinel> {
+ private:
+ friend class base::RefCounted<DeletionSentinel>;
+ ~DeletionSentinel() {}
+ };
+
// Called by the task queue to register a new pending task and allocate a
// sequence number for it.
void DidQueueTask(base::PendingTask* pending_task);
@@ -158,7 +164,8 @@ class CONTENT_EXPORT TaskQueueManager {
// |queue_index|. If |has_previous_task| is true, |previous_task| should
// contain the previous task in this work batch. Non-nestable task are
// reposted on the run loop. The queue must not be empty.
- void ProcessTaskFromWorkQueue(size_t queue_index,
+ // Returns true if the TaskQueueManager got deleted, and false otherwise.
+ bool ProcessTaskFromWorkQueue(size_t queue_index,
bool has_previous_task,
base::PendingTask* previous_task);
@@ -198,6 +205,7 @@ class CONTENT_EXPORT TaskQueueManager {
const char* disabled_by_default_tracing_category_;
+ scoped_refptr<DeletionSentinel> deletion_sentinel_;
base::WeakPtrFactory<TaskQueueManager> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(TaskQueueManager);
« no previous file with comments | « no previous file | content/child/scheduler/task_queue_manager.cc » ('j') | content/child/scheduler/task_queue_manager.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698