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

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

Issue 1154393003: cc: Use CheckedNumeric for resource size calculations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: initialize var Created 5 years, 6 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.cc ('k') | cc/trees/layer_tree_host.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/thread_task_runner_handle.h" 5 #include "base/thread_task_runner_handle.h"
6 #include "cc/resources/resource_pool.h" 6 #include "cc/resources/resource_pool.h"
7 #include "cc/test/begin_frame_args_test.h" 7 #include "cc/test/begin_frame_args_test.h"
8 #include "cc/test/fake_impl_proxy.h" 8 #include "cc/test/fake_impl_proxy.h"
9 #include "cc/test/fake_layer_tree_host_impl.h" 9 #include "cc/test/fake_layer_tree_host_impl.h"
10 #include "cc/test/fake_output_surface.h" 10 #include "cc/test/fake_output_surface.h"
(...skipping 1389 matching lines...) Expand 10 before | Expand all | Expand 10 after
1400 // Verify that the queue has a required for draw tile at Top. 1400 // Verify that the queue has a required for draw tile at Top.
1401 scoped_ptr<RasterTilePriorityQueue> queue(host_impl_.BuildRasterQueue( 1401 scoped_ptr<RasterTilePriorityQueue> queue(host_impl_.BuildRasterQueue(
1402 SAME_PRIORITY_FOR_BOTH_TREES, RasterTilePriorityQueue::Type::ALL)); 1402 SAME_PRIORITY_FOR_BOTH_TREES, RasterTilePriorityQueue::Type::ALL));
1403 EXPECT_FALSE(queue->IsEmpty()); 1403 EXPECT_FALSE(queue->IsEmpty());
1404 EXPECT_TRUE(queue->Top().tile()->required_for_draw()); 1404 EXPECT_TRUE(queue->Top().tile()->required_for_draw());
1405 EXPECT_EQ(gfx::Size(256, 256), queue->Top().tile()->desired_texture_size()); 1405 EXPECT_EQ(gfx::Size(256, 256), queue->Top().tile()->desired_texture_size());
1406 EXPECT_EQ(RGBA_8888, host_impl_.resource_provider()->best_texture_format()); 1406 EXPECT_EQ(RGBA_8888, host_impl_.resource_provider()->best_texture_format());
1407 1407
1408 ManagedMemoryPolicy policy = host_impl_.ActualManagedMemoryPolicy(); 1408 ManagedMemoryPolicy policy = host_impl_.ActualManagedMemoryPolicy();
1409 policy.bytes_limit_when_visible = 1409 policy.bytes_limit_when_visible =
1410 Resource::MemorySizeBytes(gfx::Size(256, 256), RGBA_8888); 1410 Resource::UncheckedMemorySizeBytes(gfx::Size(256, 256), RGBA_8888);
1411 host_impl_.SetMemoryPolicy(policy); 1411 host_impl_.SetMemoryPolicy(policy);
1412 1412
1413 EXPECT_FALSE(host_impl_.is_likely_to_require_a_draw()); 1413 EXPECT_FALSE(host_impl_.is_likely_to_require_a_draw());
1414 host_impl_.tile_manager()->PrepareTiles(host_impl_.global_tile_state()); 1414 host_impl_.tile_manager()->PrepareTiles(host_impl_.global_tile_state());
1415 EXPECT_TRUE(host_impl_.is_likely_to_require_a_draw()); 1415 EXPECT_TRUE(host_impl_.is_likely_to_require_a_draw());
1416 1416
1417 scoped_ptr<ScopedResource> resource = 1417 scoped_ptr<ScopedResource> resource =
1418 host_impl_.resource_pool()->AcquireResource(gfx::Size(256, 256), 1418 host_impl_.resource_pool()->AcquireResource(gfx::Size(256, 256),
1419 RGBA_8888); 1419 RGBA_8888);
1420 1420
1421 host_impl_.tile_manager()->CheckIfMoreTilesNeedToBePreparedForTesting(); 1421 host_impl_.tile_manager()->CheckIfMoreTilesNeedToBePreparedForTesting();
1422 EXPECT_FALSE(host_impl_.is_likely_to_require_a_draw()); 1422 EXPECT_FALSE(host_impl_.is_likely_to_require_a_draw());
1423 1423
1424 host_impl_.resource_pool()->ReleaseResource(resource.Pass(), 0); 1424 host_impl_.resource_pool()->ReleaseResource(resource.Pass(), 0);
1425 } 1425 }
1426 1426
1427 } // namespace 1427 } // namespace
1428 } // namespace cc 1428 } // namespace cc
OLDNEW
« no previous file with comments | « cc/tiles/tile_manager.cc ('k') | cc/trees/layer_tree_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698