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

Side by Side Diff: third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp

Issue 1380633003: Fixed WebGL printing crash due to failed buffer allocation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 months 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) 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2009 Apple 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 1227 matching lines...) Expand 10 before | Expand all | Expand 10 after
1238 if (isContextLost()) 1238 if (isContextLost())
1239 return false; 1239 return false;
1240 1240
1241 bool mustClearNow = clearIfComposited() != Skipped; 1241 bool mustClearNow = clearIfComposited() != Skipped;
1242 if (!m_markedCanvasDirty && !mustClearNow) 1242 if (!m_markedCanvasDirty && !mustClearNow)
1243 return false; 1243 return false;
1244 1244
1245 canvas()->clearCopiedImage(); 1245 canvas()->clearCopiedImage();
1246 m_markedCanvasDirty = false; 1246 m_markedCanvasDirty = false;
1247 1247
1248 if (!canvas()->buffer())
1249 return false;
1250
1248 ScopedTexture2DRestorer restorer(this); 1251 ScopedTexture2DRestorer restorer(this);
1249 ScopedFramebufferRestorer fboRestorer(this); 1252 ScopedFramebufferRestorer fboRestorer(this);
1250 1253
1251 drawingBuffer()->commit(); 1254 drawingBuffer()->commit();
1252 if (!canvas()->buffer()->copyRenderingResultsFromDrawingBuffer(drawingBuffer (), sourceBuffer)) { 1255 if (!canvas()->buffer()->copyRenderingResultsFromDrawingBuffer(drawingBuffer (), sourceBuffer)) {
1253 canvas()->ensureUnacceleratedImageBuffer(); 1256 canvas()->ensureUnacceleratedImageBuffer();
1254 if (canvas()->hasImageBuffer()) 1257 if (canvas()->hasImageBuffer())
1255 drawingBuffer()->paintRenderingResultsToCanvas(canvas()->buffer()); 1258 drawingBuffer()->paintRenderingResultsToCanvas(canvas()->buffer());
1256 } 1259 }
1257 1260
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after
1711 g = 0; 1714 g = 0;
1712 if (std::isnan(b)) 1715 if (std::isnan(b))
1713 b = 0; 1716 b = 0;
1714 if (std::isnan(a)) 1717 if (std::isnan(a))
1715 a = 1; 1718 a = 1;
1716 m_clearColor[0] = r; 1719 m_clearColor[0] = r;
1717 m_clearColor[1] = g; 1720 m_clearColor[1] = g;
1718 m_clearColor[2] = b; 1721 m_clearColor[2] = b;
1719 m_clearColor[3] = a; 1722 m_clearColor[3] = a;
1720 webContext()->clearColor(r, g, b, a); 1723 webContext()->clearColor(r, g, b, a);
1724 markContextChanged(CanvasChanged);
Ken Russell (switch to Gerrit) 2015/10/01 02:33:30 This looks wrong. markContextChanged is only suppo
Justin Novosad 2015/10/01 02:40:57 You are right. I am missing a call to clear() in t
1721 } 1725 }
1722 1726
1723 void WebGLRenderingContextBase::clearDepth(GLfloat depth) 1727 void WebGLRenderingContextBase::clearDepth(GLfloat depth)
1724 { 1728 {
1725 if (isContextLost()) 1729 if (isContextLost())
1726 return; 1730 return;
1727 m_clearDepth = depth; 1731 m_clearDepth = depth;
1728 webContext()->clearDepth(depth); 1732 webContext()->clearDepth(depth);
1729 } 1733 }
1730 1734
(...skipping 5003 matching lines...) Expand 10 before | Expand all | Expand 10 after
6734 6738
6735 return totalBytesPerPixel; 6739 return totalBytesPerPixel;
6736 } 6740 }
6737 6741
6738 DrawingBuffer* WebGLRenderingContextBase::drawingBuffer() const 6742 DrawingBuffer* WebGLRenderingContextBase::drawingBuffer() const
6739 { 6743 {
6740 return m_drawingBuffer.get(); 6744 return m_drawingBuffer.get();
6741 } 6745 }
6742 6746
6743 } // namespace blink 6747 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698