| Index: third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp
|
| diff --git a/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp b/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp
|
| index 0f476e9bdf5432704f9c742a60f2edd27dc87b9e..80d196bcc1ba02d4519451fad4f66b009db6d91f 100644
|
| --- a/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp
|
| +++ b/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp
|
| @@ -67,7 +67,6 @@
|
| #include "platform/transforms/AffineTransform.h"
|
| #include "public/platform/Platform.h"
|
| #include "public/platform/WebTraceLocation.h"
|
| -#include "wtf/CheckedNumeric.h"
|
| #include <math.h>
|
| #include <v8.h>
|
|
|
| @@ -828,13 +827,15 @@
|
| bufferCount++;
|
|
|
| // Four bytes per pixel per buffer.
|
| - CheckedNumeric<intptr_t> checkedExternallyAllocatedMemory = 4 * bufferCount;
|
| + Checked<intptr_t, RecordOverflow> checkedExternallyAllocatedMemory = 4 * bufferCount;
|
| if (is3D())
|
| checkedExternallyAllocatedMemory += m_context->externallyAllocatedBytesPerPixel();
|
|
|
| checkedExternallyAllocatedMemory *= width();
|
| checkedExternallyAllocatedMemory *= height();
|
| - intptr_t externallyAllocatedMemory = checkedExternallyAllocatedMemory.ValueOrDefault(std::numeric_limits<intptr_t>::max());
|
| + intptr_t externallyAllocatedMemory;
|
| + if (checkedExternallyAllocatedMemory.safeGet(externallyAllocatedMemory) == CheckedState::DidOverflow)
|
| + externallyAllocatedMemory = std::numeric_limits<intptr_t>::max();
|
|
|
| // Subtracting two intptr_t that are known to be positive will never underflow.
|
| v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(externallyAllocatedMemory - m_externallyAllocatedMemory);
|
|
|