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

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

Issue 2699713005: Fix missing finalizeFrame barriers in WebGL animations (Closed)
Patch Set: Comments + readability improvements Created 3 years, 10 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
« no previous file with comments | « third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1164 matching lines...) Expand 10 before | Expand all | Expand 10 after
1175 std::move(contextProvider), this, clampedCanvasSize(), premultipliedAlpha, 1175 std::move(contextProvider), this, clampedCanvasSize(), premultipliedAlpha,
1176 wantAlphaChannel, wantDepthBuffer, wantStencilBuffer, wantAntialiasing, 1176 wantAlphaChannel, wantDepthBuffer, wantStencilBuffer, wantAntialiasing,
1177 preserve, webGLVersion, chromiumImageUsage); 1177 preserve, webGLVersion, chromiumImageUsage);
1178 } 1178 }
1179 1179
1180 void WebGLRenderingContextBase::initializeNewContext() { 1180 void WebGLRenderingContextBase::initializeNewContext() {
1181 ASSERT(!isContextLost()); 1181 ASSERT(!isContextLost());
1182 ASSERT(drawingBuffer()); 1182 ASSERT(drawingBuffer());
1183 1183
1184 m_markedCanvasDirty = false; 1184 m_markedCanvasDirty = false;
1185 m_animationFrameInProgress = false;
1185 m_activeTextureUnit = 0; 1186 m_activeTextureUnit = 0;
1186 m_packAlignment = 4; 1187 m_packAlignment = 4;
1187 m_unpackAlignment = 4; 1188 m_unpackAlignment = 4;
1188 m_unpackFlipY = false; 1189 m_unpackFlipY = false;
1189 m_unpackPremultiplyAlpha = false; 1190 m_unpackPremultiplyAlpha = false;
1190 m_unpackColorspaceConversion = GC3D_BROWSER_DEFAULT_WEBGL; 1191 m_unpackColorspaceConversion = GC3D_BROWSER_DEFAULT_WEBGL;
1191 m_boundArrayBuffer = nullptr; 1192 m_boundArrayBuffer = nullptr;
1192 m_currentProgram = nullptr; 1193 m_currentProgram = nullptr;
1193 m_framebufferBinding = nullptr; 1194 m_framebufferBinding = nullptr;
1194 m_renderbufferBinding = nullptr; 1195 m_renderbufferBinding = nullptr;
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
1390 if (m_framebufferBinding || isContextLost()) 1391 if (m_framebufferBinding || isContextLost())
1391 return; 1392 return;
1392 1393
1393 if (!drawingBuffer()->markContentsChanged() && m_markedCanvasDirty) { 1394 if (!drawingBuffer()->markContentsChanged() && m_markedCanvasDirty) {
1394 return; 1395 return;
1395 } 1396 }
1396 1397
1397 if (!canvas()) 1398 if (!canvas())
1398 return; 1399 return;
1399 1400
1400 LayoutBox* layoutBox = canvas()->layoutBox(); 1401 m_markedCanvasDirty = true;
xlai (Olivia) 2017/02/21 19:56:56 Just a bit curious: does this m_markedCanvasDirty
1401 if (layoutBox && layoutBox->hasAcceleratedCompositing()) { 1402
1402 layoutBox->contentChanged(changeType); 1403 if (!m_animationFrameInProgress) {
1403 } 1404 m_animationFrameInProgress = true;
Justin Novosad 2017/02/21 18:06:21 I renamed this variable. I think it is more readab
1404 if (!m_markedCanvasDirty) { 1405 LayoutBox* layoutBox = canvas()->layoutBox();
1405 m_markedCanvasDirty = true; 1406 if (layoutBox && layoutBox->hasAcceleratedCompositing()) {
1407 layoutBox->contentChanged(changeType);
1408 }
1406 IntSize canvasSize = clampedCanvasSize(); 1409 IntSize canvasSize = clampedCanvasSize();
1407 didDraw(SkIRect::MakeXYWH(0, 0, canvasSize.width(), canvasSize.height())); 1410 didDraw(SkIRect::MakeXYWH(0, 0, canvasSize.width(), canvasSize.height()));
1408 } 1411 }
1409 } 1412 }
1410 1413
1414 void WebGLRenderingContextBase::finalizeFrame() {
1415 m_animationFrameInProgress = false;
1416 }
1417
1411 void WebGLRenderingContextBase::onErrorMessage(const char* message, 1418 void WebGLRenderingContextBase::onErrorMessage(const char* message,
1412 int32_t id) { 1419 int32_t id) {
1413 if (m_synthesizedErrorsToConsole) 1420 if (m_synthesizedErrorsToConsole)
1414 printGLErrorToConsole(message); 1421 printGLErrorToConsole(message);
1415 InspectorInstrumentation::didFireWebGLErrorOrWarning(canvas(), message); 1422 InspectorInstrumentation::didFireWebGLErrorOrWarning(canvas(), message);
1416 } 1423 }
1417 1424
1418 void WebGLRenderingContextBase::notifyCanvasContextChanged() { 1425 void WebGLRenderingContextBase::notifyCanvasContextChanged() {
1419 if (!canvas()) 1426 if (!canvas())
1420 return; 1427 return;
(...skipping 6383 matching lines...) Expand 10 before | Expand all | Expand 10 after
7804 7811
7805 void WebGLRenderingContextBase::getHTMLOrOffscreenCanvas( 7812 void WebGLRenderingContextBase::getHTMLOrOffscreenCanvas(
7806 HTMLCanvasElementOrOffscreenCanvas& result) const { 7813 HTMLCanvasElementOrOffscreenCanvas& result) const {
7807 if (canvas()) 7814 if (canvas())
7808 result.setHTMLCanvasElement(canvas()); 7815 result.setHTMLCanvasElement(canvas());
7809 else 7816 else
7810 result.setOffscreenCanvas(offscreenCanvas()); 7817 result.setOffscreenCanvas(offscreenCanvas());
7811 } 7818 }
7812 7819
7813 } // namespace blink 7820 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698