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

Side by Side Diff: cc/tiles/tile_manager_unittest.cc

Issue 1405883002: cc: Remove the base RasterSource (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge more 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
« no previous file with comments | « cc/tiles/tile_manager_perftest.cc ('k') | cc/trees/layer_tree_host_impl_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 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 "base/run_loop.h" 5 #include "base/run_loop.h"
6 #include "base/thread_task_runner_handle.h" 6 #include "base/thread_task_runner_handle.h"
7 #include "cc/playback/display_list_raster_source.h" 7 #include "cc/playback/display_list_raster_source.h"
8 #include "cc/playback/display_list_recording_source.h" 8 #include "cc/playback/display_list_recording_source.h"
9 #include "cc/raster/raster_buffer.h" 9 #include "cc/raster/raster_buffer.h"
10 #include "cc/resources/resource_pool.h" 10 #include "cc/resources/resource_pool.h"
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 host_impl_.active_tree()->UpdateDrawProperties(update_lcd_text); 105 host_impl_.active_tree()->UpdateDrawProperties(update_lcd_text);
106 } 106 }
107 107
108 void SetupDefaultTreesWithFixedTileSize(const gfx::Size& layer_bounds, 108 void SetupDefaultTreesWithFixedTileSize(const gfx::Size& layer_bounds,
109 const gfx::Size& tile_size) { 109 const gfx::Size& tile_size) {
110 SetupDefaultTrees(layer_bounds); 110 SetupDefaultTrees(layer_bounds);
111 pending_layer_->set_fixed_tile_size(tile_size); 111 pending_layer_->set_fixed_tile_size(tile_size);
112 active_layer_->set_fixed_tile_size(tile_size); 112 active_layer_->set_fixed_tile_size(tile_size);
113 } 113 }
114 114
115 void SetupTrees(scoped_refptr<RasterSource> pending_raster_source, 115 void SetupTrees(scoped_refptr<DisplayListRasterSource> pending_raster_source,
116 scoped_refptr<RasterSource> active_raster_source) { 116 scoped_refptr<DisplayListRasterSource> active_raster_source) {
117 SetupPendingTree(active_raster_source); 117 SetupPendingTree(active_raster_source);
118 ActivateTree(); 118 ActivateTree();
119 SetupPendingTree(pending_raster_source); 119 SetupPendingTree(pending_raster_source);
120 } 120 }
121 121
122 void SetupPendingTree(scoped_refptr<RasterSource> raster_source) { 122 void SetupPendingTree(scoped_refptr<DisplayListRasterSource> raster_source) {
123 host_impl_.CreatePendingTree(); 123 host_impl_.CreatePendingTree();
124 LayerTreeImpl* pending_tree = host_impl_.pending_tree(); 124 LayerTreeImpl* pending_tree = host_impl_.pending_tree();
125 125
126 // Steal from the recycled tree. 126 // Steal from the recycled tree.
127 scoped_ptr<LayerImpl> old_pending_root = pending_tree->DetachLayerTree(); 127 scoped_ptr<LayerImpl> old_pending_root = pending_tree->DetachLayerTree();
128 DCHECK_IMPLIES(old_pending_root, old_pending_root->id() == id_); 128 DCHECK_IMPLIES(old_pending_root, old_pending_root->id() == id_);
129 129
130 scoped_ptr<FakePictureLayerImpl> pending_layer; 130 scoped_ptr<FakePictureLayerImpl> pending_layer;
131 if (old_pending_root) { 131 if (old_pending_root) {
132 pending_layer.reset( 132 pending_layer.reset(
(...skipping 1374 matching lines...) Expand 10 before | Expand all | Expand 10 after
1507 } 1507 }
1508 } 1508 }
1509 1509
1510 TEST_F(TileManagerTest, LowResHasNoImage) { 1510 TEST_F(TileManagerTest, LowResHasNoImage) {
1511 gfx::Size size(10, 12); 1511 gfx::Size size(10, 12);
1512 TileResolution resolutions[] = {HIGH_RESOLUTION, LOW_RESOLUTION}; 1512 TileResolution resolutions[] = {HIGH_RESOLUTION, LOW_RESOLUTION};
1513 1513
1514 for (size_t i = 0; i < arraysize(resolutions); ++i) { 1514 for (size_t i = 0; i < arraysize(resolutions); ++i) {
1515 SCOPED_TRACE(resolutions[i]); 1515 SCOPED_TRACE(resolutions[i]);
1516 1516
1517 // Make a RasterSource that will draw a blue bitmap image. 1517 // Make a DisplayListRasterSource that will draw a blue bitmap image.
1518 skia::RefPtr<SkSurface> surface = skia::AdoptRef( 1518 skia::RefPtr<SkSurface> surface = skia::AdoptRef(
1519 SkSurface::NewRasterN32Premul(size.width(), size.height())); 1519 SkSurface::NewRasterN32Premul(size.width(), size.height()));
1520 ASSERT_NE(surface, nullptr); 1520 ASSERT_NE(surface, nullptr);
1521 surface->getCanvas()->clear(SK_ColorBLUE); 1521 surface->getCanvas()->clear(SK_ColorBLUE);
1522 skia::RefPtr<SkImage> blue_image = 1522 skia::RefPtr<SkImage> blue_image =
1523 skia::AdoptRef(surface->newImageSnapshot()); 1523 skia::AdoptRef(surface->newImageSnapshot());
1524 1524
1525 scoped_ptr<FakeDisplayListRecordingSource> recording_source = 1525 scoped_ptr<FakeDisplayListRecordingSource> recording_source =
1526 FakeDisplayListRecordingSource::CreateFilledRecordingSource(size); 1526 FakeDisplayListRecordingSource::CreateFilledRecordingSource(size);
1527 recording_source->SetBackgroundColor(SK_ColorTRANSPARENT); 1527 recording_source->SetBackgroundColor(SK_ColorTRANSPARENT);
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
1676 EXPECT_FALSE(host_impl_->resource_pool()->TryAcquireResourceWithContentId( 1676 EXPECT_FALSE(host_impl_->resource_pool()->TryAcquireResourceWithContentId(
1677 invalidated_id)); 1677 invalidated_id));
1678 1678
1679 // Free our host_impl_ before the cancelling_runner we passed it, as it will 1679 // Free our host_impl_ before the cancelling_runner we passed it, as it will
1680 // use that class in clean up. 1680 // use that class in clean up.
1681 host_impl_ = nullptr; 1681 host_impl_ = nullptr;
1682 } 1682 }
1683 1683
1684 } // namespace 1684 } // namespace
1685 } // namespace cc 1685 } // namespace cc
OLDNEW
« no previous file with comments | « cc/tiles/tile_manager_perftest.cc ('k') | cc/trees/layer_tree_host_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698