Changeset 112550 in webkit
- Timestamp:
- Mar 29, 2012 11:18:47 AM (12 years ago)
- Location:
- trunk/Source/WebKit/chromium
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/chromium/ChangeLog
r112548 r112550 1 2012-03-29 Dana Jansens <danakj@chromium.org> 2 3 [chromium] Split off tiled layer constructs for unit tests into a common header 4 https://bugs.webkit.org/show_bug.cgi?id=82425 5 6 Reviewed by Adrienne Walker. 7 8 * WebKit.gypi: 9 * tests/CCTiledLayerTestCommon.cpp: Added. 10 (WebKitTests): 11 (WebKitTests::FakeLayerTextureUpdater::Texture::Texture): 12 (WebKitTests::FakeLayerTextureUpdater::Texture::~Texture): 13 (WebKitTests::FakeLayerTextureUpdater::Texture::updateRect): 14 (WebKitTests::FakeLayerTextureUpdater::Texture::prepareRect): 15 (WebKitTests::FakeLayerTextureUpdater::FakeLayerTextureUpdater): 16 (WebKitTests::FakeLayerTextureUpdater::~FakeLayerTextureUpdater): 17 (WebKitTests::FakeLayerTextureUpdater::prepareToUpdate): 18 (WebKitTests::FakeLayerTextureUpdater::setRectToInvalidate): 19 (WebKitTests::FakeLayerTextureUpdater::createTexture): 20 (WebKitTests::FakeCCTiledLayerImpl::FakeCCTiledLayerImpl): 21 (WebKitTests::FakeCCTiledLayerImpl::~FakeCCTiledLayerImpl): 22 (WebKitTests::FakeTiledLayerChromium::FakeTiledLayerChromium): 23 (WebKitTests::FakeTiledLayerChromium::~FakeTiledLayerChromium): 24 (WebKitTests::FakeTiledLayerChromium::setNeedsDisplayRect): 25 (WebKitTests::FakeTiledLayerChromium::paintContentsIfDirty): 26 (WebKitTests::FakeTiledLayerWithScaledBounds::FakeTiledLayerWithScaledBounds): 27 (WebKitTests::FakeCCTextureUpdater::FakeCCTextureUpdater): 28 * tests/CCTiledLayerTestCommon.h: Added. 29 (WebKitTests): 30 (FakeLayerTextureUpdater): 31 (Texture): 32 (WebKitTests::FakeLayerTextureUpdater::sampledTexelFormat): 33 (WebKitTests::FakeLayerTextureUpdater::lastUpdateRect): 34 (WebKitTests::FakeLayerTextureUpdater::prepareCount): 35 (WebKitTests::FakeLayerTextureUpdater::clearPrepareCount): 36 (WebKitTests::FakeLayerTextureUpdater::updateCount): 37 (WebKitTests::FakeLayerTextureUpdater::clearUpdateCount): 38 (WebKitTests::FakeLayerTextureUpdater::updateRect): 39 (WebKitTests::FakeLayerTextureUpdater::prepareRectCount): 40 (WebKitTests::FakeLayerTextureUpdater::clearPrepareRectCount): 41 (WebKitTests::FakeLayerTextureUpdater::prepareRect): 42 (WebKitTests::FakeLayerTextureUpdater::setOpaquePaintRect): 43 (FakeCCTiledLayerImpl): 44 (FakeTiledLayerChromium): 45 (WebKitTests::FakeTiledLayerChromium::tileSize): 46 (WebKitTests::FakeTiledLayerChromium::lastNeedsDisplayRect): 47 (WebKitTests::FakeTiledLayerChromium::textureManager): 48 (WebKitTests::FakeTiledLayerChromium::fakeLayerTextureUpdater): 49 (WebKitTests::FakeTiledLayerChromium::updateRect): 50 (WebKitTests::FakeTiledLayerChromium::textureUpdater): 51 (WebKitTests::FakeTiledLayerChromium::createTextureUpdaterIfNeeded): 52 (FakeTiledLayerWithScaledBounds): 53 (WebKitTests::FakeTiledLayerWithScaledBounds::setContentBounds): 54 (WebKitTests::FakeTiledLayerWithScaledBounds::contentBounds): 55 (FakeTextureAllocator): 56 (WebKitTests::FakeTextureAllocator::createTexture): 57 (WebKitTests::FakeTextureAllocator::deleteTexture): 58 (FakeTextureCopier): 59 (WebKitTests::FakeTextureCopier::copyTexture): 60 (FakeCCTextureUpdater): 61 (WebKitTests::FakeCCTextureUpdater::textureAllocator): 62 * tests/TextureManagerTest.cpp: 63 * tests/TiledLayerChromiumTest.cpp: 64 1 65 2012-03-29 Dana Jansens <danakj@chromium.org> 2 66 -
trunk/Source/WebKit/chromium/WebKit.gypi
r112548 r112550 88 88 'tests/CCSolidColorLayerImplTest.cpp', 89 89 'tests/CCTiledLayerImplTest.cpp', 90 'tests/CCTiledLayerTestCommon.h', 91 'tests/CCTiledLayerTestCommon.cpp', 90 92 'tests/CCThreadTaskTest.cpp', 91 93 'tests/CCTimerTest.cpp', -
trunk/Source/WebKit/chromium/tests/TextureManagerTest.cpp
r107014 r112550 25 25 #include "config.h" 26 26 27 #include "CCTiledLayerTestCommon.h" 27 28 #include "ManagedTexture.h" 28 29 #include "TextureManager.h" … … 31 32 32 33 using namespace WebCore; 34 using namespace WebKitTests; 33 35 using namespace WTF; 34 36 35 37 namespace { 36 37 class FakeTextureAllocator : public TextureAllocator {38 public:39 virtual ~FakeTextureAllocator() { }40 virtual unsigned createTexture(const IntSize&, GC3Denum) { return 1; }41 virtual void deleteTexture(unsigned, const IntSize&, GC3Denum) { }42 };43 38 44 39 class TextureManagerTest : public testing::Test { -
trunk/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp
r112481 r112550 29 29 #include "CCAnimationTestCommon.h" 30 30 #include "CCLayerTreeTestCommon.h" 31 #include "CCTiledLayerTestCommon.h" 31 32 #include "FakeCCLayerTreeHostClient.h" 32 #include "LayerTextureUpdater.h"33 #include "Region.h"34 #include "TextureCopier.h"35 #include "TextureManager.h"36 33 #include "WebCompositor.h" 37 34 #include "cc/CCSingleThreadProxy.h" // For DebugScopedSetImplThread 38 #include "cc/CCTextureUpdater.h"39 #include "cc/CCTiledLayerImpl.h"40 35 #include <gtest/gtest.h> 41 36 … … 69 64 private: 70 65 IntRect m_scissorRectInScreen; 71 };72 73 class FakeTextureAllocator : public TextureAllocator {74 public:75 virtual unsigned createTexture(const IntSize&, GC3Denum) { return 1; }76 virtual void deleteTexture(unsigned, const IntSize&, GC3Denum) { }77 };78 79 class FakeTextureCopier : public TextureCopier {80 public:81 virtual void copyTexture(GraphicsContext3D*, unsigned, unsigned, const IntSize&) { }82 };83 84 class FakeTiledLayerChromium;85 86 class FakeLayerTextureUpdater : public LayerTextureUpdater {87 public:88 class Texture : public LayerTextureUpdater::Texture {89 public:90 Texture(FakeLayerTextureUpdater* layer, PassOwnPtr<ManagedTexture> texture)91 : LayerTextureUpdater::Texture(texture)92 , m_layer(layer)93 {94 }95 virtual ~Texture() { }96 97 virtual void updateRect(GraphicsContext3D*, TextureAllocator* allocator, const IntRect&, const IntRect&)98 {99 if (allocator)100 texture()->allocate(allocator);101 m_layer->updateRect();102 }103 virtual void prepareRect(const IntRect&) { m_layer->prepareRect(); }104 105 private:106 FakeLayerTextureUpdater* m_layer;107 };108 109 FakeLayerTextureUpdater()110 : m_prepareCount(0)111 , m_updateCount(0)112 , m_prepareRectCount(0)113 {114 }115 virtual ~FakeLayerTextureUpdater() { }116 117 // Sets the rect to invalidate during the next call to prepareToUpdate(). After the next118 // call to prepareToUpdate() the rect is reset.119 void setRectToInvalidate(const IntRect&, FakeTiledLayerChromium*);120 121 // Number of times prepareToUpdate has been invoked.122 int prepareCount() const { return m_prepareCount; }123 void clearPrepareCount() { m_prepareCount = 0; }124 125 // Number of times updateRect has been invoked.126 int updateCount() const { return m_updateCount; }127 void clearUpdateCount() { m_updateCount = 0; }128 void updateRect() { m_updateCount++; }129 130 // Number of times prepareRect() has been invoked on a texture.131 int prepareRectCount() const { return m_prepareRectCount; }132 void clearPrepareRectCount() { m_prepareRectCount = 0; }133 void prepareRect() { m_prepareRectCount++; }134 135 void setOpaquePaintRect(const IntRect& opaquePaintRect) { m_opaquePaintRect = opaquePaintRect; }136 137 // Last rect passed to prepareToUpdate().138 const IntRect& lastUpdateRect() const { return m_lastUpdateRect; }139 140 virtual PassOwnPtr<LayerTextureUpdater::Texture> createTexture(TextureManager* manager) { return adoptPtr(new Texture(this, ManagedTexture::create(manager))); }141 virtual SampledTexelFormat sampledTexelFormat(GC3Denum) { return SampledTexelFormatRGBA; }142 virtual void prepareToUpdate(const IntRect& contentRect, const IntSize&, int, float, IntRect* resultingOpaqueRect);143 144 private:145 int m_prepareCount;146 int m_updateCount;147 int m_prepareRectCount;148 IntRect m_rectToInvalidate;149 IntRect m_lastUpdateRect;150 IntRect m_opaquePaintRect;151 RefPtr<FakeTiledLayerChromium> m_layer;152 };153 154 class FakeCCTiledLayerImpl : public CCTiledLayerImpl {155 public:156 explicit FakeCCTiledLayerImpl(int id)157 : CCTiledLayerImpl(id) { }158 virtual ~FakeCCTiledLayerImpl() { }159 160 using CCTiledLayerImpl::hasTileAt;161 using CCTiledLayerImpl::hasTextureIdForTileAt;162 };163 164 class FakeTiledLayerChromium : public TiledLayerChromium {165 public:166 explicit FakeTiledLayerChromium(TextureManager* textureManager)167 : TiledLayerChromium()168 , m_fakeTextureUpdater(adoptRef(new FakeLayerTextureUpdater))169 , m_textureManager(textureManager)170 {171 setTileSize(tileSize());172 setTextureFormat(GraphicsContext3D::RGBA);173 setBorderTexelOption(CCLayerTilingData::NoBorderTexels);174 setIsDrawable(true); // So that we don't get false positives if any of these tests expect to return false from drawsContent() for other reasons.175 }176 virtual ~FakeTiledLayerChromium() { }177 178 static IntSize tileSize() { return IntSize(100, 100); }179 180 using TiledLayerChromium::invalidateRect;181 using TiledLayerChromium::prepareToUpdate;182 using TiledLayerChromium::prepareToUpdateIdle;183 using TiledLayerChromium::needsIdlePaint;184 using TiledLayerChromium::skipsDraw;185 using TiledLayerChromium::numPaintedTiles;186 using TiledLayerChromium::idlePaintRect;187 188 virtual void setNeedsDisplayRect(const FloatRect& rect)189 {190 m_lastNeedsDisplayRect = rect;191 TiledLayerChromium::setNeedsDisplayRect(rect);192 }193 194 const FloatRect& lastNeedsDisplayRect() const { return m_lastNeedsDisplayRect; }195 196 FakeLayerTextureUpdater* fakeLayerTextureUpdater() { return m_fakeTextureUpdater.get(); }197 198 virtual TextureManager* textureManager() const { return m_textureManager; }199 200 virtual void paintContentsIfDirty(const CCOcclusionTracker* occlusion)201 {202 prepareToUpdate(visibleLayerRect(), occlusion);203 }204 205 private:206 virtual LayerTextureUpdater* textureUpdater() const207 {208 return m_fakeTextureUpdater.get();209 }210 211 virtual void createTextureUpdaterIfNeeded() { }212 213 RefPtr<FakeLayerTextureUpdater> m_fakeTextureUpdater;214 TextureManager* m_textureManager;215 FloatRect m_lastNeedsDisplayRect;216 };217 218 class FakeTiledLayerWithScaledBounds : public FakeTiledLayerChromium {219 public:220 explicit FakeTiledLayerWithScaledBounds(TextureManager* textureManager)221 : FakeTiledLayerChromium(textureManager)222 {223 }224 225 void setContentBounds(const IntSize& contentBounds) { m_forcedContentBounds = contentBounds; }226 virtual IntSize contentBounds() const { return m_forcedContentBounds; }227 228 FloatRect updateRect() { return m_updateRect; }229 230 protected:231 IntSize m_forcedContentBounds;232 };233 234 void FakeLayerTextureUpdater::setRectToInvalidate(const IntRect& rect, FakeTiledLayerChromium* layer)235 {236 m_rectToInvalidate = rect;237 m_layer = layer;238 }239 240 void FakeLayerTextureUpdater::prepareToUpdate(const IntRect& contentRect, const IntSize&, int, float, IntRect* resultingOpaqueRect)241 {242 m_prepareCount++;243 m_lastUpdateRect = contentRect;244 if (!m_rectToInvalidate.isEmpty()) {245 m_layer->invalidateRect(m_rectToInvalidate);246 m_rectToInvalidate = IntRect();247 m_layer = 0;248 }249 *resultingOpaqueRect = m_opaquePaintRect;250 }251 252 class FakeCCTextureUpdater : public CCTextureUpdater {253 public:254 explicit FakeCCTextureUpdater()255 : CCTextureUpdater(&m_textureAllocator, &m_textureCopier)256 {257 }258 259 FakeTextureAllocator& textureAllocator()260 {261 return m_textureAllocator;262 }263 264 protected:265 FakeTextureAllocator m_textureAllocator;266 FakeTextureCopier m_textureCopier;267 66 }; 268 67
Note: See TracChangeset
for help on using the changeset viewer.