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

Side by Side Diff: cc/raster/tile_task_worker_pool_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/raster/pixel_buffer_tile_task_worker_pool.cc ('k') | cc/resources/prioritized_resource.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 "cc/raster/tile_task_worker_pool.h" 5 #include "cc/raster/tile_task_worker_pool.h"
6 6
7 #include <limits> 7 #include <limits>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/cancelable_callback.h" 10 #include "base/cancelable_callback.h"
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 399
400 TEST_P(TileTaskWorkerPoolTest, LargeResources) { 400 TEST_P(TileTaskWorkerPoolTest, LargeResources) {
401 gfx::Size size(kLargeResourceDimension, kLargeResourceDimension); 401 gfx::Size size(kLargeResourceDimension, kLargeResourceDimension);
402 402
403 { 403 {
404 // Verify a resource of this size is larger than the transfer buffer. 404 // Verify a resource of this size is larger than the transfer buffer.
405 scoped_ptr<ScopedResource> resource( 405 scoped_ptr<ScopedResource> resource(
406 ScopedResource::Create(resource_provider_.get())); 406 ScopedResource::Create(resource_provider_.get()));
407 resource->Allocate(size, ResourceProvider::TEXTURE_HINT_IMMUTABLE, 407 resource->Allocate(size, ResourceProvider::TEXTURE_HINT_IMMUTABLE,
408 RGBA_8888); 408 RGBA_8888);
409 EXPECT_GE(resource->bytes(), kMaxTransferBufferUsageBytes); 409 EXPECT_GE(Resource::UncheckedMemorySizeBytes(resource->size(),
410 resource->format()),
411 kMaxTransferBufferUsageBytes);
410 } 412 }
411 413
412 AppendTask(0u, size); 414 AppendTask(0u, size);
413 AppendTask(1u, size); 415 AppendTask(1u, size);
414 AppendTask(2u, size); 416 AppendTask(2u, size);
415 ScheduleTasks(); 417 ScheduleTasks();
416 418
417 // This will time out if a resource that is larger than the throttle limit 419 // This will time out if a resource that is larger than the throttle limit
418 // never gets scheduled. 420 // never gets scheduled.
419 RunMessageLoopUntilAllTasksHaveCompleted(); 421 RunMessageLoopUntilAllTasksHaveCompleted();
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 TileTaskWorkerPoolTests, 455 TileTaskWorkerPoolTests,
454 TileTaskWorkerPoolTest, 456 TileTaskWorkerPoolTest,
455 ::testing::Values(TILE_TASK_WORKER_POOL_TYPE_PIXEL_BUFFER, 457 ::testing::Values(TILE_TASK_WORKER_POOL_TYPE_PIXEL_BUFFER,
456 TILE_TASK_WORKER_POOL_TYPE_ZERO_COPY, 458 TILE_TASK_WORKER_POOL_TYPE_ZERO_COPY,
457 TILE_TASK_WORKER_POOL_TYPE_ONE_COPY, 459 TILE_TASK_WORKER_POOL_TYPE_ONE_COPY,
458 TILE_TASK_WORKER_POOL_TYPE_GPU, 460 TILE_TASK_WORKER_POOL_TYPE_GPU,
459 TILE_TASK_WORKER_POOL_TYPE_BITMAP)); 461 TILE_TASK_WORKER_POOL_TYPE_BITMAP));
460 462
461 } // namespace 463 } // namespace
462 } // namespace cc 464 } // namespace cc
OLDNEW
« no previous file with comments | « cc/raster/pixel_buffer_tile_task_worker_pool.cc ('k') | cc/resources/prioritized_resource.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698