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 "cc/trees/layer_tree_host.h" | 5 #include "cc/trees/layer_tree_host.h" |
6 | 6 |
7 #include "base/synchronization/lock.h" | 7 #include "base/synchronization/lock.h" |
8 #include "cc/animation/timing_function.h" | 8 #include "cc/animation/timing_function.h" |
9 #include "cc/layers/content_layer.h" | 9 #include "cc/layers/content_layer.h" |
10 #include "cc/layers/content_layer_client.h" | 10 #include "cc/layers/content_layer_client.h" |
(...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
687 Layer* m_testLayer; | 687 Layer* m_testLayer; |
688 }; | 688 }; |
689 | 689 |
690 class ContentLayerWithUpdateTracking : public ContentLayer { | 690 class ContentLayerWithUpdateTracking : public ContentLayer { |
691 public: | 691 public: |
692 static scoped_refptr<ContentLayerWithUpdateTracking> Create(ContentLayerClie
nt* client) { return make_scoped_refptr(new ContentLayerWithUpdateTracking(clien
t)); } | 692 static scoped_refptr<ContentLayerWithUpdateTracking> Create(ContentLayerClie
nt* client) { return make_scoped_refptr(new ContentLayerWithUpdateTracking(clien
t)); } |
693 | 693 |
694 int paintContentsCount() { return m_paintContentsCount; } | 694 int paintContentsCount() { return m_paintContentsCount; } |
695 void resetPaintContentsCount() { m_paintContentsCount = 0; } | 695 void resetPaintContentsCount() { m_paintContentsCount = 0; } |
696 | 696 |
697 virtual void Update(ResourceUpdateQueue* queue, const OcclusionTracker* occl
usion, RenderingStats* stats) OVERRIDE | 697 virtual void Update(ResourceUpdateQueue* queue, const OcclusionTracker* occl
usion) OVERRIDE |
698 { | 698 { |
699 ContentLayer::Update(queue, occlusion, stats); | 699 ContentLayer::Update(queue, occlusion); |
700 m_paintContentsCount++; | 700 m_paintContentsCount++; |
701 } | 701 } |
702 | 702 |
703 private: | 703 private: |
704 explicit ContentLayerWithUpdateTracking(ContentLayerClient* client) | 704 explicit ContentLayerWithUpdateTracking(ContentLayerClient* client) |
705 : ContentLayer(client) | 705 : ContentLayer(client) |
706 , m_paintContentsCount(0) | 706 , m_paintContentsCount(0) |
707 { | 707 { |
708 SetAnchorPoint(gfx::PointF(0, 0)); | 708 SetAnchorPoint(gfx::PointF(0, 0)); |
709 SetBounds(gfx::Size(10, 10)); | 709 SetBounds(gfx::Size(10, 10)); |
(...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1368 scoped_refptr<ContentLayerWithUpdateTracking> m_surfaceLayer2; | 1368 scoped_refptr<ContentLayerWithUpdateTracking> m_surfaceLayer2; |
1369 scoped_refptr<ContentLayerWithUpdateTracking> m_replicaLayer2; | 1369 scoped_refptr<ContentLayerWithUpdateTracking> m_replicaLayer2; |
1370 }; | 1370 }; |
1371 | 1371 |
1372 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSurfaceNotAllocatedForLayersOuts
ideMemoryLimit) | 1372 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSurfaceNotAllocatedForLayersOuts
ideMemoryLimit) |
1373 | 1373 |
1374 class EvictionTestLayer : public Layer { | 1374 class EvictionTestLayer : public Layer { |
1375 public: | 1375 public: |
1376 static scoped_refptr<EvictionTestLayer> Create() { return make_scoped_refptr
(new EvictionTestLayer()); } | 1376 static scoped_refptr<EvictionTestLayer> Create() { return make_scoped_refptr
(new EvictionTestLayer()); } |
1377 | 1377 |
1378 virtual void Update(ResourceUpdateQueue*, const OcclusionTracker*, Rendering
Stats*) OVERRIDE; | 1378 virtual void Update(ResourceUpdateQueue*, const OcclusionTracker*) OVERRIDE; |
1379 virtual bool DrawsContent() const OVERRIDE { return true; } | 1379 virtual bool DrawsContent() const OVERRIDE { return true; } |
1380 | 1380 |
1381 virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* treeImpl) OVERR
IDE; | 1381 virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* treeImpl) OVERR
IDE; |
1382 virtual void PushPropertiesTo(LayerImpl*) OVERRIDE; | 1382 virtual void PushPropertiesTo(LayerImpl*) OVERRIDE; |
1383 virtual void SetTexturePriorities(const PriorityCalculator&) OVERRIDE; | 1383 virtual void SetTexturePriorities(const PriorityCalculator&) OVERRIDE; |
1384 | 1384 |
1385 bool haveBackingTexture() const { return m_texture.get() ? m_texture->have_b
acking_texture() : false; } | 1385 bool haveBackingTexture() const { return m_texture.get() ? m_texture->have_b
acking_texture() : false; } |
1386 | 1386 |
1387 private: | 1387 private: |
1388 EvictionTestLayer() : Layer() { } | 1388 EvictionTestLayer() : Layer() { } |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1427 }; | 1427 }; |
1428 | 1428 |
1429 void EvictionTestLayer::SetTexturePriorities(const PriorityCalculator&) | 1429 void EvictionTestLayer::SetTexturePriorities(const PriorityCalculator&) |
1430 { | 1430 { |
1431 createTextureIfNeeded(); | 1431 createTextureIfNeeded(); |
1432 if (!m_texture.get()) | 1432 if (!m_texture.get()) |
1433 return; | 1433 return; |
1434 m_texture->set_request_priority(PriorityCalculator::UIPriority(true)); | 1434 m_texture->set_request_priority(PriorityCalculator::UIPriority(true)); |
1435 } | 1435 } |
1436 | 1436 |
1437 void EvictionTestLayer::Update(ResourceUpdateQueue* queue, const OcclusionTracke
r*, RenderingStats*) | 1437 void EvictionTestLayer::Update(ResourceUpdateQueue* queue, const OcclusionTracke
r*) |
1438 { | 1438 { |
1439 createTextureIfNeeded(); | 1439 createTextureIfNeeded(); |
1440 if (!m_texture.get()) | 1440 if (!m_texture.get()) |
1441 return; | 1441 return; |
1442 | 1442 |
1443 gfx::Rect fullRect(0, 0, 10, 10); | 1443 gfx::Rect fullRect(0, 0, 10, 10); |
1444 ResourceUpdate upload = ResourceUpdate::Create( | 1444 ResourceUpdate upload = ResourceUpdate::Create( |
1445 m_texture.get(), &m_bitmap, fullRect, fullRect, gfx::Vector2d()); | 1445 m_texture.get(), &m_bitmap, fullRect, fullRect, gfx::Vector2d()); |
1446 queue->AppendFullUpload(upload); | 1446 queue->AppendFullUpload(upload); |
1447 } | 1447 } |
(...skipping 795 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2243 private: | 2243 private: |
2244 FakeContentLayerClient client_; | 2244 FakeContentLayerClient client_; |
2245 scoped_refptr<ContentLayer> m_rootLayer; | 2245 scoped_refptr<ContentLayer> m_rootLayer; |
2246 int m_numCommits; | 2246 int m_numCommits; |
2247 }; | 2247 }; |
2248 | 2248 |
2249 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPinchZoomScrollbarNewRootLayer) | 2249 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPinchZoomScrollbarNewRootLayer) |
2250 | 2250 |
2251 } // namespace | 2251 } // namespace |
2252 } // namespace cc | 2252 } // namespace cc |
OLD | NEW |