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/fetch/MemoryCache.h" | 7 #include "core/fetch/MemoryCache.h" |
8 #include "core/frame/FrameView.h" | 8 #include "core/frame/FrameView.h" |
9 #include "core/frame/ImageBitmap.h" | 9 #include "core/frame/ImageBitmap.h" |
10 #include "core/html/HTMLCanvasElement.h" | 10 #include "core/html/HTMLCanvasElement.h" |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 alphaGradient->addColorStop(1, String("rgba(0, 0, 255, 0.5)"), exceptionStat
e); | 163 alphaGradient->addColorStop(1, String("rgba(0, 0, 255, 0.5)"), exceptionStat
e); |
164 EXPECT_FALSE(exceptionState.hadException()); | 164 EXPECT_FALSE(exceptionState.hadException()); |
165 StringOrCanvasGradientOrCanvasPattern wrappedAlphaGradient; | 165 StringOrCanvasGradientOrCanvasPattern wrappedAlphaGradient; |
166 this->alphaGradient().setCanvasGradient(alphaGradient); | 166 this->alphaGradient().setCanvasGradient(alphaGradient); |
167 | 167 |
168 m_globalMemoryCache = replaceMemoryCacheForTesting(MemoryCache::create()); | 168 m_globalMemoryCache = replaceMemoryCacheForTesting(MemoryCache::create()); |
169 } | 169 } |
170 | 170 |
171 void CanvasRenderingContext2DTest::TearDown() | 171 void CanvasRenderingContext2DTest::TearDown() |
172 { | 172 { |
173 ThreadHeap::collectGarbage(BlinkGC::NoHeapPointersOnStack, BlinkGC::GCWithSw
eep, BlinkGC::ForcedGC); | 173 Heap::collectGarbage(BlinkGC::NoHeapPointersOnStack, BlinkGC::GCWithSweep, B
linkGC::ForcedGC); |
174 replaceMemoryCacheForTesting(m_globalMemoryCache.release()); | 174 replaceMemoryCacheForTesting(m_globalMemoryCache.release()); |
175 } | 175 } |
176 | 176 |
177 //============================================================================ | 177 //============================================================================ |
178 | 178 |
179 class FakeAcceleratedImageBufferSurfaceForTesting : public UnacceleratedImageBuf
ferSurface { | 179 class FakeAcceleratedImageBufferSurfaceForTesting : public UnacceleratedImageBuf
ferSurface { |
180 public: | 180 public: |
181 FakeAcceleratedImageBufferSurfaceForTesting(const IntSize& size, OpacityMode
mode) | 181 FakeAcceleratedImageBufferSurfaceForTesting(const IntSize& size, OpacityMode
mode) |
182 : UnacceleratedImageBufferSurface(size, mode) | 182 : UnacceleratedImageBufferSurface(size, mode) |
183 , m_isAccelerated(true) { } | 183 , m_isAccelerated(true) { } |
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
713 canvasElement().setSize(IntSize(20, 20)); | 713 canvasElement().setSize(IntSize(20, 20)); |
714 Mock::VerifyAndClearExpectations(fakeAccelerateSurfacePtr); | 714 Mock::VerifyAndClearExpectations(fakeAccelerateSurfacePtr); |
715 EXPECT_EQ(400, getGlobalGPUMemoryUsage()); | 715 EXPECT_EQ(400, getGlobalGPUMemoryUsage()); |
716 | 716 |
717 // Tear down the second image buffer | 717 // Tear down the second image buffer |
718 imageBuffer2.clear(); | 718 imageBuffer2.clear(); |
719 EXPECT_EQ(0, getGlobalGPUMemoryUsage()); | 719 EXPECT_EQ(0, getGlobalGPUMemoryUsage()); |
720 } | 720 } |
721 | 721 |
722 } // namespace blink | 722 } // namespace blink |
OLD | NEW |