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

Side by Side Diff: third_party/WebKit/Source/platform/scheduler/base/task_queue_manager.h

Issue 2649813003: Adds TaskQueueManager::AnyThread (Closed)
Patch Set: 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/base/task_queue_manager.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #ifndef THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_BASE_TASK_QUEUE_MANAGER_H_ 5 #ifndef THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_BASE_TASK_QUEUE_MANAGER_H_
6 #define THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_BASE_TASK_QUEUE_MANAGER_H_ 6 #define THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_BASE_TASK_QUEUE_MANAGER_H_
7 7
8 #include <map> 8 #include <map>
9 9
10 #include "base/atomic_sequence_num.h" 10 #include "base/atomic_sequence_num.h"
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 239
240 base::Closure from_main_thread_immediate_do_work_closure_; 240 base::Closure from_main_thread_immediate_do_work_closure_;
241 base::Closure from_other_thread_immediate_do_work_closure_; 241 base::Closure from_other_thread_immediate_do_work_closure_;
242 242
243 bool task_was_run_on_quiescence_monitored_queue_; 243 bool task_was_run_on_quiescence_monitored_queue_;
244 244
245 // To reduce locking overhead we track pending calls to DoWork separately for 245 // To reduce locking overhead we track pending calls to DoWork separately for
246 // the main thread and other threads. 246 // the main thread and other threads.
247 std::set<base::TimeTicks> main_thread_pending_wakeups_; 247 std::set<base::TimeTicks> main_thread_pending_wakeups_;
248 248
249 // Protects |other_thread_pending_wakeup_|. 249 struct AnyThread {
250 mutable base::Lock other_thread_lock_; 250 AnyThread();
251 bool other_thread_pending_wakeup_; 251
252 bool other_thread_pending_wakeup;
253 };
254
255 // TODO(alexclarke): Add a MainThreadOnly struct too.
256
257 mutable base::Lock any_thread_lock_;
258 AnyThread any_thread_;
259
260 struct AnyThread& any_thread() {
261 any_thread_lock_.AssertAcquired();
262 return any_thread_;
263 }
264 const struct AnyThread& any_thread() const {
265 any_thread_lock_.AssertAcquired();
266 return any_thread_;
267 }
252 268
253 bool record_task_delay_histograms_; 269 bool record_task_delay_histograms_;
254 270
255 int work_batch_size_; 271 int work_batch_size_;
256 size_t task_count_; 272 size_t task_count_;
257 273
258 base::ObserverList<base::MessageLoop::TaskObserver> task_observers_; 274 base::ObserverList<base::MessageLoop::TaskObserver> task_observers_;
259 275
260 base::ObserverList<TaskTimeObserver> task_time_observers_; 276 base::ObserverList<TaskTimeObserver> task_time_observers_;
261 277
262 const char* tracing_category_; 278 const char* tracing_category_;
263 const char* disabled_by_default_tracing_category_; 279 const char* disabled_by_default_tracing_category_;
264 const char* disabled_by_default_verbose_tracing_category_; 280 const char* disabled_by_default_verbose_tracing_category_;
265 281
266 internal::TaskQueueImpl* currently_executing_task_queue_; // NOT OWNED 282 internal::TaskQueueImpl* currently_executing_task_queue_; // NOT OWNED
267 283
268 Observer* observer_; // NOT OWNED 284 Observer* observer_; // NOT OWNED
269 scoped_refptr<DeletionSentinel> deletion_sentinel_; 285 scoped_refptr<DeletionSentinel> deletion_sentinel_;
270 base::WeakPtrFactory<TaskQueueManager> weak_factory_; 286 base::WeakPtrFactory<TaskQueueManager> weak_factory_;
271 287
272 DISALLOW_COPY_AND_ASSIGN(TaskQueueManager); 288 DISALLOW_COPY_AND_ASSIGN(TaskQueueManager);
273 }; 289 };
274 290
275 } // namespace scheduler 291 } // namespace scheduler
276 } // namespace blink 292 } // namespace blink
277 293
278 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_BASE_TASK_QUEUE_MANAGER_ H_ 294 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_BASE_TASK_QUEUE_MANAGER_ H_
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/scheduler/base/task_queue_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698