Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(99)

Side by Side Diff: third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp

Issue 1414553002: Fix out-of-memory crashes related to ArrayBuffer allocation Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase+more tweaks Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2010, Google Inc. All rights reserved. 2 * Copyright (c) 2010, Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 875 matching lines...) Expand 10 before | Expand all | Expand 10 after
886 ASSERT(!m_actualAttributes.premultipliedAlpha); 886 ASSERT(!m_actualAttributes.premultipliedAlpha);
887 width = size().width(); 887 width = size().width();
888 height = size().height(); 888 height = size().height();
889 889
890 Checked<int, RecordOverflow> dataSize = 4; 890 Checked<int, RecordOverflow> dataSize = 4;
891 dataSize *= width; 891 dataSize *= width;
892 dataSize *= height; 892 dataSize *= height;
893 if (dataSize.hasOverflowed()) 893 if (dataSize.hasOverflowed())
894 return false; 894 return false;
895 895
896 WTF::ArrayBufferContents pixels(width * height, 4, WTF::ArrayBufferContents: :NotShared, WTF::ArrayBufferContents::DontInitialize); 896 WTF::ArrayBufferContents pixels(width * height, 4, WTF::ArrayBufferContents: :NotShared, WTF::ArrayBufferContents::DontInitialize, WTF::ArrayBufferContents:: NullDataIfOutOfMemory);
897 897
898 GLint fbo = 0; 898 GLint fbo = 0;
899 if (sourceBuffer == FrontBuffer && m_frontColorBuffer.texInfo.textureId) { 899 if (sourceBuffer == FrontBuffer && m_frontColorBuffer.texInfo.textureId) {
900 fbo = m_context->createFramebuffer(); 900 fbo = m_context->createFramebuffer();
901 m_context->bindFramebuffer(GL_FRAMEBUFFER, fbo); 901 m_context->bindFramebuffer(GL_FRAMEBUFFER, fbo);
902 m_context->framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL _TEXTURE_2D, m_frontColorBuffer.texInfo.textureId, 0); 902 m_context->framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL _TEXTURE_2D, m_frontColorBuffer.texInfo.textureId, 0);
903 } else { 903 } else {
904 m_context->bindFramebuffer(GL_FRAMEBUFFER, framebuffer()); 904 m_context->bindFramebuffer(GL_FRAMEBUFFER, framebuffer());
905 } 905 }
906 906
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
1027 void DrawingBuffer::deleteChromiumImageForTexture(TextureInfo* info) 1027 void DrawingBuffer::deleteChromiumImageForTexture(TextureInfo* info)
1028 { 1028 {
1029 if (info->imageId) { 1029 if (info->imageId) {
1030 m_context->releaseTexImage2DCHROMIUM(GL_TEXTURE_2D, info->imageId); 1030 m_context->releaseTexImage2DCHROMIUM(GL_TEXTURE_2D, info->imageId);
1031 m_context->destroyImageCHROMIUM(info->imageId); 1031 m_context->destroyImageCHROMIUM(info->imageId);
1032 info->imageId = 0; 1032 info->imageId = 0;
1033 } 1033 }
1034 } 1034 }
1035 1035
1036 } // namespace blink 1036 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/ImageBuffer.cpp ('k') | third_party/WebKit/Source/web/WebArrayBuffer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698