summaryrefslogtreecommitdiff
path: root/chromium/gpu/command_buffer/client/client_discardable_manager.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/gpu/command_buffer/client/client_discardable_manager.cc')
-rw-r--r--chromium/gpu/command_buffer/client/client_discardable_manager.cc11
1 files changed, 6 insertions, 5 deletions
diff --git a/chromium/gpu/command_buffer/client/client_discardable_manager.cc b/chromium/gpu/command_buffer/client/client_discardable_manager.cc
index 61794ed7b6d..04ed4756cef 100644
--- a/chromium/gpu/command_buffer/client/client_discardable_manager.cc
+++ b/chromium/gpu/command_buffer/client/client_discardable_manager.cc
@@ -5,6 +5,7 @@
#include "gpu/command_buffer/client/client_discardable_manager.h"
#include "base/containers/flat_set.h"
+#include "base/numerics/checked_math.h"
#include "base/sys_info.h"
namespace gpu {
@@ -107,17 +108,17 @@ void FreeOffsetSet::ReturnFreeOffset(uint32_t offset) {
// Returns the size of the allocation which ClientDiscardableManager will
// sub-allocate from. This should be at least as big as the minimum shared
// memory allocation size.
-size_t AllocationSize() {
+uint32_t AllocationSize() {
#if defined(OS_NACL)
// base::SysInfo isn't available under NaCl.
- size_t allocation_size = getpagesize();
+ size_t system_allocation_size = getpagesize();
#else
- size_t allocation_size = base::SysInfo::VMAllocationGranularity();
+ size_t system_allocation_size = base::SysInfo::VMAllocationGranularity();
#endif
+ DCHECK(base::CheckedNumeric<uint32_t>(system_allocation_size).IsValid());
// If the allocation is small (less than 2K), round it up to at least 2K.
- allocation_size = std::max(static_cast<size_t>(2048), allocation_size);
- return allocation_size;
+ return std::max(2048u, static_cast<uint32_t>(system_allocation_size));
}
} // namespace