Index: cc/resources/resource.h |
diff --git a/cc/resources/resource.h b/cc/resources/resource.h |
index f9138fbb876ef405c8afada390cf4031f92f4b92..549a314d48eb601fc7eba5fc438378d0eb039c7b 100644 |
--- a/cc/resources/resource.h |
+++ b/cc/resources/resource.h |
@@ -5,9 +5,9 @@ |
#ifndef CC_RESOURCES_RESOURCE_H_ |
#define CC_RESOURCES_RESOURCE_H_ |
-#include "base/numerics/safe_math.h" |
#include "cc/base/cc_export.h" |
#include "cc/resources/resource_provider.h" |
+#include "cc/resources/resource_util.h" |
#include "ui/gfx/geometry/size.h" |
namespace cc { |
@@ -24,37 +24,6 @@ class CC_EXPORT Resource { |
gfx::Size size() const { return size_; } |
ResourceFormat format() const { return format_; } |
- // Return true if the call to UncheckedMemorySizeBytes would return a value |
- // that fits in a size_t. |
- static bool VerifySizeInBytes(const gfx::Size& size, ResourceFormat format) { |
- base::CheckedNumeric<size_t> checked_value = BitsPerPixel(format); |
- checked_value *= size.width(); |
- checked_value *= size.height(); |
- if (!checked_value.IsValid()) |
- return false; |
- size_t value = checked_value.ValueOrDie(); |
- if ((value % 8) != 0) |
- return false; |
- return true; |
- } |
- |
- static size_t CheckedMemorySizeBytes(const gfx::Size& size, |
- ResourceFormat format) { |
- DCHECK(VerifySizeInBytes(size, format)); |
- base::CheckedNumeric<size_t> checked_value = BitsPerPixel(format); |
- checked_value *= size.width(); |
- checked_value *= size.height(); |
- checked_value /= 8; |
- return checked_value.ValueOrDie(); |
- } |
- |
- inline static size_t UncheckedMemorySizeBytes(const gfx::Size& size, |
- ResourceFormat format) { |
- DCHECK(VerifySizeInBytes(size, format)); |
- return static_cast<size_t>(BitsPerPixel(format)) * size.width() * |
- size.height() / 8; |
- } |
- |
protected: |
void set_id(ResourceId id) { id_ = id; } |
void set_dimensions(const gfx::Size& size, ResourceFormat format) { |