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

Side by Side Diff: third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2DTest.cpp

Issue 2714103002: Revert of Make disabling 2d canvas GPU acceleration for getImageData less aggressive. (Closed)
Patch Set: Created 3 years, 9 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 | « no previous file | third_party/WebKit/Source/platform/graphics/ExpensiveCanvasHeuristicParameters.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "modules/canvas2d/CanvasRenderingContext2D.h" 5 #include "modules/canvas2d/CanvasRenderingContext2D.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include "bindings/core/v8/V8BindingForTesting.h" 8 #include "bindings/core/v8/V8BindingForTesting.h"
9 #include "core/dom/Document.h" 9 #include "core/dom/Document.h"
10 #include "core/frame/FrameView.h" 10 #include "core/frame/FrameView.h"
(...skipping 970 matching lines...) Expand 10 before | Expand all | Expand 10 after
981 Canvas2DLayerBridge::EnableAcceleration); 981 Canvas2DLayerBridge::EnableAcceleration);
982 std::unique_ptr<Canvas2DImageBufferSurface> surface( 982 std::unique_ptr<Canvas2DImageBufferSurface> surface(
983 new Canvas2DImageBufferSurface(bridge, size)); 983 new Canvas2DImageBufferSurface(bridge, size));
984 canvasElement().createImageBufferUsingSurfaceForTesting(std::move(surface)); 984 canvasElement().createImageBufferUsingSurfaceForTesting(std::move(surface));
985 985
986 EXPECT_TRUE(canvasElement().buffer()->isAccelerated()); 986 EXPECT_TRUE(canvasElement().buffer()->isAccelerated());
987 EXPECT_EQ(1u, getGlobalAcceleratedImageBufferCount()); 987 EXPECT_EQ(1u, getGlobalAcceleratedImageBufferCount());
988 EXPECT_EQ(720000, getGlobalGPUMemoryUsage()); 988 EXPECT_EQ(720000, getGlobalGPUMemoryUsage());
989 989
990 DummyExceptionStateForTesting exceptionState; 990 DummyExceptionStateForTesting exceptionState;
991 for (int i = 0;
992 i <
993 ExpensiveCanvasHeuristicParameters::GPUReadbackMinSuccessiveFrames - 1;
994 i++) {
995 context2d()->getImageData(0, 0, 1, 1, exceptionState);
996 canvasElement().finalizeFrame();
997
998 EXPECT_FALSE(exceptionState.hadException());
999 EXPECT_TRUE(canvasElement().buffer()->isAccelerated());
1000 EXPECT_EQ(1u, getGlobalAcceleratedImageBufferCount());
1001 EXPECT_EQ(720000, getGlobalGPUMemoryUsage());
1002 }
1003
1004 context2d()->getImageData(0, 0, 1, 1, exceptionState); 991 context2d()->getImageData(0, 0, 1, 1, exceptionState);
1005 canvasElement().finalizeFrame();
1006 992
1007 EXPECT_FALSE(exceptionState.hadException()); 993 EXPECT_FALSE(exceptionState.hadException());
1008 if (ExpensiveCanvasHeuristicParameters::GPUReadbackForcesNoAcceleration) { 994 if (ExpensiveCanvasHeuristicParameters::GetImageDataForcesNoAcceleration) {
1009 EXPECT_FALSE(canvasElement().buffer()->isAccelerated()); 995 EXPECT_FALSE(canvasElement().buffer()->isAccelerated());
1010 EXPECT_EQ(0u, getGlobalAcceleratedImageBufferCount()); 996 EXPECT_EQ(0u, getGlobalAcceleratedImageBufferCount());
1011 EXPECT_EQ(0, getGlobalGPUMemoryUsage()); 997 EXPECT_EQ(0, getGlobalGPUMemoryUsage());
1012 } else { 998 } else {
1013 EXPECT_TRUE(canvasElement().buffer()->isAccelerated()); 999 EXPECT_TRUE(canvasElement().buffer()->isAccelerated());
1014 EXPECT_EQ(1u, getGlobalAcceleratedImageBufferCount()); 1000 EXPECT_EQ(1u, getGlobalAcceleratedImageBufferCount());
1015 EXPECT_EQ(720000, getGlobalGPUMemoryUsage()); 1001 EXPECT_EQ(720000, getGlobalGPUMemoryUsage());
1016 } 1002 }
1017 1003
1018 // Restore global state to prevent side-effects on other tests 1004 // Restore global state to prevent side-effects on other tests
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
1365 1351
1366 RuntimeEnabledFeatures::setExperimentalCanvasFeaturesEnabled( 1352 RuntimeEnabledFeatures::setExperimentalCanvasFeaturesEnabled(
1367 experimentalCanvasFeaturesRuntimeFlag); 1353 experimentalCanvasFeaturesRuntimeFlag);
1368 RuntimeEnabledFeatures::setColorCorrectRenderingEnabled( 1354 RuntimeEnabledFeatures::setColorCorrectRenderingEnabled(
1369 colorCorrectRenderingRuntimeFlag); 1355 colorCorrectRenderingRuntimeFlag);
1370 RuntimeEnabledFeatures::setColorCorrectRenderingDefaultModeEnabled( 1356 RuntimeEnabledFeatures::setColorCorrectRenderingDefaultModeEnabled(
1371 colorCorrectRenderingDefaultModeRuntimeFlag); 1357 colorCorrectRenderingDefaultModeRuntimeFlag);
1372 } 1358 }
1373 1359
1374 } // namespace blink 1360 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/graphics/ExpensiveCanvasHeuristicParameters.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698