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 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
556 public: | 556 public: |
557 static scoped_refptr<ContentLayerWithUpdateTracking> Create( | 557 static scoped_refptr<ContentLayerWithUpdateTracking> Create( |
558 ContentLayerClient* client) { | 558 ContentLayerClient* client) { |
559 return make_scoped_refptr(new ContentLayerWithUpdateTracking(client)); | 559 return make_scoped_refptr(new ContentLayerWithUpdateTracking(client)); |
560 } | 560 } |
561 | 561 |
562 int PaintContentsCount() { return paint_contents_count_; } | 562 int PaintContentsCount() { return paint_contents_count_; } |
563 void ResetPaintContentsCount() { paint_contents_count_ = 0; } | 563 void ResetPaintContentsCount() { paint_contents_count_ = 0; } |
564 | 564 |
565 virtual void Update(ResourceUpdateQueue* queue, | 565 virtual void Update(ResourceUpdateQueue* queue, |
566 const OcclusionTracker* occlusion, | 566 const OcclusionTracker* occlusion) OVERRIDE { |
567 RenderingStats* stats) OVERRIDE { | 567 ContentLayer::Update(queue, occlusion); |
568 ContentLayer::Update(queue, occlusion, stats); | |
569 paint_contents_count_++; | 568 paint_contents_count_++; |
570 } | 569 } |
571 | 570 |
572 private: | 571 private: |
573 explicit ContentLayerWithUpdateTracking(ContentLayerClient* client) | 572 explicit ContentLayerWithUpdateTracking(ContentLayerClient* client) |
574 : ContentLayer(client), paint_contents_count_(0) { | 573 : ContentLayer(client), paint_contents_count_(0) { |
575 SetAnchorPoint(gfx::PointF(0.f, 0.f)); | 574 SetAnchorPoint(gfx::PointF(0.f, 0.f)); |
576 SetBounds(gfx::Size(10, 10)); | 575 SetBounds(gfx::Size(10, 10)); |
577 SetIsDrawable(true); | 576 SetIsDrawable(true); |
578 } | 577 } |
(...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1223 SINGLE_AND_MULTI_THREAD_TEST_F( | 1222 SINGLE_AND_MULTI_THREAD_TEST_F( |
1224 LayerTreeHostTestSurfaceNotAllocatedForLayersOutsideMemoryLimit); | 1223 LayerTreeHostTestSurfaceNotAllocatedForLayersOutsideMemoryLimit); |
1225 | 1224 |
1226 class EvictionTestLayer : public Layer { | 1225 class EvictionTestLayer : public Layer { |
1227 public: | 1226 public: |
1228 static scoped_refptr<EvictionTestLayer> Create() { | 1227 static scoped_refptr<EvictionTestLayer> Create() { |
1229 return make_scoped_refptr(new EvictionTestLayer()); | 1228 return make_scoped_refptr(new EvictionTestLayer()); |
1230 } | 1229 } |
1231 | 1230 |
1232 virtual void Update(ResourceUpdateQueue*, | 1231 virtual void Update(ResourceUpdateQueue*, |
1233 const OcclusionTracker*, | 1232 const OcclusionTracker*) OVERRIDE; |
1234 RenderingStats*) OVERRIDE; | |
1235 virtual bool DrawsContent() const OVERRIDE { return true; } | 1233 virtual bool DrawsContent() const OVERRIDE { return true; } |
1236 | 1234 |
1237 virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) | 1235 virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) |
1238 OVERRIDE; | 1236 OVERRIDE; |
1239 virtual void PushPropertiesTo(LayerImpl* impl) OVERRIDE; | 1237 virtual void PushPropertiesTo(LayerImpl* impl) OVERRIDE; |
1240 virtual void SetTexturePriorities(const PriorityCalculator&) OVERRIDE; | 1238 virtual void SetTexturePriorities(const PriorityCalculator&) OVERRIDE; |
1241 | 1239 |
1242 bool HaveBackingTexture() const { | 1240 bool HaveBackingTexture() const { |
1243 return texture_.get() ? texture_->have_backing_texture() : false; | 1241 return texture_.get() ? texture_->have_backing_texture() : false; |
1244 } | 1242 } |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1284 }; | 1282 }; |
1285 | 1283 |
1286 void EvictionTestLayer::SetTexturePriorities(const PriorityCalculator&) { | 1284 void EvictionTestLayer::SetTexturePriorities(const PriorityCalculator&) { |
1287 CreateTextureIfNeeded(); | 1285 CreateTextureIfNeeded(); |
1288 if (!texture_.get()) | 1286 if (!texture_.get()) |
1289 return; | 1287 return; |
1290 texture_->set_request_priority(PriorityCalculator::UIPriority(true)); | 1288 texture_->set_request_priority(PriorityCalculator::UIPriority(true)); |
1291 } | 1289 } |
1292 | 1290 |
1293 void EvictionTestLayer::Update(ResourceUpdateQueue* queue, | 1291 void EvictionTestLayer::Update(ResourceUpdateQueue* queue, |
1294 const OcclusionTracker*, | 1292 const OcclusionTracker*) { |
1295 RenderingStats*) { | |
1296 CreateTextureIfNeeded(); | 1293 CreateTextureIfNeeded(); |
1297 if (!texture_.get()) | 1294 if (!texture_.get()) |
1298 return; | 1295 return; |
1299 | 1296 |
1300 gfx::Rect full_rect(0, 0, 10, 10); | 1297 gfx::Rect full_rect(0, 0, 10, 10); |
1301 ResourceUpdate upload = ResourceUpdate::Create( | 1298 ResourceUpdate upload = ResourceUpdate::Create( |
1302 texture_.get(), &bitmap_, full_rect, full_rect, gfx::Vector2d()); | 1299 texture_.get(), &bitmap_, full_rect, full_rect, gfx::Vector2d()); |
1303 queue->AppendFullUpload(upload); | 1300 queue->AppendFullUpload(upload); |
1304 } | 1301 } |
1305 | 1302 |
(...skipping 882 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2188 } | 2185 } |
2189 | 2186 |
2190 private: | 2187 private: |
2191 base::TimeTicks frame_time_; | 2188 base::TimeTicks frame_time_; |
2192 }; | 2189 }; |
2193 | 2190 |
2194 MULTI_THREAD_TEST_F(LayerTreeHostTestVSyncNotification); | 2191 MULTI_THREAD_TEST_F(LayerTreeHostTestVSyncNotification); |
2195 | 2192 |
2196 } // namespace | 2193 } // namespace |
2197 } // namespace cc | 2194 } // namespace cc |
OLD | NEW |