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

Side by Side Diff: cc/layers/picture_layer_impl_unittest.cc

Issue 2141233002: cc: Clean up RecordingSource API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove recoding_source_ from PictureLayer, and move all its internal state to PictureLayer Created 4 years, 5 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 "cc/layers/picture_layer_impl.h" 5 #include "cc/layers/picture_layer_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <limits> 10 #include <limits>
(...skipping 4312 matching lines...) Expand 10 before | Expand all | Expand 10 after
4323 FakeLayerTreeHost::Create(&host_client, &task_graph_runner); 4323 FakeLayerTreeHost::Create(&host_client, &task_graph_runner);
4324 host->SetRootLayer(layer); 4324 host->SetRootLayer(layer);
4325 RecordingSource* recording_source = layer->GetRecordingSourceForTesting(); 4325 RecordingSource* recording_source = layer->GetRecordingSourceForTesting();
4326 4326
4327 int frame_number = 0; 4327 int frame_number = 0;
4328 4328
4329 client.set_fill_with_nonsolid_color(!test_for_solid); 4329 client.set_fill_with_nonsolid_color(!test_for_solid);
4330 4330
4331 Region invalidation(layer_rect); 4331 Region invalidation(layer_rect);
4332 recording_source->UpdateAndExpandInvalidation( 4332 recording_source->UpdateAndExpandInvalidation(
4333 &client, &invalidation, layer_bounds, frame_number++, 4333 &client, &invalidation, layer_bounds, RecordingSource::RECORD_NORMALLY);
4334 RecordingSource::RECORD_NORMALLY); 4334 frame_number++;
4335 4335
Menglin 2016/07/19 22:56:37 This is test code. don't need to look at change in
4336 scoped_refptr<RasterSource> pending_raster_source = 4336 scoped_refptr<RasterSource> pending_raster_source =
4337 recording_source->CreateRasterSource(true); 4337 recording_source->CreateRasterSource(true);
4338 4338
4339 SetupPendingTreeWithFixedTileSize(pending_raster_source, tile_size, Region()); 4339 SetupPendingTreeWithFixedTileSize(pending_raster_source, tile_size, Region());
4340 ActivateTree(); 4340 ActivateTree();
4341 4341
4342 if (test_for_solid) { 4342 if (test_for_solid) {
4343 EXPECT_EQ(0u, active_layer()->tilings()->num_tilings()); 4343 EXPECT_EQ(0u, active_layer()->tilings()->num_tilings());
4344 } else { 4344 } else {
4345 ASSERT_TRUE(active_layer()->tilings()); 4345 ASSERT_TRUE(active_layer()->tilings());
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
4387 host->SetRootLayer(layer); 4387 host->SetRootLayer(layer);
4388 RecordingSource* recording_source = layer->GetRecordingSourceForTesting(); 4388 RecordingSource* recording_source = layer->GetRecordingSourceForTesting();
4389 4389
4390 int frame_number = 0; 4390 int frame_number = 0;
4391 4391
4392 client.set_fill_with_nonsolid_color(true); 4392 client.set_fill_with_nonsolid_color(true);
4393 4393
4394 recording_source->SetNeedsDisplayRect(layer_rect); 4394 recording_source->SetNeedsDisplayRect(layer_rect);
4395 Region invalidation1; 4395 Region invalidation1;
4396 recording_source->UpdateAndExpandInvalidation( 4396 recording_source->UpdateAndExpandInvalidation(
4397 &client, &invalidation1, layer_bounds, frame_number++, 4397 &client, &invalidation1, layer_bounds, RecordingSource::RECORD_NORMALLY);
4398 RecordingSource::RECORD_NORMALLY); 4398 frame_number++;
4399 4399
4400 scoped_refptr<RasterSource> raster_source1 = 4400 scoped_refptr<RasterSource> raster_source1 =
4401 recording_source->CreateRasterSource(true); 4401 recording_source->CreateRasterSource(true);
4402 4402
4403 SetupPendingTree(raster_source1); 4403 SetupPendingTree(raster_source1);
4404 ActivateTree(); 4404 ActivateTree();
4405 bool update_lcd_text = false; 4405 bool update_lcd_text = false;
4406 host_impl()->active_tree()->UpdateDrawProperties(update_lcd_text); 4406 host_impl()->active_tree()->UpdateDrawProperties(update_lcd_text);
4407 4407
4408 // We've started with a solid layer that contains some tilings. 4408 // We've started with a solid layer that contains some tilings.
4409 ASSERT_TRUE(active_layer()->tilings()); 4409 ASSERT_TRUE(active_layer()->tilings());
4410 EXPECT_NE(0u, active_layer()->tilings()->num_tilings()); 4410 EXPECT_NE(0u, active_layer()->tilings()->num_tilings());
4411 4411
4412 client.set_fill_with_nonsolid_color(false); 4412 client.set_fill_with_nonsolid_color(false);
4413 4413
4414 recording_source->SetNeedsDisplayRect(layer_rect); 4414 recording_source->SetNeedsDisplayRect(layer_rect);
4415 Region invalidation2; 4415 Region invalidation2;
4416 recording_source->UpdateAndExpandInvalidation( 4416 recording_source->UpdateAndExpandInvalidation(
4417 &client, &invalidation2, layer_bounds, frame_number++, 4417 &client, &invalidation2, layer_bounds, RecordingSource::RECORD_NORMALLY);
4418 RecordingSource::RECORD_NORMALLY); 4418 frame_number++;
4419 4419
4420 scoped_refptr<RasterSource> raster_source2 = 4420 scoped_refptr<RasterSource> raster_source2 =
4421 recording_source->CreateRasterSource(true); 4421 recording_source->CreateRasterSource(true);
4422 4422
4423 SetupPendingTree(raster_source2); 4423 SetupPendingTree(raster_source2);
4424 ActivateTree(); 4424 ActivateTree();
4425 4425
4426 // We've switched to a solid color, so we should end up with no tilings. 4426 // We've switched to a solid color, so we should end up with no tilings.
4427 ASSERT_TRUE(active_layer()->tilings()); 4427 ASSERT_TRUE(active_layer()->tilings());
4428 EXPECT_EQ(0u, active_layer()->tilings()->num_tilings()); 4428 EXPECT_EQ(0u, active_layer()->tilings()->num_tilings());
(...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after
5001 EXPECT_FLOAT_EQ(expected_contents_scale, 5001 EXPECT_FLOAT_EQ(expected_contents_scale,
5002 pending_layer_ptr->picture_layer_tiling_set() 5002 pending_layer_ptr->picture_layer_tiling_set()
5003 ->FindTilingWithResolution(HIGH_RESOLUTION) 5003 ->FindTilingWithResolution(HIGH_RESOLUTION)
5004 ->contents_scale()) 5004 ->contents_scale())
5005 << "ideal_contents_scale: " << ideal_contents_scale; 5005 << "ideal_contents_scale: " << ideal_contents_scale;
5006 } 5006 }
5007 } 5007 }
5008 5008
5009 } // namespace 5009 } // namespace
5010 } // namespace cc 5010 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698