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

Side by Side Diff: cc/raster/single_thread_task_graph_runner.h

Issue 1739993004: content: Implement dynamic priorities for raster threads. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: preparing for checkin. Created 4 years, 9 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
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 #ifndef CC_RASTER_SINGLE_THREAD_TASK_GRAPH_RUNNER_H_ 5 #ifndef CC_RASTER_SINGLE_THREAD_TASK_GRAPH_RUNNER_H_
6 #define CC_RASTER_SINGLE_THREAD_TASK_GRAPH_RUNNER_H_ 6 #define CC_RASTER_SINGLE_THREAD_TASK_GRAPH_RUNNER_H_
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/synchronization/condition_variable.h" 9 #include "base/synchronization/condition_variable.h"
10 #include "base/threading/simple_thread.h" 10 #include "base/threading/simple_thread.h"
11 #include "cc/raster/task_graph_runner.h" 11 #include "cc/raster/task_graph_runner.h"
12 #include "cc/raster/task_graph_work_queue.h" 12 #include "cc/raster/task_graph_work_queue.h"
13 13
14 namespace base { 14 namespace base {
15 class SimpleThread; 15 class SimpleThread;
16 } 16 }
17 17
18 namespace cc { 18 namespace cc {
19 19
20 // Runs TaskGraphs asynchronously using a single worker thread. 20 // Runs TaskGraphs asynchronously using a single worker thread.
21 class CC_EXPORT SingleThreadTaskGraphRunner 21 class CC_EXPORT SingleThreadTaskGraphRunner
22 : public TaskGraphRunner, 22 : public TaskGraphRunner,
23 public base::DelegateSimpleThread::Delegate { 23 public base::DelegateSimpleThread::Delegate,
24 public TaskGraphWorkQueueClient {
24 public: 25 public:
25 SingleThreadTaskGraphRunner(); 26 SingleThreadTaskGraphRunner();
26 ~SingleThreadTaskGraphRunner() override; 27 ~SingleThreadTaskGraphRunner() override;
27 28
28 // Overridden from TaskGraphRunner: 29 // Overridden from TaskGraphRunner:
29 NamespaceToken GetNamespaceToken() override; 30 NamespaceToken GetNamespaceToken() override;
30 void ScheduleTasks(NamespaceToken token, TaskGraph* graph) override; 31 void ScheduleTasks(NamespaceToken token, TaskGraph* graph) override;
31 void WaitForTasksToFinishRunning(NamespaceToken token) override; 32 void WaitForTasksToFinishRunning(NamespaceToken token) override;
32 void CollectCompletedTasks(NamespaceToken token, 33 void CollectCompletedTasks(NamespaceToken token,
33 Task::Vector* completed_tasks) override; 34 Task::Vector* completed_tasks) override;
34 35
35 // Overridden from base::DelegateSimpleThread::Delegate: 36 // Overridden from base::DelegateSimpleThread::Delegate:
36 void Run() override; 37 void Run() override;
37 38
39 // Overridden from TaskGraphWorkQueueClient:
40 void AdjustWorkerPriorityForTask(Task* task,
41 uint16_t old_category,
42 uint16_t new_category) override {}
43
38 void Start(const std::string& thread_name, 44 void Start(const std::string& thread_name,
39 const base::SimpleThread::Options& thread_options); 45 const base::SimpleThread::Options& thread_options);
40 void Shutdown(); 46 void Shutdown();
41 47
42 private: 48 private:
43 // Returns true if there was a task to run. 49 // Returns true if there was a task to run.
44 bool RunTaskWithLockAcquired(); 50 bool RunTaskWithLockAcquired();
45 51
46 scoped_ptr<base::SimpleThread> thread_; 52 scoped_ptr<base::SimpleThread> thread_;
47 53
(...skipping 12 matching lines...) Expand all
60 // has finished running all associated tasks. 66 // has finished running all associated tasks.
61 base::ConditionVariable has_namespaces_with_finished_running_tasks_cv_; 67 base::ConditionVariable has_namespaces_with_finished_running_tasks_cv_;
62 68
63 // Set during shutdown. Tells Run() to return when no more tasks are pending. 69 // Set during shutdown. Tells Run() to return when no more tasks are pending.
64 bool shutdown_; 70 bool shutdown_;
65 }; 71 };
66 72
67 } // namespace cc 73 } // namespace cc
68 74
69 #endif // CC_RASTER_SINGLE_THREAD_TASK_GRAPH_RUNNER_H_ 75 #endif // CC_RASTER_SINGLE_THREAD_TASK_GRAPH_RUNNER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698