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

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

Issue 1362663002: cc: Remove PicturePile and PicturePileImpl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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_impl.h" 5 #include "cc/trees/layer_tree_host_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 25 matching lines...) Expand all
36 #include "cc/output/copy_output_request.h" 36 #include "cc/output/copy_output_request.h"
37 #include "cc/output/copy_output_result.h" 37 #include "cc/output/copy_output_result.h"
38 #include "cc/output/gl_renderer.h" 38 #include "cc/output/gl_renderer.h"
39 #include "cc/output/latency_info_swap_promise.h" 39 #include "cc/output/latency_info_swap_promise.h"
40 #include "cc/quads/render_pass_draw_quad.h" 40 #include "cc/quads/render_pass_draw_quad.h"
41 #include "cc/quads/solid_color_draw_quad.h" 41 #include "cc/quads/solid_color_draw_quad.h"
42 #include "cc/quads/texture_draw_quad.h" 42 #include "cc/quads/texture_draw_quad.h"
43 #include "cc/quads/tile_draw_quad.h" 43 #include "cc/quads/tile_draw_quad.h"
44 #include "cc/test/animation_test_common.h" 44 #include "cc/test/animation_test_common.h"
45 #include "cc/test/begin_frame_args_test.h" 45 #include "cc/test/begin_frame_args_test.h"
46 #include "cc/test/fake_display_list_raster_source.h"
46 #include "cc/test/fake_layer_tree_host_impl.h" 47 #include "cc/test/fake_layer_tree_host_impl.h"
47 #include "cc/test/fake_output_surface.h" 48 #include "cc/test/fake_output_surface.h"
48 #include "cc/test/fake_output_surface_client.h" 49 #include "cc/test/fake_output_surface_client.h"
49 #include "cc/test/fake_picture_layer_impl.h" 50 #include "cc/test/fake_picture_layer_impl.h"
50 #include "cc/test/fake_picture_pile_impl.h"
51 #include "cc/test/fake_proxy.h" 51 #include "cc/test/fake_proxy.h"
52 #include "cc/test/fake_video_frame_provider.h" 52 #include "cc/test/fake_video_frame_provider.h"
53 #include "cc/test/geometry_test_utils.h" 53 #include "cc/test/geometry_test_utils.h"
54 #include "cc/test/gpu_rasterization_enabled_settings.h" 54 #include "cc/test/gpu_rasterization_enabled_settings.h"
55 #include "cc/test/layer_test_common.h" 55 #include "cc/test/layer_test_common.h"
56 #include "cc/test/layer_tree_test.h" 56 #include "cc/test/layer_tree_test.h"
57 #include "cc/test/test_gpu_memory_buffer_manager.h" 57 #include "cc/test/test_gpu_memory_buffer_manager.h"
58 #include "cc/test/test_shared_bitmap_manager.h" 58 #include "cc/test/test_shared_bitmap_manager.h"
59 #include "cc/test/test_task_graph_runner.h" 59 #include "cc/test/test_task_graph_runner.h"
60 #include "cc/test/test_web_graphics_context_3d.h" 60 #include "cc/test/test_web_graphics_context_3d.h"
(...skipping 6225 matching lines...) Expand 10 before | Expand all | Expand 10 after
6286 root->SetHasRenderSurface(true); 6286 root->SetHasRenderSurface(true);
6287 6287
6288 host_impl_->pending_tree()->SetRootLayer(scoped_root.Pass()); 6288 host_impl_->pending_tree()->SetRootLayer(scoped_root.Pass());
6289 6289
6290 scoped_ptr<LayerImpl> scoped_scrolling_layer = 6290 scoped_ptr<LayerImpl> scoped_scrolling_layer =
6291 LayerImpl::Create(host_impl_->pending_tree(), 2); 6291 LayerImpl::Create(host_impl_->pending_tree(), 2);
6292 LayerImpl* scrolling_layer = scoped_scrolling_layer.get(); 6292 LayerImpl* scrolling_layer = scoped_scrolling_layer.get();
6293 root->AddChild(scoped_scrolling_layer.Pass()); 6293 root->AddChild(scoped_scrolling_layer.Pass());
6294 6294
6295 gfx::Size content_layer_bounds(100000, 100); 6295 gfx::Size content_layer_bounds(100000, 100);
6296 gfx::Size pile_tile_size(3000, 3000); 6296 scoped_refptr<FakeDisplayListRasterSource> raster_source(
6297 scoped_refptr<FakePicturePileImpl> pile(FakePicturePileImpl::CreateFilledPile( 6297 FakeDisplayListRasterSource::CreateFilled(content_layer_bounds));
6298 pile_tile_size, content_layer_bounds));
6299 6298
6300 scoped_ptr<FakePictureLayerImpl> scoped_content_layer = 6299 scoped_ptr<FakePictureLayerImpl> scoped_content_layer =
6301 FakePictureLayerImpl::CreateWithRasterSource(host_impl_->pending_tree(), 6300 FakePictureLayerImpl::CreateWithRasterSource(host_impl_->pending_tree(),
6302 3, pile); 6301 3, raster_source);
6303 LayerImpl* content_layer = scoped_content_layer.get(); 6302 LayerImpl* content_layer = scoped_content_layer.get();
6304 scrolling_layer->AddChild(scoped_content_layer.Pass()); 6303 scrolling_layer->AddChild(scoped_content_layer.Pass());
6305 content_layer->SetBounds(content_layer_bounds); 6304 content_layer->SetBounds(content_layer_bounds);
6306 content_layer->SetDrawsContent(true); 6305 content_layer->SetDrawsContent(true);
6307 6306
6308 root->SetBounds(root_size); 6307 root->SetBounds(root_size);
6309 6308
6310 gfx::ScrollOffset scroll_offset(100000, 0); 6309 gfx::ScrollOffset scroll_offset(100000, 0);
6311 scrolling_layer->SetScrollClipLayer(root->id()); 6310 scrolling_layer->SetScrollClipLayer(root->id());
6312 scrolling_layer->PushScrollOffsetFromMainThread(scroll_offset); 6311 scrolling_layer->PushScrollOffsetFromMainThread(scroll_offset);
(...skipping 1806 matching lines...) Expand 10 before | Expand all | Expand 10 after
8119 EXPECT_VECTOR_EQ(gfx::ScrollOffset(0, 100), 8118 EXPECT_VECTOR_EQ(gfx::ScrollOffset(0, 100),
8120 scrolling_layer->CurrentScrollOffset()); 8119 scrolling_layer->CurrentScrollOffset());
8121 EXPECT_EQ(NULL, host_impl_->CurrentlyScrollingLayer()); 8120 EXPECT_EQ(NULL, host_impl_->CurrentlyScrollingLayer());
8122 host_impl_->DidFinishImplFrame(); 8121 host_impl_->DidFinishImplFrame();
8123 } 8122 }
8124 8123
8125 TEST_F(LayerTreeHostImplTest, InvalidLayerNotAddedToRasterQueue) { 8124 TEST_F(LayerTreeHostImplTest, InvalidLayerNotAddedToRasterQueue) {
8126 host_impl_->CreatePendingTree(); 8125 host_impl_->CreatePendingTree();
8127 8126
8128 Region empty_invalidation; 8127 Region empty_invalidation;
8129 scoped_refptr<RasterSource> pile_with_tiles( 8128 scoped_refptr<RasterSource> raster_source_with_tiles(
8130 FakePicturePileImpl::CreateFilledPileWithDefaultTileSize( 8129 FakeDisplayListRasterSource::CreateFilled(gfx::Size(10, 10)));
8131 gfx::Size(10, 10)));
8132 8130
8133 scoped_ptr<FakePictureLayerImpl> layer = 8131 scoped_ptr<FakePictureLayerImpl> layer =
8134 FakePictureLayerImpl::Create(host_impl_->pending_tree(), 11); 8132 FakePictureLayerImpl::Create(host_impl_->pending_tree(), 11);
8135 layer->SetBounds(gfx::Size(10, 10)); 8133 layer->SetBounds(gfx::Size(10, 10));
8136 layer->set_gpu_raster_max_texture_size(host_impl_->device_viewport_size()); 8134 layer->set_gpu_raster_max_texture_size(host_impl_->device_viewport_size());
8137 layer->SetDrawsContent(true); 8135 layer->SetDrawsContent(true);
8138 layer->tilings()->AddTiling(1.0f, pile_with_tiles); 8136 layer->tilings()->AddTiling(1.0f, raster_source_with_tiles);
8139 layer->UpdateRasterSource(pile_with_tiles, &empty_invalidation, nullptr); 8137 layer->UpdateRasterSource(raster_source_with_tiles, &empty_invalidation,
8138 nullptr);
8140 layer->tilings()->tiling_at(0)->set_resolution( 8139 layer->tilings()->tiling_at(0)->set_resolution(
8141 TileResolution::HIGH_RESOLUTION); 8140 TileResolution::HIGH_RESOLUTION);
8142 layer->tilings()->tiling_at(0)->CreateAllTilesForTesting(); 8141 layer->tilings()->tiling_at(0)->CreateAllTilesForTesting();
8143 layer->tilings()->tiling_at(0)->ComputeTilePriorityRects( 8142 layer->tilings()->tiling_at(0)->ComputeTilePriorityRects(
8144 gfx::Rect(gfx::Size(10, 10)), 1.f, 1.0, Occlusion()); 8143 gfx::Rect(gfx::Size(10, 10)), 1.f, 1.0, Occlusion());
8145 host_impl_->pending_tree()->SetRootLayer(layer.Pass()); 8144 host_impl_->pending_tree()->SetRootLayer(layer.Pass());
8146 8145
8147 FakePictureLayerImpl* root_layer = static_cast<FakePictureLayerImpl*>( 8146 FakePictureLayerImpl* root_layer = static_cast<FakePictureLayerImpl*>(
8148 host_impl_->pending_tree()->root_layer()); 8147 host_impl_->pending_tree()->root_layer());
8149 8148
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
8550 // Hold an unowned pointer to the output surface to use for mock expectations. 8549 // Hold an unowned pointer to the output surface to use for mock expectations.
8551 MockReclaimResourcesOutputSurface* mock_output_surface = output_surface.get(); 8550 MockReclaimResourcesOutputSurface* mock_output_surface = output_surface.get();
8552 8551
8553 CreateHostImpl(DefaultSettings(), output_surface.Pass()); 8552 CreateHostImpl(DefaultSettings(), output_surface.Pass());
8554 EXPECT_CALL(*mock_output_surface, ForceReclaimResources()).Times(1); 8553 EXPECT_CALL(*mock_output_surface, ForceReclaimResources()).Times(1);
8555 host_impl_->BeginCommit(); 8554 host_impl_->BeginCommit();
8556 } 8555 }
8557 8556
8558 } // namespace 8557 } // namespace
8559 } // namespace cc 8558 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698