| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2007 Alp Toker <alp@atoker.com> | 3 * Copyright (C) 2007 Alp Toker <alp@atoker.com> |
| 4 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. | 4 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 809 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 820 // non-displayed state) and three (triple-buffered animations). | 820 // non-displayed state) and three (triple-buffered animations). |
| 821 // Adding 2 is a pessimistic but relevant estimate. | 821 // Adding 2 is a pessimistic but relevant estimate. |
| 822 // Note: These buffers might be allocated in GPU memory. | 822 // Note: These buffers might be allocated in GPU memory. |
| 823 bufferCount += 2; | 823 bufferCount += 2; |
| 824 } | 824 } |
| 825 } | 825 } |
| 826 if (m_copiedImage) | 826 if (m_copiedImage) |
| 827 bufferCount++; | 827 bufferCount++; |
| 828 | 828 |
| 829 // Four bytes per pixel per buffer. | 829 // Four bytes per pixel per buffer. |
| 830 Checked<intptr_t, RecordOverflow> checkedExternallyAllocatedMemory = 4 * buf
ferCount; | 830 WTF::CheckedNumeric<intptr_t> checkedExternallyAllocatedMemory = 4 * bufferC
ount; |
| 831 if (is3D()) | 831 if (is3D()) |
| 832 checkedExternallyAllocatedMemory += m_context->externallyAllocatedBytesP
erPixel(); | 832 checkedExternallyAllocatedMemory += m_context->externallyAllocatedBytesP
erPixel(); |
| 833 | 833 |
| 834 checkedExternallyAllocatedMemory *= width(); | 834 checkedExternallyAllocatedMemory *= width(); |
| 835 checkedExternallyAllocatedMemory *= height(); | 835 checkedExternallyAllocatedMemory *= height(); |
| 836 intptr_t externallyAllocatedMemory; | 836 intptr_t externallyAllocatedMemory = checkedExternallyAllocatedMemory.ValueO
rDefault(std::numeric_limits<intptr_t>::max()); |
| 837 if (checkedExternallyAllocatedMemory.safeGet(externallyAllocatedMemory) == C
heckedState::DidOverflow) | |
| 838 externallyAllocatedMemory = std::numeric_limits<intptr_t>::max(); | |
| 839 | 837 |
| 840 // Subtracting two intptr_t that are known to be positive will never underfl
ow. | 838 // Subtracting two intptr_t that are known to be positive will never underfl
ow. |
| 841 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(externallyA
llocatedMemory - m_externallyAllocatedMemory); | 839 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(externallyA
llocatedMemory - m_externallyAllocatedMemory); |
| 842 m_externallyAllocatedMemory = externallyAllocatedMemory; | 840 m_externallyAllocatedMemory = externallyAllocatedMemory; |
| 843 } | 841 } |
| 844 | 842 |
| 845 SkCanvas* HTMLCanvasElement::drawingCanvas() const | 843 SkCanvas* HTMLCanvasElement::drawingCanvas() const |
| 846 { | 844 { |
| 847 return buffer() ? m_imageBuffer->canvas() : nullptr; | 845 return buffer() ? m_imageBuffer->canvas() : nullptr; |
| 848 } | 846 } |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1073 || element.hasTagName(HTMLNames::tfootTag) | 1071 || element.hasTagName(HTMLNames::tfootTag) |
| 1074 || element.hasTagName(HTMLNames::trTag) | 1072 || element.hasTagName(HTMLNames::trTag) |
| 1075 || element.hasTagName(HTMLNames::tdTag) | 1073 || element.hasTagName(HTMLNames::tdTag) |
| 1076 || element.hasTagName(HTMLNames::thTag)) | 1074 || element.hasTagName(HTMLNames::thTag)) |
| 1077 return true; | 1075 return true; |
| 1078 | 1076 |
| 1079 return false; | 1077 return false; |
| 1080 } | 1078 } |
| 1081 | 1079 |
| 1082 } // namespace blink | 1080 } // namespace blink |
| OLD | NEW |