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

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

Issue 2708963002: Fix potential DCHECK in TaskQueueThrottler::IncreaseThrottleRefCount (Closed)
Patch Set: Addressing review comments. Created 3 years, 10 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 unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/scheduler/renderer/task_queue_throttler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "platform/scheduler/base/task_queue_impl.h" 5 #include "platform/scheduler/base/task_queue_impl.h"
6 6
7 #include "base/format_macros.h" 7 #include "base/format_macros.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "base/trace_event/blame_context.h" 10 #include "base/trace_event/blame_context.h"
(...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after
796 bool is_enabled = IsQueueEnabled(); 796 bool is_enabled = IsQueueEnabled();
797 if (was_enabled != is_enabled) 797 if (was_enabled != is_enabled)
798 EnableOrDisableWithSelector(is_enabled); 798 EnableOrDisableWithSelector(is_enabled);
799 } 799 }
800 800
801 void TaskQueueImpl::EnableOrDisableWithSelector(bool enable) { 801 void TaskQueueImpl::EnableOrDisableWithSelector(bool enable) {
802 if (!main_thread_only().task_queue_manager) 802 if (!main_thread_only().task_queue_manager)
803 return; 803 return;
804 804
805 if (enable) { 805 if (enable) {
806 // Check if there's any immediate work on either queue.
807 bool immediate_queues_empty =
808 main_thread_only().immediate_work_queue->Empty();
809 if (immediate_queues_empty) {
810 base::AutoLock lock(any_thread_lock_);
811 immediate_queues_empty = any_thread().immediate_incoming_queue.empty();
812 }
813 // Avoid holding the lock while we fire the notification.
814 if (!immediate_queues_empty)
815 main_thread_only().time_domain->OnQueueHasImmediateWork(this);
816
806 if (!main_thread_only().delayed_incoming_queue.empty()) { 817 if (!main_thread_only().delayed_incoming_queue.empty()) {
807 main_thread_only().time_domain->ScheduleDelayedWork( 818 main_thread_only().time_domain->ScheduleDelayedWork(
808 this, 819 this,
809 main_thread_only().delayed_incoming_queue.top().delayed_run_time, 820 main_thread_only().delayed_incoming_queue.top().delayed_run_time,
810 main_thread_only().time_domain->Now()); 821 main_thread_only().time_domain->Now());
811 } 822 }
812 // Note the selector calls TaskQueueManager::OnTaskQueueEnabled which posts 823 // Note the selector calls TaskQueueManager::OnTaskQueueEnabled which posts
813 // a DoWork if needed. 824 // a DoWork if needed.
814 main_thread_only().task_queue_manager->selector_.EnableQueue(this); 825 main_thread_only().task_queue_manager->selector_.EnableQueue(this);
815 } else { 826 } else {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
861 872
862 void TaskQueueImpl::PushImmediateIncomingTaskForTest( 873 void TaskQueueImpl::PushImmediateIncomingTaskForTest(
863 TaskQueueImpl::Task&& task) { 874 TaskQueueImpl::Task&& task) {
864 base::AutoLock lock(any_thread_lock_); 875 base::AutoLock lock(any_thread_lock_);
865 any_thread().immediate_incoming_queue.push_back(std::move(task)); 876 any_thread().immediate_incoming_queue.push_back(std::move(task));
866 } 877 }
867 878
868 } // namespace internal 879 } // namespace internal
869 } // namespace scheduler 880 } // namespace scheduler
870 } // namespace blink 881 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/scheduler/renderer/task_queue_throttler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698