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

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

Issue 2183403002: cc: Move data to LayerTree from LayerTreeHost. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@layer_tree_change
Patch Set: .. Created 4 years, 4 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 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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 <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 4290 matching lines...) Expand 10 before | Expand all | Expand 10 after
4301 inner_viewport_container_layer->AddChild(overscroll_elasticity_layer); 4301 inner_viewport_container_layer->AddChild(overscroll_elasticity_layer);
4302 overscroll_elasticity_layer->AddChild(page_scale_layer); 4302 overscroll_elasticity_layer->AddChild(page_scale_layer);
4303 page_scale_layer->AddChild(inner_viewport_scroll_layer); 4303 page_scale_layer->AddChild(inner_viewport_scroll_layer);
4304 4304
4305 scoped_refptr<Layer> content_layer = FakePictureLayer::Create(&client_); 4305 scoped_refptr<Layer> content_layer = FakePictureLayer::Create(&client_);
4306 content_layer_id_ = content_layer->id(); 4306 content_layer_id_ = content_layer->id();
4307 content_layer->SetBounds(gfx::Size(10, 10)); 4307 content_layer->SetBounds(gfx::Size(10, 10));
4308 inner_viewport_scroll_layer->AddChild(content_layer); 4308 inner_viewport_scroll_layer->AddChild(content_layer);
4309 4309
4310 layer_tree_host()->SetRootLayer(root_layer_); 4310 layer_tree_host()->SetRootLayer(root_layer_);
4311 layer_tree_host()->RegisterViewportLayers( 4311 layer_tree_host()->GetLayerTree()->RegisterViewportLayers(
4312 overscroll_elasticity_layer, page_scale_layer, 4312 overscroll_elasticity_layer, page_scale_layer,
4313 inner_viewport_scroll_layer, nullptr); 4313 inner_viewport_scroll_layer, nullptr);
4314 LayerTreeHostTest::SetupTree(); 4314 LayerTreeHostTest::SetupTree();
4315 client_.set_bounds(content_layer->bounds()); 4315 client_.set_bounds(content_layer->bounds());
4316 } 4316 }
4317 4317
4318 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 4318 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
4319 4319
4320 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override { 4320 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override {
4321 if (host_impl->sync_tree()->source_frame_number() == 0) { 4321 if (host_impl->sync_tree()->source_frame_number() == 0) {
(...skipping 1295 matching lines...) Expand 10 before | Expand all | Expand 10 after
5617 recording->SetPlaybackAllowedEvent(&playback_allowed_event_); 5617 recording->SetPlaybackAllowedEvent(&playback_allowed_event_);
5618 scoped_refptr<FakePictureLayer> layer = 5618 scoped_refptr<FakePictureLayer> layer =
5619 FakePictureLayer::CreateWithRecordingSource(&client_, 5619 FakePictureLayer::CreateWithRecordingSource(&client_,
5620 std::move(recording)); 5620 std::move(recording));
5621 layer->SetBounds(gfx::Size(500, 500)); 5621 layer->SetBounds(gfx::Size(500, 500));
5622 layer->SetContentsOpaque(true); 5622 layer->SetContentsOpaque(true);
5623 // Avoid LCD text on the layer so we don't cause extra commits when we 5623 // Avoid LCD text on the layer so we don't cause extra commits when we
5624 // pinch. 5624 // pinch.
5625 pinch->AddChild(layer); 5625 pinch->AddChild(layer);
5626 5626
5627 layer_tree_host()->RegisterViewportLayers(NULL, page_scale_layer, pinch, 5627 layer_tree_host()->GetLayerTree()->RegisterViewportLayers(
5628 nullptr); 5628 NULL, page_scale_layer, pinch, nullptr);
5629 layer_tree_host()->SetPageScaleFactorAndLimits(1.f, 1.f, 4.f); 5629 layer_tree_host()->SetPageScaleFactorAndLimits(1.f, 1.f, 4.f);
5630 layer_tree_host()->SetRootLayer(root_clip); 5630 layer_tree_host()->SetRootLayer(root_clip);
5631 LayerTreeHostTest::SetupTree(); 5631 LayerTreeHostTest::SetupTree();
5632 client_.set_bounds(root_clip->bounds()); 5632 client_.set_bounds(root_clip->bounds());
5633 } 5633 }
5634 5634
5635 // Returns the delta scale of all quads in the frame's root pass from their 5635 // Returns the delta scale of all quads in the frame's root pass from their
5636 // ideal, or 0 if they are not all the same. 5636 // ideal, or 0 if they are not all the same.
5637 float FrameQuadScaleDeltaFromIdeal(LayerTreeHostImpl::FrameData* frame_data) { 5637 float FrameQuadScaleDeltaFromIdeal(LayerTreeHostImpl::FrameData* frame_data) {
5638 if (frame_data->has_no_damage) 5638 if (frame_data->has_no_damage)
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
5920 recording->SetPlaybackAllowedEvent(&playback_allowed_event_); 5920 recording->SetPlaybackAllowedEvent(&playback_allowed_event_);
5921 scoped_refptr<FakePictureLayer> layer = 5921 scoped_refptr<FakePictureLayer> layer =
5922 FakePictureLayer::CreateWithRecordingSource(&client_, 5922 FakePictureLayer::CreateWithRecordingSource(&client_,
5923 std::move(recording)); 5923 std::move(recording));
5924 layer->SetBounds(gfx::Size(500, 500)); 5924 layer->SetBounds(gfx::Size(500, 500));
5925 layer->SetContentsOpaque(true); 5925 layer->SetContentsOpaque(true);
5926 // Avoid LCD text on the layer so we don't cause extra commits when we 5926 // Avoid LCD text on the layer so we don't cause extra commits when we
5927 // pinch. 5927 // pinch.
5928 pinch->AddChild(layer); 5928 pinch->AddChild(layer);
5929 5929
5930 layer_tree_host()->RegisterViewportLayers(NULL, page_scale_layer, pinch, 5930 layer_tree_host()->GetLayerTree()->RegisterViewportLayers(
5931 nullptr); 5931 NULL, page_scale_layer, pinch, nullptr);
5932 layer_tree_host()->SetPageScaleFactorAndLimits(1.f, 1.f, 4.f); 5932 layer_tree_host()->SetPageScaleFactorAndLimits(1.f, 1.f, 4.f);
5933 layer_tree_host()->SetRootLayer(root_clip); 5933 layer_tree_host()->SetRootLayer(root_clip);
5934 LayerTreeHostTest::SetupTree(); 5934 LayerTreeHostTest::SetupTree();
5935 client_.set_bounds(root_clip->bounds()); 5935 client_.set_bounds(root_clip->bounds());
5936 } 5936 }
5937 5937
5938 // Returns the delta scale of all quads in the frame's root pass from their 5938 // Returns the delta scale of all quads in the frame's root pass from their
5939 // ideal, or 0 if they are not all the same. 5939 // ideal, or 0 if they are not all the same.
5940 float FrameQuadScaleDeltaFromIdeal(LayerTreeHostImpl::FrameData* frame_data) { 5940 float FrameQuadScaleDeltaFromIdeal(LayerTreeHostImpl::FrameData* frame_data) {
5941 if (frame_data->has_no_damage) 5941 if (frame_data->has_no_damage)
(...skipping 828 matching lines...) Expand 10 before | Expand all | Expand 10 after
6770 page_scale->AddChild(page_scale_child1); 6770 page_scale->AddChild(page_scale_child1);
6771 page_scale->AddChild(page_scale_child2); 6771 page_scale->AddChild(page_scale_child2);
6772 page_scale_child1->AddChild(page_scale_grandchild); 6772 page_scale_child1->AddChild(page_scale_grandchild);
6773 6773
6774 layer_tree_host()->SetRootLayer(root); 6774 layer_tree_host()->SetRootLayer(root);
6775 LayerTreeTest::SetupTree(); 6775 LayerTreeTest::SetupTree();
6776 6776
6777 scoped_refptr<Layer> overscroll_elasticity_layer = nullptr; 6777 scoped_refptr<Layer> overscroll_elasticity_layer = nullptr;
6778 scoped_refptr<Layer> inner_viewport_scroll_layer = nullptr; 6778 scoped_refptr<Layer> inner_viewport_scroll_layer = nullptr;
6779 scoped_refptr<Layer> outer_viewport_scroll_layer = nullptr; 6779 scoped_refptr<Layer> outer_viewport_scroll_layer = nullptr;
6780 layer_tree_host()->RegisterViewportLayers( 6780 layer_tree_host()->GetLayerTree()->RegisterViewportLayers(
6781 overscroll_elasticity_layer, page_scale, inner_viewport_scroll_layer, 6781 overscroll_elasticity_layer, page_scale, inner_viewport_scroll_layer,
6782 outer_viewport_scroll_layer); 6782 outer_viewport_scroll_layer);
6783 6783
6784 affected_by_page_scale_.push_back(page_scale->id()); 6784 affected_by_page_scale_.push_back(page_scale->id());
6785 affected_by_page_scale_.push_back(page_scale_child1->id()); 6785 affected_by_page_scale_.push_back(page_scale_child1->id());
6786 affected_by_page_scale_.push_back(page_scale_child2->id()); 6786 affected_by_page_scale_.push_back(page_scale_child2->id());
6787 affected_by_page_scale_.push_back(page_scale_grandchild->id()); 6787 affected_by_page_scale_.push_back(page_scale_grandchild->id());
6788 6788
6789 not_affected_by_page_scale_.push_back(root->id()); 6789 not_affected_by_page_scale_.push_back(root->id());
6790 not_affected_by_page_scale_.push_back(pre_page_scale->id()); 6790 not_affected_by_page_scale_.push_back(pre_page_scale->id());
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
6941 private: 6941 private:
6942 FakeContentLayerClient client_; 6942 FakeContentLayerClient client_;
6943 const gfx::Size viewport_size_; 6943 const gfx::Size viewport_size_;
6944 const gfx::Size large_image_size_; 6944 const gfx::Size large_image_size_;
6945 }; 6945 };
6946 6946
6947 SINGLE_AND_MULTI_THREAD_TEST_F(GpuRasterizationSucceedsWithLargeImage); 6947 SINGLE_AND_MULTI_THREAD_TEST_F(GpuRasterizationSucceedsWithLargeImage);
6948 6948
6949 } // namespace 6949 } // namespace
6950 } // namespace cc 6950 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698