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

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: rebase and update Created 5 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
« no previous file with comments | « cc/tiles/tile_manager_unittest.cc ('k') | cc/trees/layer_tree_host_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1803 matching lines...) Expand 10 before | Expand all | Expand 10 after
8116 EXPECT_VECTOR_EQ(gfx::ScrollOffset(0, 100), 8115 EXPECT_VECTOR_EQ(gfx::ScrollOffset(0, 100),
8117 scrolling_layer->CurrentScrollOffset()); 8116 scrolling_layer->CurrentScrollOffset());
8118 EXPECT_EQ(NULL, host_impl_->CurrentlyScrollingLayer()); 8117 EXPECT_EQ(NULL, host_impl_->CurrentlyScrollingLayer());
8119 host_impl_->DidFinishImplFrame(); 8118 host_impl_->DidFinishImplFrame();
8120 } 8119 }
8121 8120
8122 TEST_F(LayerTreeHostImplTest, InvalidLayerNotAddedToRasterQueue) { 8121 TEST_F(LayerTreeHostImplTest, InvalidLayerNotAddedToRasterQueue) {
8123 host_impl_->CreatePendingTree(); 8122 host_impl_->CreatePendingTree();
8124 8123
8125 Region empty_invalidation; 8124 Region empty_invalidation;
8126 scoped_refptr<RasterSource> pile_with_tiles( 8125 scoped_refptr<RasterSource> raster_source_with_tiles(
8127 FakePicturePileImpl::CreateFilledPileWithDefaultTileSize( 8126 FakeDisplayListRasterSource::CreateFilled(gfx::Size(10, 10)));
8128 gfx::Size(10, 10)));
8129 8127
8130 scoped_ptr<FakePictureLayerImpl> layer = 8128 scoped_ptr<FakePictureLayerImpl> layer =
8131 FakePictureLayerImpl::Create(host_impl_->pending_tree(), 11); 8129 FakePictureLayerImpl::Create(host_impl_->pending_tree(), 11);
8132 layer->SetBounds(gfx::Size(10, 10)); 8130 layer->SetBounds(gfx::Size(10, 10));
8133 layer->set_gpu_raster_max_texture_size(host_impl_->device_viewport_size()); 8131 layer->set_gpu_raster_max_texture_size(host_impl_->device_viewport_size());
8134 layer->SetDrawsContent(true); 8132 layer->SetDrawsContent(true);
8135 layer->tilings()->AddTiling(1.0f, pile_with_tiles); 8133 layer->tilings()->AddTiling(1.0f, raster_source_with_tiles);
8136 layer->UpdateRasterSource(pile_with_tiles, &empty_invalidation, nullptr); 8134 layer->UpdateRasterSource(raster_source_with_tiles, &empty_invalidation,
8135 nullptr);
8137 layer->tilings()->tiling_at(0)->set_resolution( 8136 layer->tilings()->tiling_at(0)->set_resolution(
8138 TileResolution::HIGH_RESOLUTION); 8137 TileResolution::HIGH_RESOLUTION);
8139 layer->tilings()->tiling_at(0)->CreateAllTilesForTesting(); 8138 layer->tilings()->tiling_at(0)->CreateAllTilesForTesting();
8140 layer->tilings()->tiling_at(0)->ComputeTilePriorityRects( 8139 layer->tilings()->tiling_at(0)->ComputeTilePriorityRects(
8141 gfx::Rect(gfx::Size(10, 10)), 1.f, 1.0, Occlusion()); 8140 gfx::Rect(gfx::Size(10, 10)), 1.f, 1.0, Occlusion());
8142 host_impl_->pending_tree()->SetRootLayer(layer.Pass()); 8141 host_impl_->pending_tree()->SetRootLayer(layer.Pass());
8143 8142
8144 FakePictureLayerImpl* root_layer = static_cast<FakePictureLayerImpl*>( 8143 FakePictureLayerImpl* root_layer = static_cast<FakePictureLayerImpl*>(
8145 host_impl_->pending_tree()->root_layer()); 8144 host_impl_->pending_tree()->root_layer());
8146 8145
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
8547 // Hold an unowned pointer to the output surface to use for mock expectations. 8546 // Hold an unowned pointer to the output surface to use for mock expectations.
8548 MockReclaimResourcesOutputSurface* mock_output_surface = output_surface.get(); 8547 MockReclaimResourcesOutputSurface* mock_output_surface = output_surface.get();
8549 8548
8550 CreateHostImpl(DefaultSettings(), output_surface.Pass()); 8549 CreateHostImpl(DefaultSettings(), output_surface.Pass());
8551 EXPECT_CALL(*mock_output_surface, ForceReclaimResources()).Times(1); 8550 EXPECT_CALL(*mock_output_surface, ForceReclaimResources()).Times(1);
8552 host_impl_->BeginCommit(); 8551 host_impl_->BeginCommit();
8553 } 8552 }
8554 8553
8555 } // namespace 8554 } // namespace
8556 } // namespace cc 8555 } // namespace cc
OLDNEW
« no previous file with comments | « cc/tiles/tile_manager_unittest.cc ('k') | cc/trees/layer_tree_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698