OLD | NEW |
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 #include <stddef.h> | 5 #include <stddef.h> |
6 #include <stdint.h> | 6 #include <stdint.h> |
7 | 7 |
| 8 #include <memory> |
8 #include <vector> | 9 #include <vector> |
9 | 10 |
10 #include "base/macros.h" | 11 #include "base/macros.h" |
11 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/ptr_util.h" |
12 #include "base/time/time.h" | 13 #include "base/time/time.h" |
13 #include "cc/base/completion_event.h" | 14 #include "cc/base/completion_event.h" |
14 #include "cc/debug/lap_timer.h" | 15 #include "cc/debug/lap_timer.h" |
15 #include "cc/raster/synchronous_task_graph_runner.h" | 16 #include "cc/raster/synchronous_task_graph_runner.h" |
16 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
17 #include "testing/perf/perf_test.h" | 18 #include "testing/perf/perf_test.h" |
18 | 19 |
19 namespace cc { | 20 namespace cc { |
20 namespace { | 21 namespace { |
21 | 22 |
(...skipping 20 matching lines...) Expand all Loading... |
42 | 43 |
43 class TaskGraphRunnerPerfTest : public testing::Test { | 44 class TaskGraphRunnerPerfTest : public testing::Test { |
44 public: | 45 public: |
45 TaskGraphRunnerPerfTest() | 46 TaskGraphRunnerPerfTest() |
46 : timer_(kWarmupRuns, | 47 : timer_(kWarmupRuns, |
47 base::TimeDelta::FromMilliseconds(kTimeLimitMillis), | 48 base::TimeDelta::FromMilliseconds(kTimeLimitMillis), |
48 kTimeCheckInterval) {} | 49 kTimeCheckInterval) {} |
49 | 50 |
50 // Overridden from testing::Test: | 51 // Overridden from testing::Test: |
51 void SetUp() override { | 52 void SetUp() override { |
52 task_graph_runner_ = make_scoped_ptr(new SynchronousTaskGraphRunner); | 53 task_graph_runner_ = base::WrapUnique(new SynchronousTaskGraphRunner); |
53 namespace_token_ = task_graph_runner_->GetNamespaceToken(); | 54 namespace_token_ = task_graph_runner_->GetNamespaceToken(); |
54 } | 55 } |
55 void TearDown() override { task_graph_runner_ = nullptr; } | 56 void TearDown() override { task_graph_runner_ = nullptr; } |
56 | 57 |
57 void RunBuildTaskGraphTest(const std::string& test_name, | 58 void RunBuildTaskGraphTest(const std::string& test_name, |
58 int num_top_level_tasks, | 59 int num_top_level_tasks, |
59 int num_tasks, | 60 int num_tasks, |
60 int num_leaf_tasks) { | 61 int num_leaf_tasks) { |
61 PerfTaskImpl::Vector top_level_tasks; | 62 PerfTaskImpl::Vector top_level_tasks; |
62 PerfTaskImpl::Vector tasks; | 63 PerfTaskImpl::Vector tasks; |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 | 266 |
266 size_t CollectCompletedTasks(Task::Vector* completed_tasks) { | 267 size_t CollectCompletedTasks(Task::Vector* completed_tasks) { |
267 DCHECK(completed_tasks->empty()); | 268 DCHECK(completed_tasks->empty()); |
268 task_graph_runner_->CollectCompletedTasks(namespace_token_, | 269 task_graph_runner_->CollectCompletedTasks(namespace_token_, |
269 completed_tasks); | 270 completed_tasks); |
270 return completed_tasks->size(); | 271 return completed_tasks->size(); |
271 } | 272 } |
272 | 273 |
273 // Test uses SynchronousTaskGraphRunner, as this implementation introduces | 274 // Test uses SynchronousTaskGraphRunner, as this implementation introduces |
274 // minimal additional complexity over the TaskGraphWorkQueue helpers. | 275 // minimal additional complexity over the TaskGraphWorkQueue helpers. |
275 scoped_ptr<SynchronousTaskGraphRunner> task_graph_runner_; | 276 std::unique_ptr<SynchronousTaskGraphRunner> task_graph_runner_; |
276 NamespaceToken namespace_token_; | 277 NamespaceToken namespace_token_; |
277 LapTimer timer_; | 278 LapTimer timer_; |
278 }; | 279 }; |
279 | 280 |
280 TEST_F(TaskGraphRunnerPerfTest, BuildTaskGraph) { | 281 TEST_F(TaskGraphRunnerPerfTest, BuildTaskGraph) { |
281 RunBuildTaskGraphTest("0_1_0", 0, 1, 0); | 282 RunBuildTaskGraphTest("0_1_0", 0, 1, 0); |
282 RunBuildTaskGraphTest("0_32_0", 0, 32, 0); | 283 RunBuildTaskGraphTest("0_32_0", 0, 32, 0); |
283 RunBuildTaskGraphTest("2_1_0", 2, 1, 0); | 284 RunBuildTaskGraphTest("2_1_0", 2, 1, 0); |
284 RunBuildTaskGraphTest("2_32_0", 2, 32, 0); | 285 RunBuildTaskGraphTest("2_32_0", 2, 32, 0); |
285 RunBuildTaskGraphTest("2_1_1", 2, 1, 1); | 286 RunBuildTaskGraphTest("2_1_1", 2, 1, 1); |
(...skipping 22 matching lines...) Expand all Loading... |
308 RunScheduleAndExecuteTasksTest("0_1_0", 0, 1, 0); | 309 RunScheduleAndExecuteTasksTest("0_1_0", 0, 1, 0); |
309 RunScheduleAndExecuteTasksTest("0_32_0", 0, 32, 0); | 310 RunScheduleAndExecuteTasksTest("0_32_0", 0, 32, 0); |
310 RunScheduleAndExecuteTasksTest("2_1_0", 2, 1, 0); | 311 RunScheduleAndExecuteTasksTest("2_1_0", 2, 1, 0); |
311 RunScheduleAndExecuteTasksTest("2_32_0", 2, 32, 0); | 312 RunScheduleAndExecuteTasksTest("2_32_0", 2, 32, 0); |
312 RunScheduleAndExecuteTasksTest("2_1_1", 2, 1, 1); | 313 RunScheduleAndExecuteTasksTest("2_1_1", 2, 1, 1); |
313 RunScheduleAndExecuteTasksTest("2_32_1", 2, 32, 1); | 314 RunScheduleAndExecuteTasksTest("2_32_1", 2, 32, 1); |
314 } | 315 } |
315 | 316 |
316 } // namespace | 317 } // namespace |
317 } // namespace cc | 318 } // namespace cc |
OLD | NEW |