Chromium Code Reviews| Index: skia/ext/skia_utils_base.cc |
| diff --git a/skia/ext/skia_utils_base.cc b/skia/ext/skia_utils_base.cc |
| index c56730bd9bc8f0b1c294617d2ab4e1829aca11d4..83250e17cd752b3a3035337f2de11eb0cd4544f3 100644 |
| --- a/skia/ext/skia_utils_base.cc |
| +++ b/skia/ext/skia_utils_base.cc |
| @@ -4,6 +4,7 @@ |
| #include <stdint.h> |
| +#include "base/numerics/safe_math.h" |
| #include "skia/ext/skia_utils_base.h" |
| #include "third_party/skia/include/core/SkFontLCDConfig.h" |
| @@ -101,5 +102,12 @@ SkPixelGeometry ComputeDefaultPixelGeometry() { |
| return gGeo[index]; |
| } |
| +size_t SafeSizeOfImage(const SkImage* image) { |
|
vmpstr
2017/02/17 19:08:49
Can you extract this as a separate patch and chang
Khushal
2017/02/17 19:10:29
Since I've already added it here, how about starti
|
| + base::CheckedNumeric<size_t> checked_size = 4; |
| + checked_size *= image->width(); |
| + checked_size *= image->height(); |
| + return checked_size.ValueOrDefault(std::numeric_limits<size_t>::max()); |
| +} |
| + |
| } // namespace skia |