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

Unified Diff: base/message_loop/incoming_task_queue.h

Issue 1991623002: Avoid holding |incoming_queue_lock_| while waking up the message loop. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@base-rw-lock
Patch Set: Rebase Created 4 years, 7 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 | base/message_loop/incoming_task_queue.cc » ('j') | base/message_loop/incoming_task_queue.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/message_loop/incoming_task_queue.h
diff --git a/base/message_loop/incoming_task_queue.h b/base/message_loop/incoming_task_queue.h
index e450aa164fa0fb96515375da109bd7e301c9454c..02d6c74334e9be2caaf40cd2fe3946484969d496 100644
--- a/base/message_loop/incoming_task_queue.h
+++ b/base/message_loop/incoming_task_queue.h
@@ -10,6 +10,7 @@
#include "base/memory/ref_counted.h"
#include "base/pending_task.h"
#include "base/synchronization/lock.h"
+#include "base/synchronization/rw_lock.h"
#include "base/time/time.h"
namespace base {
@@ -62,25 +63,24 @@ class BASE_EXPORT IncomingTaskQueue
friend class RefCountedThreadSafe<IncomingTaskQueue>;
virtual ~IncomingTaskQueue();
- // Calculates the time at which a PendingTask should run.
- TimeTicks CalculateDelayedRuntime(TimeDelta delay);
-
// Adds a task to |incoming_queue_|. The caller retains ownership of
// |pending_task|, but this function will reset the value of
// |pending_task->task|. This is needed to ensure that the posting call stack
// does not retain |pending_task->task| beyond this function call.
bool PostPendingTask(PendingTask* pending_task);
- // Wakes up the message loop and schedules work.
- void ScheduleWork();
-
// Number of tasks that require high resolution timing. This value is kept
// so that ReloadWorkQueue() completes in constant time.
int high_res_task_count_;
- // The lock that protects access to the members of this class.
+ // The lock that protects access to the members of this class, except
+ // |message_loop_|.
base::Lock incoming_queue_lock_;
+ // Lock that protects |message_loop_| to prevent it from being deleted while a
+ // task a being posted.
danakj 2016/05/19 21:27:43 is being
Anand Mistry (off Chromium) 2016/05/20 04:45:38 Done.
+ base::RWLock message_loop_lock_;
+
// An incoming queue of tasks that are acquired under a mutex for processing
// on this instance's thread. These tasks have not yet been been pushed to
// |message_loop_|.
« no previous file with comments | « no previous file | base/message_loop/incoming_task_queue.cc » ('j') | base/message_loop/incoming_task_queue.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698