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 #include <stddef.h> | 5 #include <stddef.h> |
6 #include <stdint.h> | 6 #include <stdint.h> |
7 | 7 |
| 8 #include <utility> |
| 9 |
8 #include "base/bind.h" | 10 #include "base/bind.h" |
9 #include "base/callback.h" | 11 #include "base/callback.h" |
10 #include "base/memory/ptr_util.h" | 12 #include "base/memory/ptr_util.h" |
11 #include "base/run_loop.h" | 13 #include "base/run_loop.h" |
12 #include "base/test/test_simple_task_runner.h" | 14 #include "base/test/test_simple_task_runner.h" |
13 #include "base/threading/thread_task_runner_handle.h" | 15 #include "base/threading/thread_task_runner_handle.h" |
14 #include "cc/playback/raster_source.h" | 16 #include "cc/playback/raster_source.h" |
15 #include "cc/playback/recording_source.h" | 17 #include "cc/playback/recording_source.h" |
16 #include "cc/raster/raster_buffer.h" | 18 #include "cc/raster/raster_buffer.h" |
17 #include "cc/raster/synchronous_task_graph_runner.h" | 19 #include "cc/raster/synchronous_task_graph_runner.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 using testing::StrictMock; | 51 using testing::StrictMock; |
50 | 52 |
51 namespace cc { | 53 namespace cc { |
52 namespace { | 54 namespace { |
53 | 55 |
54 // A version of simple task runner that lets the user control if all tasks | 56 // A version of simple task runner that lets the user control if all tasks |
55 // posted should run synchronously. | 57 // posted should run synchronously. |
56 class SynchronousSimpleTaskRunner : public base::TestSimpleTaskRunner { | 58 class SynchronousSimpleTaskRunner : public base::TestSimpleTaskRunner { |
57 public: | 59 public: |
58 bool PostDelayedTask(const tracked_objects::Location& from_here, | 60 bool PostDelayedTask(const tracked_objects::Location& from_here, |
59 const base::Closure& task, | 61 base::Closure task, |
60 base::TimeDelta delay) override { | 62 base::TimeDelta delay) override { |
61 TestSimpleTaskRunner::PostDelayedTask(from_here, task, delay); | 63 TestSimpleTaskRunner::PostDelayedTask(from_here, std::move(task), delay); |
62 if (run_tasks_synchronously_) | 64 if (run_tasks_synchronously_) |
63 RunUntilIdle(); | 65 RunUntilIdle(); |
64 return true; | 66 return true; |
65 } | 67 } |
66 | 68 |
67 bool PostNonNestableDelayedTask(const tracked_objects::Location& from_here, | 69 bool PostNonNestableDelayedTask(const tracked_objects::Location& from_here, |
68 const base::Closure& task, | 70 base::Closure task, |
69 base::TimeDelta delay) override { | 71 base::TimeDelta delay) override { |
70 return PostDelayedTask(from_here, task, delay); | 72 return PostDelayedTask(from_here, std::move(task), delay); |
71 } | 73 } |
72 | 74 |
73 void set_run_tasks_synchronously(bool run_tasks_synchronously) { | 75 void set_run_tasks_synchronously(bool run_tasks_synchronously) { |
74 run_tasks_synchronously_ = run_tasks_synchronously; | 76 run_tasks_synchronously_ = run_tasks_synchronously; |
75 } | 77 } |
76 | 78 |
77 protected: | 79 protected: |
78 ~SynchronousSimpleTaskRunner() override = default; | 80 ~SynchronousSimpleTaskRunner() override = default; |
79 | 81 |
80 bool run_tasks_synchronously_ = false; | 82 bool run_tasks_synchronously_ = false; |
(...skipping 2298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2379 // a part of raster tasks, the test should fail. | 2381 // a part of raster tasks, the test should fail. |
2380 host_impl()->tile_manager()->PrepareTiles(host_impl()->global_tile_state()); | 2382 host_impl()->tile_manager()->PrepareTiles(host_impl()->global_tile_state()); |
2381 EXPECT_TRUE(host_impl()->tile_manager()->HasScheduledTileTasksForTesting()); | 2383 EXPECT_TRUE(host_impl()->tile_manager()->HasScheduledTileTasksForTesting()); |
2382 static_cast<SynchronousTaskGraphRunner*>(task_graph_runner())->RunUntilIdle(); | 2384 static_cast<SynchronousTaskGraphRunner*>(task_graph_runner())->RunUntilIdle(); |
2383 base::RunLoop().RunUntilIdle(); | 2385 base::RunLoop().RunUntilIdle(); |
2384 EXPECT_FALSE(host_impl()->tile_manager()->HasScheduledTileTasksForTesting()); | 2386 EXPECT_FALSE(host_impl()->tile_manager()->HasScheduledTileTasksForTesting()); |
2385 } | 2387 } |
2386 | 2388 |
2387 } // namespace | 2389 } // namespace |
2388 } // namespace cc | 2390 } // namespace cc |
OLD | NEW |