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

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

Issue 2788583002: Reland of "Make disabling 2d canvas GPU acceleration for getImageData less aggressive." (Closed)
Patch Set: Created 3 years, 8 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 981 matching lines...) Expand 10 before | Expand all | Expand 10 after
992 Canvas2DLayerBridge::EnableAcceleration); 992 Canvas2DLayerBridge::EnableAcceleration);
993 std::unique_ptr<Canvas2DImageBufferSurface> surface( 993 std::unique_ptr<Canvas2DImageBufferSurface> surface(
994 new Canvas2DImageBufferSurface(bridge, size)); 994 new Canvas2DImageBufferSurface(bridge, size));
995 canvasElement().createImageBufferUsingSurfaceForTesting(std::move(surface)); 995 canvasElement().createImageBufferUsingSurfaceForTesting(std::move(surface));
996 996
997 EXPECT_TRUE(canvasElement().buffer()->isAccelerated()); 997 EXPECT_TRUE(canvasElement().buffer()->isAccelerated());
998 EXPECT_EQ(1u, getGlobalAcceleratedImageBufferCount()); 998 EXPECT_EQ(1u, getGlobalAcceleratedImageBufferCount());
999 EXPECT_EQ(720000, getGlobalGPUMemoryUsage()); 999 EXPECT_EQ(720000, getGlobalGPUMemoryUsage());
1000 1000
1001 DummyExceptionStateForTesting exceptionState; 1001 DummyExceptionStateForTesting exceptionState;
1002 for (int i = 0;
1003 i <
1004 ExpensiveCanvasHeuristicParameters::GPUReadbackMinSuccessiveFrames - 1;
1005 i++) {
1006 context2d()->getImageData(0, 0, 1, 1, exceptionState);
1007 canvasElement().finalizeFrame();
1008
1009 EXPECT_FALSE(exceptionState.hadException());
1010 EXPECT_TRUE(canvasElement().buffer()->isAccelerated());
1011 EXPECT_EQ(1u, getGlobalAcceleratedImageBufferCount());
1012 EXPECT_EQ(720000, getGlobalGPUMemoryUsage());
1013 }
1014
1002 context2d()->getImageData(0, 0, 1, 1, exceptionState); 1015 context2d()->getImageData(0, 0, 1, 1, exceptionState);
1016 canvasElement().finalizeFrame();
1003 1017
1004 EXPECT_FALSE(exceptionState.hadException()); 1018 EXPECT_FALSE(exceptionState.hadException());
1005 if (ExpensiveCanvasHeuristicParameters::GetImageDataForcesNoAcceleration) { 1019 if (ExpensiveCanvasHeuristicParameters::GPUReadbackForcesNoAcceleration) {
1006 EXPECT_FALSE(canvasElement().buffer()->isAccelerated()); 1020 EXPECT_FALSE(canvasElement().buffer()->isAccelerated());
1007 EXPECT_EQ(0u, getGlobalAcceleratedImageBufferCount()); 1021 EXPECT_EQ(0u, getGlobalAcceleratedImageBufferCount());
1008 EXPECT_EQ(0, getGlobalGPUMemoryUsage()); 1022 EXPECT_EQ(0, getGlobalGPUMemoryUsage());
1009 } else { 1023 } else {
1010 EXPECT_TRUE(canvasElement().buffer()->isAccelerated()); 1024 EXPECT_TRUE(canvasElement().buffer()->isAccelerated());
1011 EXPECT_EQ(1u, getGlobalAcceleratedImageBufferCount()); 1025 EXPECT_EQ(1u, getGlobalAcceleratedImageBufferCount());
1012 EXPECT_EQ(720000, getGlobalGPUMemoryUsage()); 1026 EXPECT_EQ(720000, getGlobalGPUMemoryUsage());
1013 } 1027 }
1014 1028
1015 // Restore global state to prevent side-effects on other tests 1029 // Restore global state to prevent side-effects on other tests
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
1356 1370
1357 RuntimeEnabledFeatures::setExperimentalCanvasFeaturesEnabled( 1371 RuntimeEnabledFeatures::setExperimentalCanvasFeaturesEnabled(
1358 experimentalCanvasFeaturesRuntimeFlag); 1372 experimentalCanvasFeaturesRuntimeFlag);
1359 RuntimeEnabledFeatures::setColorCorrectRenderingEnabled( 1373 RuntimeEnabledFeatures::setColorCorrectRenderingEnabled(
1360 colorCorrectRenderingRuntimeFlag); 1374 colorCorrectRenderingRuntimeFlag);
1361 RuntimeEnabledFeatures::setColorCorrectRenderingDefaultModeEnabled( 1375 RuntimeEnabledFeatures::setColorCorrectRenderingDefaultModeEnabled(
1362 colorCorrectRenderingDefaultModeRuntimeFlag); 1376 colorCorrectRenderingDefaultModeRuntimeFlag);
1363 } 1377 }
1364 1378
1365 } // namespace blink 1379 } // 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