OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_TREES_BLOCKING_TASK_RUNNER_H_ | 5 #ifndef CC_TREES_BLOCKING_TASK_RUNNER_H_ |
6 #define CC_TREES_BLOCKING_TASK_RUNNER_H_ | 6 #define CC_TREES_BLOCKING_TASK_RUNNER_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/location.h" | 11 #include "base/location.h" |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/single_thread_task_runner.h" | 13 #include "base/single_thread_task_runner.h" |
14 #include "base/synchronization/lock.h" | 14 #include "base/synchronization/lock.h" |
15 #include "base/threading/platform_thread.h" | 15 #include "base/threading/platform_thread.h" |
16 #include "cc/base/cc_export.h" | 16 #include "cc/cc_export.h" |
17 | 17 |
18 namespace cc { | 18 namespace cc { |
19 | 19 |
20 // This class wraps a SingleThreadTaskRunner but allows posted tasks to be | 20 // This class wraps a SingleThreadTaskRunner but allows posted tasks to be |
21 // run without a round trip through the message loop. This shortcutting | 21 // run without a round trip through the message loop. This shortcutting |
22 // removes guarantees about ordering. Tasks posted while the | 22 // removes guarantees about ordering. Tasks posted while the |
23 // BlockingTaskRunner is in a capturing state will run in order, and tasks | 23 // BlockingTaskRunner is in a capturing state will run in order, and tasks |
24 // posted while the BlockingTaskRunner is /not/ in a capturing state will | 24 // posted while the BlockingTaskRunner is /not/ in a capturing state will |
25 // run in order, but the two sets of tasks will *not* run in order relative | 25 // run in order, but the two sets of tasks will *not* run in order relative |
26 // to when they were posted. | 26 // to when they were posted. |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 base::Lock lock_; | 90 base::Lock lock_; |
91 int capture_; | 91 int capture_; |
92 std::vector<base::Closure> captured_tasks_; | 92 std::vector<base::Closure> captured_tasks_; |
93 | 93 |
94 DISALLOW_COPY_AND_ASSIGN(BlockingTaskRunner); | 94 DISALLOW_COPY_AND_ASSIGN(BlockingTaskRunner); |
95 }; | 95 }; |
96 | 96 |
97 } // namespace cc | 97 } // namespace cc |
98 | 98 |
99 #endif // CC_TREES_BLOCKING_TASK_RUNNER_H_ | 99 #endif // CC_TREES_BLOCKING_TASK_RUNNER_H_ |
OLD | NEW |