Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(818)

Side by Side Diff: cc/trees/layer_tree_host_unittest_copyrequest.cc

Issue 2337913003: Fork cc::OutputSurface into cc::CompositorFrameSink. (Closed)
Patch Set: cfsfork: android-vulkan Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 6
7 #include "base/location.h" 7 #include "base/location.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "base/single_thread_task_runner.h" 9 #include "base/single_thread_task_runner.h"
10 #include "base/threading/thread_task_runner_handle.h" 10 #include "base/threading/thread_task_runner_handle.h"
11 #include "cc/layers/layer_iterator.h" 11 #include "cc/layers/layer_iterator.h"
12 #include "cc/output/copy_output_request.h" 12 #include "cc/output/copy_output_request.h"
13 #include "cc/output/copy_output_result.h" 13 #include "cc/output/copy_output_result.h"
14 #include "cc/output/direct_renderer.h" 14 #include "cc/output/direct_renderer.h"
15 #include "cc/surfaces/display.h" 15 #include "cc/surfaces/display.h"
16 #include "cc/test/fake_content_layer_client.h" 16 #include "cc/test/fake_content_layer_client.h"
17 #include "cc/test/fake_output_surface.h" 17 #include "cc/test/fake_output_surface.h"
18 #include "cc/test/fake_picture_layer.h" 18 #include "cc/test/fake_picture_layer.h"
19 #include "cc/test/layer_tree_test.h" 19 #include "cc/test/layer_tree_test.h"
20 #include "cc/test/test_delegating_output_surface.h" 20 #include "cc/test/test_compositor_frame_sink.h"
21 #include "cc/trees/layer_tree_impl.h" 21 #include "cc/trees/layer_tree_impl.h"
22 #include "gpu/GLES2/gl2extchromium.h" 22 #include "gpu/GLES2/gl2extchromium.h"
23 23
24 namespace cc { 24 namespace cc {
25 namespace { 25 namespace {
26 26
27 // These tests only use direct rendering, as there is no output to copy for 27 // These tests only use direct rendering, as there is no output to copy for
28 // delegated renderers. 28 // delegated renderers.
29 class LayerTreeHostCopyRequestTest : public LayerTreeTest {}; 29 class LayerTreeHostCopyRequestTest : public LayerTreeTest {};
30 30
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 456
457 copy_layer_ = FakePictureLayer::Create(&client_); 457 copy_layer_ = FakePictureLayer::Create(&client_);
458 copy_layer_->SetBounds(gfx::Size(10, 10)); 458 copy_layer_->SetBounds(gfx::Size(10, 10));
459 parent_layer_->AddChild(copy_layer_); 459 parent_layer_->AddChild(copy_layer_);
460 460
461 layer_tree()->SetRootLayer(root_); 461 layer_tree()->SetRootLayer(root_);
462 LayerTreeHostCopyRequestTest::SetupTree(); 462 LayerTreeHostCopyRequestTest::SetupTree();
463 client_.set_bounds(root_->bounds()); 463 client_.set_bounds(root_->bounds());
464 } 464 }
465 465
466 std::unique_ptr<TestDelegatingOutputSurface> CreateDelegatingOutputSurface( 466 std::unique_ptr<TestCompositorFrameSink> CreateCompositorFrameSink(
467 scoped_refptr<ContextProvider> compositor_context_provider, 467 scoped_refptr<ContextProvider> compositor_context_provider,
468 scoped_refptr<ContextProvider> worker_context_provider) override { 468 scoped_refptr<ContextProvider> worker_context_provider) override {
469 auto surface = LayerTreeHostCopyRequestTest::CreateDelegatingOutputSurface( 469 auto surface = LayerTreeHostCopyRequestTest::CreateCompositorFrameSink(
470 std::move(compositor_context_provider), 470 std::move(compositor_context_provider),
471 std::move(worker_context_provider)); 471 std::move(worker_context_provider));
472 display_ = surface->display(); 472 display_ = surface->display();
473 return surface; 473 return surface;
474 } 474 }
475 475
476 void BeginTest() override { 476 void BeginTest() override {
477 PostSetNeedsCommitToMainThread(); 477 PostSetNeedsCommitToMainThread();
478 478
479 copy_layer_->RequestCopyOfOutput( 479 copy_layer_->RequestCopyOfOutput(
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
845 void InitializeSettings(LayerTreeSettings* settings) override { 845 void InitializeSettings(LayerTreeSettings* settings) override {
846 // Always allocate only a single texture at a time through ResourceProvider. 846 // Always allocate only a single texture at a time through ResourceProvider.
847 settings->renderer_settings.texture_id_allocation_chunk_size = 1; 847 settings->renderer_settings.texture_id_allocation_chunk_size = 1;
848 } 848 }
849 849
850 std::unique_ptr<OutputSurface> CreateDisplayOutputSurface( 850 std::unique_ptr<OutputSurface> CreateDisplayOutputSurface(
851 scoped_refptr<ContextProvider> compositor_context_provider) override { 851 scoped_refptr<ContextProvider> compositor_context_provider) override {
852 // These tests expect the LayerTreeHostImpl to share a context with 852 // These tests expect the LayerTreeHostImpl to share a context with
853 // the Display so that sync points are not needed and the texture counts 853 // the Display so that sync points are not needed and the texture counts
854 // are visible together. 854 // are visible together.
855 // Since this test does not override CreateDelegatingOutputSurface, the 855 // Since this test does not override CreateCompositorFrameSink, the
856 // |compositor_context_provider| will be a TestContextProvider. 856 // |compositor_context_provider| will be a TestContextProvider.
857 display_context_provider_ = 857 display_context_provider_ =
858 static_cast<TestContextProvider*>(compositor_context_provider.get()); 858 static_cast<TestContextProvider*>(compositor_context_provider.get());
859 return FakeOutputSurface::Create3d(std::move(compositor_context_provider)); 859 return FakeOutputSurface::Create3d(std::move(compositor_context_provider));
860 } 860 }
861 861
862 void SetupTree() override { 862 void SetupTree() override {
863 // The layers in this test have solid color content, so they don't 863 // The layers in this test have solid color content, so they don't
864 // actually allocate any textures, making counting easier. 864 // actually allocate any textures, making counting easier.
865 865
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
1284 int num_draws_; 1284 int num_draws_;
1285 bool copy_happened_; 1285 bool copy_happened_;
1286 bool draw_happened_; 1286 bool draw_happened_;
1287 }; 1287 };
1288 1288
1289 SINGLE_AND_MULTI_THREAD_TEST_F( 1289 SINGLE_AND_MULTI_THREAD_TEST_F(
1290 LayerTreeHostCopyRequestTestMultipleDrawsHiddenCopyRequest); 1290 LayerTreeHostCopyRequestTestMultipleDrawsHiddenCopyRequest);
1291 1291
1292 } // namespace 1292 } // namespace
1293 } // namespace cc 1293 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_unittest_context.cc ('k') | cc/trees/layer_tree_host_unittest_remote_server.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698