| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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 "config.h" | 5 #include "config.h" |
| 6 | 6 |
| 7 #include "cc/layer_tree_host.h" | 7 #include "cc/layer_tree_host.h" |
| 8 | 8 |
| 9 #include "base/synchronization/lock.h" | 9 #include "base/synchronization/lock.h" |
| 10 #include "cc/content_layer.h" | 10 #include "cc/content_layer.h" |
| (...skipping 1112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1123 TestOpacityChangeLayerDelegate() | 1123 TestOpacityChangeLayerDelegate() |
| 1124 : m_testLayer(0) | 1124 : m_testLayer(0) |
| 1125 { | 1125 { |
| 1126 } | 1126 } |
| 1127 | 1127 |
| 1128 void setTestLayer(Layer* testLayer) | 1128 void setTestLayer(Layer* testLayer) |
| 1129 { | 1129 { |
| 1130 m_testLayer = testLayer; | 1130 m_testLayer = testLayer; |
| 1131 } | 1131 } |
| 1132 | 1132 |
| 1133 virtual void paintContents(SkCanvas*, const IntRect&, FloatRect&) OVERRIDE | 1133 virtual void paintContents(SkCanvas*, const gfx::Rect&, gfx::RectF&) OVERRID
E |
| 1134 { | 1134 { |
| 1135 // Set layer opacity to 0. | 1135 // Set layer opacity to 0. |
| 1136 if (m_testLayer) | 1136 if (m_testLayer) |
| 1137 m_testLayer->setOpacity(0); | 1137 m_testLayer->setOpacity(0); |
| 1138 } | 1138 } |
| 1139 | 1139 |
| 1140 private: | 1140 private: |
| 1141 Layer* m_testLayer; | 1141 Layer* m_testLayer; |
| 1142 }; | 1142 }; |
| 1143 | 1143 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1209 | 1209 |
| 1210 TEST_F(LayerTreeHostTestOpacityChange, runMultiThread) | 1210 TEST_F(LayerTreeHostTestOpacityChange, runMultiThread) |
| 1211 { | 1211 { |
| 1212 runTest(true); | 1212 runTest(true); |
| 1213 } | 1213 } |
| 1214 | 1214 |
| 1215 class MockContentLayerClient : public ContentLayerClient { | 1215 class MockContentLayerClient : public ContentLayerClient { |
| 1216 public: | 1216 public: |
| 1217 bool drawsContent() const { return true; } | 1217 bool drawsContent() const { return true; } |
| 1218 MOCK_CONST_METHOD0(preserves3D, bool()); | 1218 MOCK_CONST_METHOD0(preserves3D, bool()); |
| 1219 void paintContents(SkCanvas*, const IntRect&, FloatRect&) OVERRIDE { } | 1219 void paintContents(SkCanvas*, const gfx::Rect&, gfx::RectF&) OVERRIDE { } |
| 1220 void notifySyncRequired() { } | 1220 void notifySyncRequired() { } |
| 1221 }; | 1221 }; |
| 1222 | 1222 |
| 1223 class NoScaleContentLayer : public ContentLayer { | 1223 class NoScaleContentLayer : public ContentLayer { |
| 1224 public: | 1224 public: |
| 1225 static scoped_refptr<NoScaleContentLayer> create(ContentLayerClient* client)
{ return make_scoped_refptr(new NoScaleContentLayer(client)); } | 1225 static scoped_refptr<NoScaleContentLayer> create(ContentLayerClient* client)
{ return make_scoped_refptr(new NoScaleContentLayer(client)); } |
| 1226 | 1226 |
| 1227 virtual bool needsContentsScale() const OVERRIDE { return false; } | 1227 virtual bool needsContentsScale() const OVERRIDE { return false; } |
| 1228 | 1228 |
| 1229 private: | 1229 private: |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1266 private: | 1266 private: |
| 1267 MockContentLayerClient m_client; | 1267 MockContentLayerClient m_client; |
| 1268 scoped_refptr<ContentLayerWithUpdateTracking> m_updateCheckLayer; | 1268 scoped_refptr<ContentLayerWithUpdateTracking> m_updateCheckLayer; |
| 1269 }; | 1269 }; |
| 1270 | 1270 |
| 1271 TEST_F(LayerTreeHostTestDoNotSkipLayersWithAnimatedOpacity, runMultiThread) | 1271 TEST_F(LayerTreeHostTestDoNotSkipLayersWithAnimatedOpacity, runMultiThread) |
| 1272 { | 1272 { |
| 1273 runTest(true); | 1273 runTest(true); |
| 1274 } | 1274 } |
| 1275 | 1275 |
| 1276 |
| 1276 class LayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers : public LayerTr
eeHostTest { | 1277 class LayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers : public LayerTr
eeHostTest { |
| 1277 public: | 1278 public: |
| 1278 | 1279 |
| 1279 LayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers() | 1280 LayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers() |
| 1280 : m_rootLayer(NoScaleContentLayer::create(&m_client)) | 1281 : m_rootLayer(NoScaleContentLayer::create(&m_client)) |
| 1281 , m_childLayer(ContentLayer::create(&m_client)) | 1282 , m_childLayer(ContentLayer::create(&m_client)) |
| 1282 { | 1283 { |
| 1283 } | 1284 } |
| 1284 | 1285 |
| 1285 virtual void beginTest() OVERRIDE | 1286 virtual void beginTest() OVERRIDE |
| (...skipping 1386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2672 if (!m_texture.get()) | 2673 if (!m_texture.get()) |
| 2673 return; | 2674 return; |
| 2674 m_texture->setRequestPriority(PriorityCalculator::uiPriority(true)); | 2675 m_texture->setRequestPriority(PriorityCalculator::uiPriority(true)); |
| 2675 } | 2676 } |
| 2676 | 2677 |
| 2677 void EvictionTestLayer::update(ResourceUpdateQueue& queue, const OcclusionTracke
r*, RenderingStats&) | 2678 void EvictionTestLayer::update(ResourceUpdateQueue& queue, const OcclusionTracke
r*, RenderingStats&) |
| 2678 { | 2679 { |
| 2679 createTextureIfNeeded(); | 2680 createTextureIfNeeded(); |
| 2680 if (!m_texture.get()) | 2681 if (!m_texture.get()) |
| 2681 return; | 2682 return; |
| 2682 IntRect fullRect(0, 0, 10, 10); | |
| 2683 | 2683 |
| 2684 gfx::Rect fullRect(0, 0, 10, 10); |
| 2684 ResourceUpdate upload = ResourceUpdate::Create( | 2685 ResourceUpdate upload = ResourceUpdate::Create( |
| 2685 m_texture.get(), &m_bitmap, fullRect, fullRect, IntSize()); | 2686 m_texture.get(), &m_bitmap, fullRect, fullRect, gfx::Vector2d()); |
| 2686 queue.appendFullUpload(upload); | 2687 queue.appendFullUpload(upload); |
| 2687 } | 2688 } |
| 2688 | 2689 |
| 2689 scoped_ptr<LayerImpl> EvictionTestLayer::createLayerImpl() | 2690 scoped_ptr<LayerImpl> EvictionTestLayer::createLayerImpl() |
| 2690 { | 2691 { |
| 2691 return EvictionTestLayerImpl::create(m_layerId).PassAs<LayerImpl>(); | 2692 return EvictionTestLayerImpl::create(m_layerId).PassAs<LayerImpl>(); |
| 2692 } | 2693 } |
| 2693 | 2694 |
| 2694 void EvictionTestLayer::pushPropertiesTo(LayerImpl* layerImpl) | 2695 void EvictionTestLayer::pushPropertiesTo(LayerImpl* layerImpl) |
| 2695 { | 2696 { |
| (...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3261 int m_numCommitsDeferred; | 3262 int m_numCommitsDeferred; |
| 3262 int m_numCompleteCommits; | 3263 int m_numCompleteCommits; |
| 3263 }; | 3264 }; |
| 3264 | 3265 |
| 3265 TEST_F(LayerTreeHostTestDeferCommits, runMultiThread) | 3266 TEST_F(LayerTreeHostTestDeferCommits, runMultiThread) |
| 3266 { | 3267 { |
| 3267 runTest(true); | 3268 runTest(true); |
| 3268 } | 3269 } |
| 3269 | 3270 |
| 3270 } // namespace | 3271 } // namespace |
| OLD | NEW |