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

Side by Side Diff: cc/resources/prioritized_resource_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/resources/prioritized_resource_manager.cc ('k') | cc/resources/resource.h » ('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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/resources/prioritized_resource.h" 5 #include "cc/resources/prioritized_resource.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "cc/resources/prioritized_resource_manager.h" 9 #include "cc/resources/prioritized_resource_manager.h"
10 #include "cc/resources/resource.h" 10 #include "cc/resources/resource.h"
(...skipping 21 matching lines...) Expand all
32 resource_provider_ = FakeResourceProvider::Create( 32 resource_provider_ = FakeResourceProvider::Create(
33 output_surface_.get(), shared_bitmap_manager_.get()); 33 output_surface_.get(), shared_bitmap_manager_.get());
34 } 34 }
35 35
36 ~PrioritizedResourceTest() override { 36 ~PrioritizedResourceTest() override {
37 DebugScopedSetImplThread impl_thread(&proxy_); 37 DebugScopedSetImplThread impl_thread(&proxy_);
38 resource_provider_ = nullptr; 38 resource_provider_ = nullptr;
39 } 39 }
40 40
41 size_t TexturesMemorySize(size_t texture_count) { 41 size_t TexturesMemorySize(size_t texture_count) {
42 return Resource::MemorySizeBytes(texture_size_, texture_format_) * 42 return Resource::UncheckedMemorySizeBytes(texture_size_, texture_format_) *
43 texture_count; 43 texture_count;
44 } 44 }
45 45
46 scoped_ptr<PrioritizedResourceManager> CreateManager(size_t max_textures) { 46 scoped_ptr<PrioritizedResourceManager> CreateManager(size_t max_textures) {
47 scoped_ptr<PrioritizedResourceManager> manager = 47 scoped_ptr<PrioritizedResourceManager> manager =
48 PrioritizedResourceManager::Create(&proxy_); 48 PrioritizedResourceManager::Create(&proxy_);
49 manager->SetMaxMemoryLimitBytes(TexturesMemorySize(max_textures)); 49 manager->SetMaxMemoryLimitBytes(TexturesMemorySize(max_textures));
50 return manager.Pass(); 50 return manager.Pass();
51 } 51 }
52 52
(...skipping 1051 matching lines...) Expand 10 before | Expand all | Expand 10 after
1104 resource_manager->MemoryVisibleAndNearbyBytes()); 1104 resource_manager->MemoryVisibleAndNearbyBytes());
1105 } 1105 }
1106 1106
1107 DebugScopedSetImplThreadAndMainThreadBlocked 1107 DebugScopedSetImplThreadAndMainThreadBlocked
1108 impl_thread_and_main_thread_blocked(&proxy_); 1108 impl_thread_and_main_thread_blocked(&proxy_);
1109 resource_manager->ClearAllMemory(resource_provider()); 1109 resource_manager->ClearAllMemory(resource_provider());
1110 } 1110 }
1111 1111
1112 } // namespace 1112 } // namespace
1113 } // namespace cc 1113 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/prioritized_resource_manager.cc ('k') | cc/resources/resource.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698