diff options
Diffstat (limited to 'cc/layers')
27 files changed, 50 insertions, 47 deletions
diff --git a/cc/layers/content_layer.cc b/cc/layers/content_layer.cc index 8585977..edca5ed 100644 --- a/cc/layers/content_layer.cc +++ b/cc/layers/content_layer.cc @@ -88,7 +88,7 @@ void ContentLayer::SetTexturePriorities( } bool ContentLayer::Update(ResourceUpdateQueue* queue, - const OcclusionTracker* occlusion) { + const OcclusionTracker<Layer>* occlusion) { { base::AutoReset<bool> ignore_set_needs_commit(&ignore_set_needs_commit_, true); diff --git a/cc/layers/content_layer.h b/cc/layers/content_layer.h index 783e094..9bef22b 100644 --- a/cc/layers/content_layer.h +++ b/cc/layers/content_layer.h @@ -45,7 +45,7 @@ class CC_EXPORT ContentLayer : public TiledLayer { virtual void SetTexturePriorities(const PriorityCalculator& priority_calc) OVERRIDE; virtual bool Update(ResourceUpdateQueue* queue, - const OcclusionTracker* occlusion) OVERRIDE; + const OcclusionTracker<Layer>* occlusion) OVERRIDE; virtual bool NeedMoreUpdates() OVERRIDE; virtual void SetContentsOpaque(bool contents_opaque) OVERRIDE; diff --git a/cc/layers/contents_scaling_layer.cc b/cc/layers/contents_scaling_layer.cc index 44a3f37..6fcaf1f 100644 --- a/cc/layers/contents_scaling_layer.cc +++ b/cc/layers/contents_scaling_layer.cc @@ -35,9 +35,8 @@ void ContentsScalingLayer::CalculateContentsScale( ideal_contents_scale); } -bool ContentsScalingLayer::Update( - ResourceUpdateQueue* queue, - const OcclusionTracker* occlusion) { +bool ContentsScalingLayer::Update(ResourceUpdateQueue* queue, + const OcclusionTracker<Layer>* occlusion) { bool updated = Layer::Update(queue, occlusion); if (draw_properties().contents_scale_x == last_update_contents_scale_x_ && diff --git a/cc/layers/contents_scaling_layer.h b/cc/layers/contents_scaling_layer.h index a2648d1..52abc4bc 100644 --- a/cc/layers/contents_scaling_layer.h +++ b/cc/layers/contents_scaling_layer.h @@ -23,9 +23,8 @@ class CC_EXPORT ContentsScalingLayer : public Layer { float* contents_scale_y, gfx::Size* content_bounds) OVERRIDE; - virtual bool Update( - ResourceUpdateQueue* queue, - const OcclusionTracker* occlusion) OVERRIDE; + virtual bool Update(ResourceUpdateQueue* queue, + const OcclusionTracker<Layer>* occlusion) OVERRIDE; protected: ContentsScalingLayer(); diff --git a/cc/layers/delegated_renderer_layer.cc b/cc/layers/delegated_renderer_layer.cc index aaee787..1dab3c8 100644 --- a/cc/layers/delegated_renderer_layer.cc +++ b/cc/layers/delegated_renderer_layer.cc @@ -113,7 +113,7 @@ static bool FrameDataRequiresFilterContext(const DelegatedFrameData* frame) { } bool DelegatedRendererLayer::Update(ResourceUpdateQueue* queue, - const OcclusionTracker* occlusion) { + const OcclusionTracker<Layer>* occlusion) { bool updated = Layer::Update(queue, occlusion); if (!should_collect_new_frame_) return updated; diff --git a/cc/layers/delegated_renderer_layer.h b/cc/layers/delegated_renderer_layer.h index a0b67df..a229543 100644 --- a/cc/layers/delegated_renderer_layer.h +++ b/cc/layers/delegated_renderer_layer.h @@ -26,7 +26,7 @@ class CC_EXPORT DelegatedRendererLayer : public Layer { OVERRIDE; virtual void SetLayerTreeHost(LayerTreeHost* host) OVERRIDE; virtual bool Update(ResourceUpdateQueue* queue, - const OcclusionTracker* occlusion) OVERRIDE; + const OcclusionTracker<Layer>* occlusion) OVERRIDE; virtual void PushPropertiesTo(LayerImpl* impl) OVERRIDE; // Set the size at which the frame should be displayed, with the origin at the diff --git a/cc/layers/image_layer.cc b/cc/layers/image_layer.cc index 2f90bfc..562525b 100644 --- a/cc/layers/image_layer.cc +++ b/cc/layers/image_layer.cc @@ -41,7 +41,7 @@ void ImageLayer::SetTexturePriorities(const PriorityCalculator& priority_calc) { } bool ImageLayer::Update(ResourceUpdateQueue* queue, - const OcclusionTracker* occlusion) { + const OcclusionTracker<Layer>* occlusion) { CreateUpdaterIfNeeded(); if (!updater_->UsingBitmap(bitmap_)) { updater_->SetBitmap(bitmap_); diff --git a/cc/layers/image_layer.h b/cc/layers/image_layer.h index 6cd8275..5d9b656 100644 --- a/cc/layers/image_layer.h +++ b/cc/layers/image_layer.h @@ -23,7 +23,7 @@ class CC_EXPORT ImageLayer : public TiledLayer { virtual void SetTexturePriorities(const PriorityCalculator& priority_calc) OVERRIDE; virtual bool Update(ResourceUpdateQueue* queue, - const OcclusionTracker* occlusion) OVERRIDE; + const OcclusionTracker<Layer>* occlusion) OVERRIDE; virtual void CalculateContentsScale(float ideal_contents_scale, float device_scale_factor, float page_scale_factor, diff --git a/cc/layers/io_surface_layer.cc b/cc/layers/io_surface_layer.cc index 209827d..98d3dfe 100644 --- a/cc/layers/io_surface_layer.cc +++ b/cc/layers/io_surface_layer.cc @@ -41,7 +41,7 @@ void IOSurfaceLayer::PushPropertiesTo(LayerImpl* layer) { } bool IOSurfaceLayer::Update(ResourceUpdateQueue* queue, - const OcclusionTracker* occlusion) { + const OcclusionTracker<Layer>* occlusion) { bool updated = Layer::Update(queue, occlusion); // This layer doesn't update any resources from the main thread side, diff --git a/cc/layers/io_surface_layer.h b/cc/layers/io_surface_layer.h index 9939f56..80e5b69 100644 --- a/cc/layers/io_surface_layer.h +++ b/cc/layers/io_surface_layer.h @@ -21,7 +21,7 @@ class CC_EXPORT IOSurfaceLayer : public Layer { virtual bool DrawsContent() const OVERRIDE; virtual void PushPropertiesTo(LayerImpl* layer) OVERRIDE; virtual bool Update(ResourceUpdateQueue* queue, - const OcclusionTracker* occlusion) OVERRIDE; + const OcclusionTracker<Layer>* occlusion) OVERRIDE; protected: IOSurfaceLayer(); diff --git a/cc/layers/layer.cc b/cc/layers/layer.cc index 63b1288..d016571 100644 --- a/cc/layers/layer.cc +++ b/cc/layers/layer.cc @@ -1071,7 +1071,7 @@ void Layer::SavePaintProperties() { } bool Layer::Update(ResourceUpdateQueue* queue, - const OcclusionTracker* occlusion) { + const OcclusionTracker<Layer>* occlusion) { DCHECK(layer_tree_host_); DCHECK_EQ(layer_tree_host_->source_frame_number(), paint_properties_.source_frame_number) << diff --git a/cc/layers/layer.h b/cc/layers/layer.h index 37772e9..97d3753 100644 --- a/cc/layers/layer.h +++ b/cc/layers/layer.h @@ -24,7 +24,6 @@ #include "cc/layers/paint_properties.h" #include "cc/layers/render_surface.h" #include "cc/output/filter_operations.h" -#include "cc/trees/occlusion_tracker.h" #include "skia/ext/refptr.h" #include "third_party/skia/include/core/SkColor.h" #include "third_party/skia/include/core/SkImageFilter.h" @@ -61,6 +60,8 @@ class RenderingStatsInstrumentation; class ResourceUpdateQueue; class ScrollbarLayerInterface; struct AnimationEvent; +template <typename LayerType> +class OcclusionTracker; // Base class for composited layers. Special layer types are derived from // this class. @@ -352,7 +353,7 @@ class CC_EXPORT Layer : public base::RefCounted<Layer>, virtual void SavePaintProperties(); // Returns true iff any resources were updated that need to be committed. virtual bool Update(ResourceUpdateQueue* queue, - const OcclusionTracker* occlusion); + const OcclusionTracker<Layer>* occlusion); virtual bool NeedMoreUpdates(); virtual void SetIsMask(bool is_mask) {} virtual void ReduceMemoryUsage() {} diff --git a/cc/layers/nine_patch_layer_unittest.cc b/cc/layers/nine_patch_layer_unittest.cc index b052481..94e75eb 100644 --- a/cc/layers/nine_patch_layer_unittest.cc +++ b/cc/layers/nine_patch_layer_unittest.cc @@ -57,7 +57,7 @@ TEST_F(NinePatchLayerTest, SetLayerProperties) { EXPECT_EQ(test_layer->layer_tree_host(), layer_tree_host_.get()); ResourceUpdateQueue queue; - OcclusionTracker occlusion_tracker(gfx::Rect(), false); + OcclusionTracker<Layer> occlusion_tracker(gfx::Rect(), false); test_layer->SavePaintProperties(); test_layer->Update(&queue, &occlusion_tracker); diff --git a/cc/layers/painted_scrollbar_layer.cc b/cc/layers/painted_scrollbar_layer.cc index 9060994..320ea30 100644 --- a/cc/layers/painted_scrollbar_layer.cc +++ b/cc/layers/painted_scrollbar_layer.cc @@ -202,7 +202,7 @@ void PaintedScrollbarLayer::UpdateThumbAndTrackGeometry() { } bool PaintedScrollbarLayer::Update(ResourceUpdateQueue* queue, - const OcclusionTracker* occlusion) { + const OcclusionTracker<Layer>* occlusion) { UpdateThumbAndTrackGeometry(); gfx::Rect track_layer_rect = gfx::Rect(location_, bounds()); diff --git a/cc/layers/painted_scrollbar_layer.h b/cc/layers/painted_scrollbar_layer.h index 56bacae..1ff9169 100644 --- a/cc/layers/painted_scrollbar_layer.h +++ b/cc/layers/painted_scrollbar_layer.h @@ -38,7 +38,7 @@ class CC_EXPORT PaintedScrollbarLayer : public ScrollbarLayerInterface, // Layer interface virtual bool Update(ResourceUpdateQueue* queue, - const OcclusionTracker* occlusion) OVERRIDE; + const OcclusionTracker<Layer>* occlusion) OVERRIDE; virtual void SetLayerTreeHost(LayerTreeHost* host) OVERRIDE; virtual void PushPropertiesTo(LayerImpl* layer) OVERRIDE; virtual void PushScrollClipPropertiesTo(LayerImpl* layer) OVERRIDE; diff --git a/cc/layers/picture_layer.cc b/cc/layers/picture_layer.cc index 6707307..ec73e09 100644 --- a/cc/layers/picture_layer.cc +++ b/cc/layers/picture_layer.cc @@ -81,7 +81,7 @@ void PictureLayer::SetNeedsDisplayRect(const gfx::RectF& layer_rect) { } bool PictureLayer::Update(ResourceUpdateQueue* queue, - const OcclusionTracker* occlusion) { + const OcclusionTracker<Layer>* occlusion) { update_source_frame_number_ = layer_tree_host()->source_frame_number(); bool updated = Layer::Update(queue, occlusion); diff --git a/cc/layers/picture_layer.h b/cc/layers/picture_layer.h index d986a9b..853f449 100644 --- a/cc/layers/picture_layer.h +++ b/cc/layers/picture_layer.h @@ -30,9 +30,8 @@ class CC_EXPORT PictureLayer : public Layer { virtual void SetLayerTreeHost(LayerTreeHost* host) OVERRIDE; virtual void PushPropertiesTo(LayerImpl* layer) OVERRIDE; virtual void SetNeedsDisplayRect(const gfx::RectF& layer_rect) OVERRIDE; - virtual bool Update( - ResourceUpdateQueue* queue, - const OcclusionTracker* occlusion) OVERRIDE; + virtual bool Update(ResourceUpdateQueue* queue, + const OcclusionTracker<Layer>* occlusion) OVERRIDE; virtual void SetIsMask(bool is_mask) OVERRIDE; virtual bool SupportsLCDText() const OVERRIDE; virtual skia::RefPtr<SkPicture> GetPicture() const OVERRIDE; diff --git a/cc/layers/picture_layer_unittest.cc b/cc/layers/picture_layer_unittest.cc index 8f13fd0..dc434157 100644 --- a/cc/layers/picture_layer_unittest.cc +++ b/cc/layers/picture_layer_unittest.cc @@ -35,7 +35,7 @@ TEST(PictureLayerTest, NoTilesIfEmptyBounds) { layer->SetIsDrawable(true); layer->SavePaintProperties(); - OcclusionTracker occlusion(gfx::Rect(0, 0, 1000, 1000), false); + OcclusionTracker<Layer> occlusion(gfx::Rect(0, 0, 1000, 1000), false); scoped_ptr<ResourceUpdateQueue> queue(new ResourceUpdateQueue); layer->Update(queue.get(), &occlusion); diff --git a/cc/layers/scrollbar_layer_unittest.cc b/cc/layers/scrollbar_layer_unittest.cc index 794a60e..2b2b010 100644 --- a/cc/layers/scrollbar_layer_unittest.cc +++ b/cc/layers/scrollbar_layer_unittest.cc @@ -24,6 +24,7 @@ #include "cc/test/test_web_graphics_context_3d.h" #include "cc/trees/layer_tree_host.h" #include "cc/trees/layer_tree_impl.h" +#include "cc/trees/occlusion_tracker.h" #include "cc/trees/single_thread_proxy.h" #include "cc/trees/tree_synchronizer.h" #include "testing/gmock/include/gmock/gmock.h" @@ -651,7 +652,7 @@ class ScrollbarLayerTestResourceCreation : public testing::Test { EXPECT_EQ(scrollbar_layer->layer_tree_host(), layer_tree_host_.get()); ResourceUpdateQueue queue; - OcclusionTracker occlusion_tracker(gfx::Rect(), false); + OcclusionTracker<Layer> occlusion_tracker(gfx::Rect(), false); scrollbar_layer->SavePaintProperties(); for (int update_counter = 0; update_counter < num_updates; update_counter++) @@ -737,7 +738,7 @@ class ScaledScrollbarLayerTestResourceCreation : public testing::Test { EXPECT_EQ(scrollbar_layer->layer_tree_host(), layer_tree_host_.get()); ResourceUpdateQueue queue; - OcclusionTracker occlusion_tracker(gfx::Rect(), false); + OcclusionTracker<Layer> occlusion_tracker(gfx::Rect(), false); scrollbar_layer->SavePaintProperties(); scrollbar_layer->Update(&queue, &occlusion_tracker); @@ -813,7 +814,7 @@ class ScaledScrollbarLayerTestScaledRasterization : public testing::Test { scaled_size.height()); ResourceUpdateQueue queue; - OcclusionTracker occlusion_tracker(gfx::Rect(), false); + OcclusionTracker<Layer> occlusion_tracker(gfx::Rect(), false); scrollbar_layer->SavePaintProperties(); scrollbar_layer->Update(&queue, &occlusion_tracker); diff --git a/cc/layers/texture_layer.cc b/cc/layers/texture_layer.cc index bc6b58a..3260b44 100644 --- a/cc/layers/texture_layer.cc +++ b/cc/layers/texture_layer.cc @@ -217,7 +217,7 @@ bool TextureLayer::DrawsContent() const { } bool TextureLayer::Update(ResourceUpdateQueue* queue, - const OcclusionTracker* occlusion) { + const OcclusionTracker<Layer>* occlusion) { bool updated = Layer::Update(queue, occlusion); if (client_) { if (uses_mailbox_) { diff --git a/cc/layers/texture_layer.h b/cc/layers/texture_layer.h index bb179a6..6ef413c 100644 --- a/cc/layers/texture_layer.h +++ b/cc/layers/texture_layer.h @@ -138,7 +138,7 @@ class CC_EXPORT TextureLayer : public Layer { virtual void SetLayerTreeHost(LayerTreeHost* layer_tree_host) OVERRIDE; virtual bool DrawsContent() const OVERRIDE; virtual bool Update(ResourceUpdateQueue* queue, - const OcclusionTracker* occlusion) OVERRIDE; + const OcclusionTracker<Layer>* occlusion) OVERRIDE; virtual void PushPropertiesTo(LayerImpl* layer) OVERRIDE; virtual Region VisibleContentOpaqueRegion() const OVERRIDE; diff --git a/cc/layers/tiled_layer.cc b/cc/layers/tiled_layer.cc index d4ec763..8ad494c 100644 --- a/cc/layers/tiled_layer.cc +++ b/cc/layers/tiled_layer.cc @@ -17,6 +17,7 @@ #include "cc/resources/prioritized_resource.h" #include "cc/resources/priority_calculator.h" #include "cc/trees/layer_tree_host.h" +#include "cc/trees/occlusion_tracker.h" #include "third_party/khronos/GLES2/gl2.h" #include "ui/gfx/rect_conversions.h" @@ -326,7 +327,7 @@ bool TiledLayer::UpdateTiles(int left, int right, int bottom, ResourceUpdateQueue* queue, - const OcclusionTracker* occlusion, + const OcclusionTracker<Layer>* occlusion, bool* updated) { CreateUpdaterIfNeeded(); @@ -358,7 +359,7 @@ void TiledLayer::MarkOcclusionsAndRequestTextures( int top, int right, int bottom, - const OcclusionTracker* occlusion) { + const OcclusionTracker<Layer>* occlusion) { // There is some difficult dependancies between occlusions, recording // occlusion metrics and requesting memory so those are encapsulated in this // function: - We only want to call RequestLate on unoccluded textures (to @@ -477,7 +478,7 @@ void TiledLayer::UpdateTileTextures(const gfx::Rect& update_rect, int right, int bottom, ResourceUpdateQueue* queue, - const OcclusionTracker* occlusion) { + const OcclusionTracker<Layer>* occlusion) { // The update_rect should be in layer space. So we have to convert the // paint_rect from content space to layer space. float width_scale = @@ -732,7 +733,7 @@ void TiledLayer::UpdateScrollPrediction() { } bool TiledLayer::Update(ResourceUpdateQueue* queue, - const OcclusionTracker* occlusion) { + const OcclusionTracker<Layer>* occlusion) { DCHECK(!skips_draw_ && !failed_update_); // Did ResetUpdateState get skipped? // Tiled layer always causes commits to wait for activation, as it does diff --git a/cc/layers/tiled_layer.h b/cc/layers/tiled_layer.h index 50e2b67..e272497 100644 --- a/cc/layers/tiled_layer.h +++ b/cc/layers/tiled_layer.h @@ -35,7 +35,7 @@ class CC_EXPORT TiledLayer : public ContentsScalingLayer { OVERRIDE; virtual Region VisibleContentOpaqueRegion() const OVERRIDE; virtual bool Update(ResourceUpdateQueue* queue, - const OcclusionTracker* occlusion) OVERRIDE; + const OcclusionTracker<Layer>* occlusion) OVERRIDE; virtual void OnOutputSurfaceCreated() OVERRIDE; protected: @@ -85,18 +85,19 @@ class CC_EXPORT TiledLayer : public ContentsScalingLayer { bool TileOnlyNeedsPartialUpdate(UpdatableTile* tile); bool TileNeedsBufferedUpdate(UpdatableTile* tile); - void MarkOcclusionsAndRequestTextures(int left, - int top, - int right, - int bottom, - const OcclusionTracker* occlusion); + void MarkOcclusionsAndRequestTextures( + int left, + int top, + int right, + int bottom, + const OcclusionTracker<Layer>* occlusion); bool UpdateTiles(int left, int top, int right, int bottom, ResourceUpdateQueue* queue, - const OcclusionTracker* occlusion, + const OcclusionTracker<Layer>* occlusion, bool* did_paint); bool HaveTexturesForTiles(int left, int top, @@ -117,7 +118,7 @@ class CC_EXPORT TiledLayer : public ContentsScalingLayer { int right, int bottom, ResourceUpdateQueue* queue, - const OcclusionTracker* occlusion); + const OcclusionTracker<Layer>* occlusion); void UpdateScrollPrediction(); UpdatableTile* TileAt(int i, int j) const; diff --git a/cc/layers/tiled_layer_unittest.cc b/cc/layers/tiled_layer_unittest.cc index 3204280..f784a52 100644 --- a/cc/layers/tiled_layer_unittest.cc +++ b/cc/layers/tiled_layer_unittest.cc @@ -22,6 +22,7 @@ #include "cc/test/fake_rendering_stats_instrumentation.h" #include "cc/test/geometry_test_utils.h" #include "cc/test/tiled_layer_test_common.h" +#include "cc/trees/occlusion_tracker.h" #include "cc/trees/single_thread_proxy.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/gfx/rect_conversions.h" @@ -30,7 +31,7 @@ namespace cc { namespace { -class TestOcclusionTracker : public OcclusionTracker { +class TestOcclusionTracker : public OcclusionTracker<Layer> { public: TestOcclusionTracker() : OcclusionTracker(gfx::Rect(0, 0, 1000, 1000), true) { stack_.push_back(StackObject()); diff --git a/cc/layers/ui_resource_layer_unittest.cc b/cc/layers/ui_resource_layer_unittest.cc index 0bb02b6..c05d312 100644 --- a/cc/layers/ui_resource_layer_unittest.cc +++ b/cc/layers/ui_resource_layer_unittest.cc @@ -58,7 +58,7 @@ TEST_F(UIResourceLayerTest, SetBitmap) { EXPECT_EQ(test_layer->layer_tree_host(), layer_tree_host_.get()); ResourceUpdateQueue queue; - OcclusionTracker occlusion_tracker(gfx::Rect(), false); + OcclusionTracker<Layer> occlusion_tracker(gfx::Rect(), false); test_layer->SavePaintProperties(); test_layer->Update(&queue, &occlusion_tracker); @@ -86,7 +86,7 @@ TEST_F(UIResourceLayerTest, SetUIResourceId) { EXPECT_EQ(test_layer->layer_tree_host(), layer_tree_host_.get()); ResourceUpdateQueue queue; - OcclusionTracker occlusion_tracker(gfx::Rect(), false); + OcclusionTracker<Layer> occlusion_tracker(gfx::Rect(), false); test_layer->SavePaintProperties(); test_layer->Update(&queue, &occlusion_tracker); diff --git a/cc/layers/video_layer.cc b/cc/layers/video_layer.cc index 8d728e0..4ddfdae 100644 --- a/cc/layers/video_layer.cc +++ b/cc/layers/video_layer.cc @@ -23,7 +23,7 @@ scoped_ptr<LayerImpl> VideoLayer::CreateLayerImpl(LayerTreeImpl* tree_impl) { } bool VideoLayer::Update(ResourceUpdateQueue* queue, - const OcclusionTracker* occlusion) { + const OcclusionTracker<Layer>* occlusion) { bool updated = Layer::Update(queue, occlusion); // Video layer doesn't update any resources from the main thread side, diff --git a/cc/layers/video_layer.h b/cc/layers/video_layer.h index 4d14f80..dd2c4e1 100644 --- a/cc/layers/video_layer.h +++ b/cc/layers/video_layer.h @@ -25,7 +25,8 @@ class CC_EXPORT VideoLayer : public Layer { OVERRIDE; virtual bool Update(ResourceUpdateQueue* queue, - const OcclusionTracker* occlusion) OVERRIDE; + const OcclusionTracker<Layer>* occlusion) OVERRIDE; + private: explicit VideoLayer(VideoFrameProvider* provider); virtual ~VideoLayer(); |