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

Unified Diff: third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.cc

Issue 2538833005: [scheduler] Add options to TaskQueue::InsertFence (Closed)
Patch Set: Created 4 years 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: third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.cc
diff --git a/third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.cc b/third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.cc
index 376f255eb1ff0bf370ca82f8fe99b3acb627f6b3..f19f73f718bcd1be6bca23329c9d053807cb1386 100644
--- a/third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.cc
+++ b/third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.cc
@@ -605,13 +605,15 @@ void TaskQueueImpl::SetBlameContext(
main_thread_only().blame_context = blame_context;
}
-void TaskQueueImpl::InsertFence() {
+void TaskQueueImpl::InsertFence(TaskQueue::InsertFencePosition position) {
if (!main_thread_only().task_queue_manager)
return;
EnqueueOrder previous_fence = main_thread_only().current_fence;
main_thread_only().current_fence =
- main_thread_only().task_queue_manager->GetNextSequenceNumber();
+ position == TaskQueue::InsertFencePosition::NOW
+ ? main_thread_only().task_queue_manager->GetNextSequenceNumber()
+ : static_cast<EnqueueOrder>(EnqueueOrderValues::BLOCKING_FENCE);
// Tasks posted after this point will have a strictly higher enqueue order
// and will be blocked from running.
@@ -620,7 +622,8 @@ void TaskQueueImpl::InsertFence() {
task_unblocked |= main_thread_only().delayed_work_queue->InsertFence(
main_thread_only().current_fence);
- if (!task_unblocked && previous_fence) {
+ if (!task_unblocked && previous_fence &&
+ previous_fence < main_thread_only().current_fence) {
base::AutoLock lock(any_thread_lock_);
if (!any_thread().immediate_incoming_queue.empty() &&
any_thread().immediate_incoming_queue.front().enqueue_order() >
@@ -695,6 +698,10 @@ bool TaskQueueImpl::BlockedByFenceLocked() const {
main_thread_only().current_fence;
}
+EnqueueOrder TaskQueueImpl::GetFenceForTest() const {
+ return main_thread_only().current_fence;
+}
+
// static
void TaskQueueImpl::QueueAsValueInto(const std::queue<Task>& queue,
base::trace_event::TracedValue* state) {

Powered by Google App Engine
This is Rietveld 408576698