| 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 <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "base/synchronization/lock.h" | 10 #include "base/synchronization/lock.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 #include "cc/test/fake_layer_tree_host_client.h" | 33 #include "cc/test/fake_layer_tree_host_client.h" |
| 34 #include "cc/test/fake_output_surface.h" | 34 #include "cc/test/fake_output_surface.h" |
| 35 #include "cc/test/fake_painted_scrollbar_layer.h" | 35 #include "cc/test/fake_painted_scrollbar_layer.h" |
| 36 #include "cc/test/fake_picture_layer.h" | 36 #include "cc/test/fake_picture_layer.h" |
| 37 #include "cc/test/fake_picture_layer_impl.h" | 37 #include "cc/test/fake_picture_layer_impl.h" |
| 38 #include "cc/test/fake_proxy.h" | 38 #include "cc/test/fake_proxy.h" |
| 39 #include "cc/test/fake_scoped_ui_resource.h" | 39 #include "cc/test/fake_scoped_ui_resource.h" |
| 40 #include "cc/test/fake_video_frame_provider.h" | 40 #include "cc/test/fake_video_frame_provider.h" |
| 41 #include "cc/test/geometry_test_utils.h" | 41 #include "cc/test/geometry_test_utils.h" |
| 42 #include "cc/test/layer_tree_test.h" | 42 #include "cc/test/layer_tree_test.h" |
| 43 #include "cc/test/occlusion_tracker_test_common.h" | |
| 44 #include "cc/test/test_web_graphics_context_3d.h" | 43 #include "cc/test/test_web_graphics_context_3d.h" |
| 45 #include "cc/trees/layer_tree_host_impl.h" | 44 #include "cc/trees/layer_tree_host_impl.h" |
| 46 #include "cc/trees/layer_tree_impl.h" | 45 #include "cc/trees/layer_tree_impl.h" |
| 47 #include "cc/trees/single_thread_proxy.h" | 46 #include "cc/trees/single_thread_proxy.h" |
| 48 #include "cc/trees/thread_proxy.h" | 47 #include "cc/trees/thread_proxy.h" |
| 49 #include "gpu/GLES2/gl2extchromium.h" | 48 #include "gpu/GLES2/gl2extchromium.h" |
| 50 #include "skia/ext/refptr.h" | 49 #include "skia/ext/refptr.h" |
| 51 #include "testing/gmock/include/gmock/gmock.h" | 50 #include "testing/gmock/include/gmock/gmock.h" |
| 52 #include "third_party/khronos/GLES2/gl2.h" | 51 #include "third_party/khronos/GLES2/gl2.h" |
| 53 #include "third_party/khronos/GLES2/gl2ext.h" | 52 #include "third_party/khronos/GLES2/gl2ext.h" |
| (...skipping 1268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1322 public: | 1321 public: |
| 1323 static scoped_refptr<ContentLayerWithUpdateTracking> Create( | 1322 static scoped_refptr<ContentLayerWithUpdateTracking> Create( |
| 1324 ContentLayerClient* client) { | 1323 ContentLayerClient* client) { |
| 1325 return make_scoped_refptr(new ContentLayerWithUpdateTracking(client)); | 1324 return make_scoped_refptr(new ContentLayerWithUpdateTracking(client)); |
| 1326 } | 1325 } |
| 1327 | 1326 |
| 1328 int PaintContentsCount() { return paint_contents_count_; } | 1327 int PaintContentsCount() { return paint_contents_count_; } |
| 1329 void ResetPaintContentsCount() { paint_contents_count_ = 0; } | 1328 void ResetPaintContentsCount() { paint_contents_count_ = 0; } |
| 1330 | 1329 |
| 1331 virtual bool Update(ResourceUpdateQueue* queue, | 1330 virtual bool Update(ResourceUpdateQueue* queue, |
| 1332 const OcclusionTracker* occlusion) OVERRIDE { | 1331 const OcclusionTracker<Layer>* occlusion) OVERRIDE { |
| 1333 bool updated = ContentLayer::Update(queue, occlusion); | 1332 bool updated = ContentLayer::Update(queue, occlusion); |
| 1334 paint_contents_count_++; | 1333 paint_contents_count_++; |
| 1335 return updated; | 1334 return updated; |
| 1336 } | 1335 } |
| 1337 | 1336 |
| 1338 private: | 1337 private: |
| 1339 explicit ContentLayerWithUpdateTracking(ContentLayerClient* client) | 1338 explicit ContentLayerWithUpdateTracking(ContentLayerClient* client) |
| 1340 : ContentLayer(client), paint_contents_count_(0) { | 1339 : ContentLayer(client), paint_contents_count_(0) { |
| 1341 SetAnchorPoint(gfx::PointF(0.f, 0.f)); | 1340 SetAnchorPoint(gfx::PointF(0.f, 0.f)); |
| 1342 SetBounds(gfx::Size(10, 10)); | 1341 SetBounds(gfx::Size(10, 10)); |
| (...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2013 // Surfaces don't exist with a delegated renderer. | 2012 // Surfaces don't exist with a delegated renderer. |
| 2014 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_NOIMPL_TEST_F( | 2013 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_NOIMPL_TEST_F( |
| 2015 LayerTreeHostTestSurfaceNotAllocatedForLayersOutsideMemoryLimit); | 2014 LayerTreeHostTestSurfaceNotAllocatedForLayersOutsideMemoryLimit); |
| 2016 | 2015 |
| 2017 class EvictionTestLayer : public Layer { | 2016 class EvictionTestLayer : public Layer { |
| 2018 public: | 2017 public: |
| 2019 static scoped_refptr<EvictionTestLayer> Create() { | 2018 static scoped_refptr<EvictionTestLayer> Create() { |
| 2020 return make_scoped_refptr(new EvictionTestLayer()); | 2019 return make_scoped_refptr(new EvictionTestLayer()); |
| 2021 } | 2020 } |
| 2022 | 2021 |
| 2023 virtual bool Update(ResourceUpdateQueue*, const OcclusionTracker*) OVERRIDE; | 2022 virtual bool Update(ResourceUpdateQueue*, |
| 2023 const OcclusionTracker<Layer>*) OVERRIDE; |
| 2024 virtual bool DrawsContent() const OVERRIDE { return true; } | 2024 virtual bool DrawsContent() const OVERRIDE { return true; } |
| 2025 | 2025 |
| 2026 virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) | 2026 virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) |
| 2027 OVERRIDE; | 2027 OVERRIDE; |
| 2028 virtual void PushPropertiesTo(LayerImpl* impl) OVERRIDE; | 2028 virtual void PushPropertiesTo(LayerImpl* impl) OVERRIDE; |
| 2029 virtual void SetTexturePriorities(const PriorityCalculator&) OVERRIDE; | 2029 virtual void SetTexturePriorities(const PriorityCalculator&) OVERRIDE; |
| 2030 | 2030 |
| 2031 bool HaveBackingTexture() const { | 2031 bool HaveBackingTexture() const { |
| 2032 return texture_.get() ? texture_->have_backing_texture() : false; | 2032 return texture_.get() ? texture_->have_backing_texture() : false; |
| 2033 } | 2033 } |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2074 }; | 2074 }; |
| 2075 | 2075 |
| 2076 void EvictionTestLayer::SetTexturePriorities(const PriorityCalculator&) { | 2076 void EvictionTestLayer::SetTexturePriorities(const PriorityCalculator&) { |
| 2077 CreateTextureIfNeeded(); | 2077 CreateTextureIfNeeded(); |
| 2078 if (!texture_) | 2078 if (!texture_) |
| 2079 return; | 2079 return; |
| 2080 texture_->set_request_priority(PriorityCalculator::UIPriority(true)); | 2080 texture_->set_request_priority(PriorityCalculator::UIPriority(true)); |
| 2081 } | 2081 } |
| 2082 | 2082 |
| 2083 bool EvictionTestLayer::Update(ResourceUpdateQueue* queue, | 2083 bool EvictionTestLayer::Update(ResourceUpdateQueue* queue, |
| 2084 const OcclusionTracker*) { | 2084 const OcclusionTracker<Layer>* occlusion) { |
| 2085 CreateTextureIfNeeded(); | 2085 CreateTextureIfNeeded(); |
| 2086 if (!texture_) | 2086 if (!texture_) |
| 2087 return false; | 2087 return false; |
| 2088 | 2088 |
| 2089 gfx::Rect full_rect(0, 0, 10, 10); | 2089 gfx::Rect full_rect(0, 0, 10, 10); |
| 2090 ResourceUpdate upload = ResourceUpdate::Create( | 2090 ResourceUpdate upload = ResourceUpdate::Create( |
| 2091 texture_.get(), &bitmap_, full_rect, full_rect, gfx::Vector2d()); | 2091 texture_.get(), &bitmap_, full_rect, full_rect, gfx::Vector2d()); |
| 2092 queue->AppendFullUpload(upload); | 2092 queue->AppendFullUpload(upload); |
| 2093 return true; | 2093 return true; |
| 2094 } | 2094 } |
| (...skipping 2565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4660 | 4660 |
| 4661 SINGLE_AND_MULTI_THREAD_NOIMPL_TEST_F(LayerTreeHostTestMemoryLimits); | 4661 SINGLE_AND_MULTI_THREAD_NOIMPL_TEST_F(LayerTreeHostTestMemoryLimits); |
| 4662 | 4662 |
| 4663 class LayerSetsNeedsFilterContext : public Layer { | 4663 class LayerSetsNeedsFilterContext : public Layer { |
| 4664 public: | 4664 public: |
| 4665 static scoped_refptr<LayerSetsNeedsFilterContext> Create() { | 4665 static scoped_refptr<LayerSetsNeedsFilterContext> Create() { |
| 4666 return make_scoped_refptr(new LayerSetsNeedsFilterContext()); | 4666 return make_scoped_refptr(new LayerSetsNeedsFilterContext()); |
| 4667 } | 4667 } |
| 4668 | 4668 |
| 4669 virtual bool Update(ResourceUpdateQueue* queue, | 4669 virtual bool Update(ResourceUpdateQueue* queue, |
| 4670 const OcclusionTracker* occlusion) OVERRIDE { | 4670 const OcclusionTracker<Layer>* occlusion) OVERRIDE { |
| 4671 bool updated = Layer::Update(queue, occlusion); | 4671 bool updated = Layer::Update(queue, occlusion); |
| 4672 if (needs_context_) { | 4672 if (needs_context_) { |
| 4673 layer_tree_host()->set_needs_filter_context(); | 4673 layer_tree_host()->set_needs_filter_context(); |
| 4674 return true; | 4674 return true; |
| 4675 } | 4675 } |
| 4676 return updated; | 4676 return updated; |
| 4677 } | 4677 } |
| 4678 | 4678 |
| 4679 void set_needs_context(bool need) { needs_context_ = need; } | 4679 void set_needs_context(bool need) { needs_context_ = need; } |
| 4680 | 4680 |
| (...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5079 | 5079 |
| 5080 virtual void AfterTest() OVERRIDE {} | 5080 virtual void AfterTest() OVERRIDE {} |
| 5081 | 5081 |
| 5082 FakeContentLayerClient client_; | 5082 FakeContentLayerClient client_; |
| 5083 scoped_ptr<FakeScopedUIResource> ui_resource_; | 5083 scoped_ptr<FakeScopedUIResource> ui_resource_; |
| 5084 }; | 5084 }; |
| 5085 | 5085 |
| 5086 MULTI_THREAD_TEST_F(LayerTreeHostTestHighResRequiredAfterEvictingUIResources); | 5086 MULTI_THREAD_TEST_F(LayerTreeHostTestHighResRequiredAfterEvictingUIResources); |
| 5087 | 5087 |
| 5088 } // namespace cc | 5088 } // namespace cc |
| OLD | NEW |