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> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 using testing::StrictMock; | 50 using testing::StrictMock; |
51 | 51 |
52 namespace cc { | 52 namespace cc { |
53 namespace { | 53 namespace { |
54 | 54 |
55 // A version of simple task runner that lets the user control if all tasks | 55 // A version of simple task runner that lets the user control if all tasks |
56 // posted should run synchronously. | 56 // posted should run synchronously. |
57 class SynchronousSimpleTaskRunner : public base::TestSimpleTaskRunner { | 57 class SynchronousSimpleTaskRunner : public base::TestSimpleTaskRunner { |
58 public: | 58 public: |
59 bool PostDelayedTask(const tracked_objects::Location& from_here, | 59 bool PostDelayedTask(const tracked_objects::Location& from_here, |
60 base::Closure task, | 60 base::OnceClosure task, |
61 base::TimeDelta delay) override { | 61 base::TimeDelta delay) override { |
62 TestSimpleTaskRunner::PostDelayedTask(from_here, std::move(task), delay); | 62 TestSimpleTaskRunner::PostDelayedTask(from_here, std::move(task), delay); |
63 if (run_tasks_synchronously_) | 63 if (run_tasks_synchronously_) |
64 RunUntilIdle(); | 64 RunUntilIdle(); |
65 return true; | 65 return true; |
66 } | 66 } |
67 | 67 |
68 bool PostNonNestableDelayedTask(const tracked_objects::Location& from_here, | 68 bool PostNonNestableDelayedTask(const tracked_objects::Location& from_here, |
69 base::Closure task, | 69 base::OnceClosure task, |
70 base::TimeDelta delay) override { | 70 base::TimeDelta delay) override { |
71 return PostDelayedTask(from_here, std::move(task), delay); | 71 return PostDelayedTask(from_here, std::move(task), delay); |
72 } | 72 } |
73 | 73 |
74 void set_run_tasks_synchronously(bool run_tasks_synchronously) { | 74 void set_run_tasks_synchronously(bool run_tasks_synchronously) { |
75 run_tasks_synchronously_ = run_tasks_synchronously; | 75 run_tasks_synchronously_ = run_tasks_synchronously; |
76 } | 76 } |
77 | 77 |
78 protected: | 78 protected: |
79 ~SynchronousSimpleTaskRunner() override = default; | 79 ~SynchronousSimpleTaskRunner() override = default; |
(...skipping 2297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2377 // a part of raster tasks, the test should fail. | 2377 // a part of raster tasks, the test should fail. |
2378 host_impl()->tile_manager()->PrepareTiles(host_impl()->global_tile_state()); | 2378 host_impl()->tile_manager()->PrepareTiles(host_impl()->global_tile_state()); |
2379 EXPECT_TRUE(host_impl()->tile_manager()->HasScheduledTileTasksForTesting()); | 2379 EXPECT_TRUE(host_impl()->tile_manager()->HasScheduledTileTasksForTesting()); |
2380 static_cast<SynchronousTaskGraphRunner*>(task_graph_runner())->RunUntilIdle(); | 2380 static_cast<SynchronousTaskGraphRunner*>(task_graph_runner())->RunUntilIdle(); |
2381 base::RunLoop().RunUntilIdle(); | 2381 base::RunLoop().RunUntilIdle(); |
2382 EXPECT_FALSE(host_impl()->tile_manager()->HasScheduledTileTasksForTesting()); | 2382 EXPECT_FALSE(host_impl()->tile_manager()->HasScheduledTileTasksForTesting()); |
2383 } | 2383 } |
2384 | 2384 |
2385 } // namespace | 2385 } // namespace |
2386 } // namespace cc | 2386 } // namespace cc |
OLD | NEW |