Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 "cc/trees/layer_tree_host.h" | 5 #include "cc/trees/layer_tree_host.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <sstream> | 9 #include <sstream> |
| 10 | 10 |
| 11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
| 12 #include "base/files/file_util.h" | 12 #include "base/files/file_util.h" |
| 13 #include "base/path_service.h" | 13 #include "base/path_service.h" |
| 14 #include "base/strings/string_piece.h" | 14 #include "base/strings/string_piece.h" |
| 15 #include "base/time/time.h" | 15 #include "base/time/time.h" |
| 16 #include "cc/base/lap_timer.h" | 16 #include "cc/base/lap_timer.h" |
| 17 #include "cc/layers/nine_patch_layer.h" | 17 #include "cc/layers/nine_patch_layer.h" |
| 18 #include "cc/layers/solid_color_layer.h" | 18 #include "cc/layers/solid_color_layer.h" |
| 19 #include "cc/layers/texture_layer.h" | 19 #include "cc/layers/texture_layer.h" |
| 20 #include "cc/resources/single_release_callback.h" | 20 #include "cc/resources/single_release_callback.h" |
| 21 #include "cc/resources/texture_mailbox.h" | 21 #include "cc/resources/texture_mailbox.h" |
| 22 #include "cc/test/fake_content_layer_client.h" | 22 #include "cc/test/fake_content_layer_client.h" |
| 23 #include "cc/test/layer_tree_json_parser.h" | 23 #include "cc/test/layer_tree_json_parser.h" |
| 24 #include "cc/test/layer_tree_test.h" | 24 #include "cc/test/layer_tree_test.h" |
| 25 #include "cc/test/paths.h" | 25 #include "cc/test/paths.h" |
| 26 #include "cc/test/test_compositor_frame_sink.h" | |
| 26 #include "cc/trees/layer_tree_impl.h" | 27 #include "cc/trees/layer_tree_impl.h" |
| 27 #include "testing/perf/perf_test.h" | 28 #include "testing/perf/perf_test.h" |
| 28 | 29 |
| 29 namespace cc { | 30 namespace cc { |
| 30 namespace { | 31 namespace { |
| 31 | 32 |
| 32 static const int kTimeLimitMillis = 2000; | 33 static const int kTimeLimitMillis = 2000; |
| 33 static const int kWarmupRuns = 5; | 34 static const int kWarmupRuns = 5; |
| 34 static const int kTimeCheckInterval = 10; | 35 static const int kTimeCheckInterval = 10; |
| 35 | 36 |
| 36 class LayerTreeHostPerfTest : public LayerTreeTest { | 37 class LayerTreeHostPerfTest : public LayerTreeTest { |
| 37 public: | 38 public: |
| 38 LayerTreeHostPerfTest() | 39 LayerTreeHostPerfTest() |
| 39 : draw_timer_(kWarmupRuns, | 40 : draw_timer_(kWarmupRuns, |
| 40 base::TimeDelta::FromMilliseconds(kTimeLimitMillis), | 41 base::TimeDelta::FromMilliseconds(kTimeLimitMillis), |
| 41 kTimeCheckInterval), | 42 kTimeCheckInterval), |
| 42 commit_timer_(0, base::TimeDelta(), 1), | 43 commit_timer_(0, base::TimeDelta(), 1), |
| 43 full_damage_each_frame_(false), | 44 full_damage_each_frame_(false), |
| 44 begin_frame_driven_drawing_(false), | 45 begin_frame_driven_drawing_(false), |
| 45 measure_commit_cost_(false) { | 46 measure_commit_cost_(false) { |
| 46 } | 47 } |
| 47 | 48 |
| 48 void InitializeSettings(LayerTreeSettings* settings) override { | 49 // LayerTreeTests give the Display's BeginFrameSource directly to the |
|
danakj
2017/05/04 15:36:35
I don't think this comment makes sense anymore, no
Alex Z.
2017/05/04 18:41:55
Done.
| |
| 49 // LayerTreeTests give the Display's BeginFrameSource directly to the | 50 // LayerTreeHost like we do in the Browser process via |
| 50 // LayerTreeHost like we do in the Browser process via | 51 // TestDelegatingOutputSurface, so setting disable_display_vsync here |
| 51 // TestDelegatingOutputSurface, so setting disable_display_vsync here | 52 // unthrottles both the DisplayScheduler and the Scheduler. |
| 52 // unthrottles both the DisplayScheduler and the Scheduler. | 53 std::unique_ptr<TestCompositorFrameSink> CreateCompositorFrameSink( |
| 53 settings->renderer_settings.disable_display_vsync = true; | 54 scoped_refptr<ContextProvider> compositor_context_provider, |
| 55 scoped_refptr<ContextProvider> worker_context_provider) override { | |
| 56 constexpr bool disable_display_vsync = true; | |
| 57 bool synchronous_composite = | |
| 58 !HasImplThread() && | |
| 59 !layer_tree_host()->GetSettings().single_thread_proxy_scheduler; | |
| 60 return base::MakeUnique<TestCompositorFrameSink>( | |
| 61 compositor_context_provider, std::move(worker_context_provider), | |
| 62 shared_bitmap_manager(), gpu_memory_buffer_manager(), | |
| 63 layer_tree_host()->GetSettings().renderer_settings, | |
| 64 ImplThreadTaskRunner(), synchronous_composite, disable_display_vsync); | |
| 54 } | 65 } |
| 55 | 66 |
| 56 void BeginTest() override { | 67 void BeginTest() override { |
| 57 BuildTree(); | 68 BuildTree(); |
| 58 PostSetNeedsCommitToMainThread(); | 69 PostSetNeedsCommitToMainThread(); |
| 59 } | 70 } |
| 60 | 71 |
| 61 void BeginMainFrame(const BeginFrameArgs& args) override { | 72 void BeginMainFrame(const BeginFrameArgs& args) override { |
| 62 if (begin_frame_driven_drawing_ && !TestEnded()) | 73 if (begin_frame_driven_drawing_ && !TestEnded()) |
| 63 layer_tree_host()->SetNeedsCommitWithForcedRedraw(); | 74 layer_tree_host()->SetNeedsCommitWithForcedRedraw(); |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 346 TEST_F(LayerTreeHostPerfTestJsonReader, HeavyPageThreaded) { | 357 TEST_F(LayerTreeHostPerfTestJsonReader, HeavyPageThreaded) { |
| 347 begin_frame_driven_drawing_ = true; | 358 begin_frame_driven_drawing_ = true; |
| 348 measure_commit_cost_ = true; | 359 measure_commit_cost_ = true; |
| 349 SetTestName("heavy_page"); | 360 SetTestName("heavy_page"); |
| 350 ReadTestFile("heavy_layer_tree"); | 361 ReadTestFile("heavy_layer_tree"); |
| 351 RunTest(CompositorMode::THREADED); | 362 RunTest(CompositorMode::THREADED); |
| 352 } | 363 } |
| 353 | 364 |
| 354 } // namespace | 365 } // namespace |
| 355 } // namespace cc | 366 } // namespace cc |
| OLD | NEW |