OLD | NEW |
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 "core/dom/Document.h" | 7 #include "core/dom/Document.h" |
8 #include "core/fetch/MemoryCache.h" | 8 #include "core/fetch/MemoryCache.h" |
9 #include "core/frame/FrameView.h" | 9 #include "core/frame/FrameView.h" |
10 #include "core/frame/ImageBitmap.h" | 10 #include "core/frame/ImageBitmap.h" |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 alphaGradient->addColorStop(1, String("rgba(0, 0, 255, 0.5)"), exceptionStat
e); | 172 alphaGradient->addColorStop(1, String("rgba(0, 0, 255, 0.5)"), exceptionStat
e); |
173 EXPECT_FALSE(exceptionState.hadException()); | 173 EXPECT_FALSE(exceptionState.hadException()); |
174 StringOrCanvasGradientOrCanvasPattern wrappedAlphaGradient; | 174 StringOrCanvasGradientOrCanvasPattern wrappedAlphaGradient; |
175 this->alphaGradient().setCanvasGradient(alphaGradient); | 175 this->alphaGradient().setCanvasGradient(alphaGradient); |
176 | 176 |
177 m_globalMemoryCache = replaceMemoryCacheForTesting(MemoryCache::create()); | 177 m_globalMemoryCache = replaceMemoryCacheForTesting(MemoryCache::create()); |
178 } | 178 } |
179 | 179 |
180 void CanvasRenderingContext2DTest::TearDown() | 180 void CanvasRenderingContext2DTest::TearDown() |
181 { | 181 { |
182 ThreadState::current()->collectGarbage(BlinkGC::NoHeapPointersOnStack, Blink
GC::GCWithSweep, BlinkGC::ForcedGC); | 182 ThreadHeap::collectGarbage(BlinkGC::NoHeapPointersOnStack, BlinkGC::GCWithSw
eep, BlinkGC::ForcedGC); |
183 replaceMemoryCacheForTesting(m_globalMemoryCache.release()); | 183 replaceMemoryCacheForTesting(m_globalMemoryCache.release()); |
184 } | 184 } |
185 | 185 |
186 PassRefPtr<Canvas2DLayerBridge> CanvasRenderingContext2DTest::makeBridge(std::un
ique_ptr<FakeWebGraphicsContext3DProvider> provider, const IntSize& size, Canvas
2DLayerBridge::AccelerationMode accelerationMode) | 186 PassRefPtr<Canvas2DLayerBridge> CanvasRenderingContext2DTest::makeBridge(std::un
ique_ptr<FakeWebGraphicsContext3DProvider> provider, const IntSize& size, Canvas
2DLayerBridge::AccelerationMode accelerationMode) |
187 { | 187 { |
188 return adoptRef(new Canvas2DLayerBridge(std::move(provider), size, 0, NonOpa
que, accelerationMode, nullptr)); | 188 return adoptRef(new Canvas2DLayerBridge(std::move(provider), size, 0, NonOpa
que, accelerationMode, nullptr)); |
189 } | 189 } |
190 | 190 |
191 //============================================================================ | 191 //============================================================================ |
192 | 192 |
(...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
853 EXPECT_FALSE(canvasElement().buffer()->isAccelerated()); | 853 EXPECT_FALSE(canvasElement().buffer()->isAccelerated()); |
854 | 854 |
855 context->fillRect(10, 10, 100, 100); | 855 context->fillRect(10, 10, 100, 100); |
856 | 856 |
857 EXPECT_EQ(0, getCurrentGPUMemoryUsage()); | 857 EXPECT_EQ(0, getCurrentGPUMemoryUsage()); |
858 EXPECT_EQ(0, getGlobalGPUMemoryUsage()); | 858 EXPECT_EQ(0, getGlobalGPUMemoryUsage()); |
859 EXPECT_EQ(0u, getGlobalAcceleratedImageBufferCount()); | 859 EXPECT_EQ(0u, getGlobalAcceleratedImageBufferCount()); |
860 } | 860 } |
861 | 861 |
862 } // namespace blink | 862 } // namespace blink |
OLD | NEW |