Reenable NullOpenerRedirectForksProcess, as the offending patch has been reverted
[chromium-blink-merge.git] / cc / tiled_layer.h
blob11007e1aef55ef0246b83f938c50b355df9375d5
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
3 // found in the LICENSE file.
5 #ifndef CC_TILED_LAYER_H_
6 #define CC_TILED_LAYER_H_
8 #include "cc/cc_export.h"
9 #include "cc/contents_scaling_layer.h"
10 #include "cc/layer_tiling_data.h"
11 #include "cc/layer_updater.h"
13 namespace cc {
14 class UpdatableTile;
16 class CC_EXPORT TiledLayer : public ContentsScalingLayer {
17 public:
18 enum TilingOption { AlwaysTile, NeverTile, AutoTile };
20 virtual void setIsMask(bool) OVERRIDE;
22 virtual void pushPropertiesTo(LayerImpl*) OVERRIDE;
24 virtual bool drawsContent() const OVERRIDE;
26 virtual void setNeedsDisplayRect(const gfx::RectF&) OVERRIDE;
28 virtual void setLayerTreeHost(LayerTreeHost*) OVERRIDE;
30 virtual void setTexturePriorities(const PriorityCalculator&) OVERRIDE;
32 virtual Region visibleContentOpaqueRegion() const OVERRIDE;
34 virtual void update(ResourceUpdateQueue&, const OcclusionTracker*, RenderingStats&) OVERRIDE;
36 protected:
37 TiledLayer();
38 virtual ~TiledLayer();
40 void updateTileSizeAndTilingOption();
41 void updateBounds();
43 // Exposed to subclasses for testing.
44 void setTileSize(const gfx::Size&);
45 void setTextureFormat(GLenum textureFormat) { m_textureFormat = textureFormat; }
46 void setBorderTexelOption(LayerTilingData::BorderTexelOption);
47 size_t numPaintedTiles() { return m_tiler->tiles().size(); }
49 virtual LayerUpdater* updater() const = 0;
50 virtual void createUpdaterIfNeeded() = 0;
52 // Set invalidations to be potentially repainted during update().
53 void invalidateContentRect(const gfx::Rect& contentRect);
55 // Reset state on tiles that will be used for updating the layer.
56 void resetUpdateState();
58 // After preparing an update, returns true if more painting is needed.
59 bool needsIdlePaint();
60 gfx::Rect idlePaintRect();
62 bool skipsDraw() const { return m_skipsDraw; }
64 // Virtual for testing
65 virtual PrioritizedResourceManager* resourceManager() const;
67 private:
68 virtual scoped_ptr<LayerImpl> createLayerImpl() OVERRIDE;
70 void createTilerIfNeeded();
71 void setTilingOption(TilingOption);
73 bool tileOnlyNeedsPartialUpdate(UpdatableTile*);
74 bool tileNeedsBufferedUpdate(UpdatableTile*);
76 void markOcclusionsAndRequestTextures(int left, int top, int right, int bottom, const OcclusionTracker*);
78 bool updateTiles(int left, int top, int right, int bottom, ResourceUpdateQueue&, const OcclusionTracker*, RenderingStats&, bool& didPaint);
79 bool haveTexturesForTiles(int left, int top, int right, int bottom, bool ignoreOcclusions);
80 gfx::Rect markTilesForUpdate(int left, int top, int right, int bottom, bool ignoreOcclusions);
81 void updateTileTextures(const gfx::Rect& paintRect, int left, int top, int right, int bottom, ResourceUpdateQueue&, const OcclusionTracker*, RenderingStats&);
82 void updateScrollPrediction();
84 UpdatableTile* tileAt(int, int) const;
85 UpdatableTile* createTile(int, int);
87 GLenum m_textureFormat;
88 bool m_skipsDraw;
89 bool m_failedUpdate;
91 // Used for predictive painting.
92 gfx::Vector2d m_predictedScroll;
93 gfx::Rect m_predictedVisibleRect;
94 gfx::Rect m_previousVisibleRect;
95 gfx::Size m_previousContentBounds;
97 TilingOption m_tilingOption;
98 scoped_ptr<LayerTilingData> m_tiler;
102 #endif // CC_TILED_LAYER_H_