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 #ifndef CCLayerTreeHost_h | 5 #ifndef CCLayerTreeHost_h |
6 #define CCLayerTreeHost_h | 6 #define CCLayerTreeHost_h |
7 | 7 |
8 #include <limits> | 8 #include <limits> |
9 | 9 |
10 #include "IntRect.h" | 10 #include "IntRect.h" |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/cancelable_callback.h" | 12 #include "base/cancelable_callback.h" |
13 #include "base/hash_tables.h" | 13 #include "base/hash_tables.h" |
14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
| 16 #include "base/time.h" |
16 #include "cc/animation_events.h" | 17 #include "cc/animation_events.h" |
17 #include "cc/graphics_context.h" | 18 #include "cc/graphics_context.h" |
18 #include "cc/layer_tree_host_client.h" | 19 #include "cc/layer_tree_host_client.h" |
19 #include "cc/layer_tree_host_common.h" | 20 #include "cc/layer_tree_host_common.h" |
20 #include "cc/occlusion_tracker.h" | 21 #include "cc/occlusion_tracker.h" |
21 #include "cc/prioritized_texture_manager.h" | 22 #include "cc/prioritized_texture_manager.h" |
22 #include "cc/proxy.h" | 23 #include "cc/proxy.h" |
23 #include "cc/rate_limiter.h" | 24 #include "cc/rate_limiter.h" |
24 #include "cc/rendering_stats.h" | 25 #include "cc/rendering_stats.h" |
25 #include "cc/scoped_ptr_vector.h" | 26 #include "cc/scoped_ptr_vector.h" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 // Returns true if any LayerTreeHost is alive. | 100 // Returns true if any LayerTreeHost is alive. |
100 static bool anyLayerTreeHostInstanceExists(); | 101 static bool anyLayerTreeHostInstanceExists(); |
101 | 102 |
102 static bool needsFilterContext() { return s_needsFilterContext; } | 103 static bool needsFilterContext() { return s_needsFilterContext; } |
103 static void setNeedsFilterContext(bool needsFilterContext) { s_needsFilterCo
ntext = needsFilterContext; } | 104 static void setNeedsFilterContext(bool needsFilterContext) { s_needsFilterCo
ntext = needsFilterContext; } |
104 bool needsSharedContext() const { return needsFilterContext() || settings().
acceleratePainting; } | 105 bool needsSharedContext() const { return needsFilterContext() || settings().
acceleratePainting; } |
105 | 106 |
106 // LayerTreeHost interface to Proxy. | 107 // LayerTreeHost interface to Proxy. |
107 void willBeginFrame() { m_client->willBeginFrame(); } | 108 void willBeginFrame() { m_client->willBeginFrame(); } |
108 void didBeginFrame() { m_client->didBeginFrame(); } | 109 void didBeginFrame() { m_client->didBeginFrame(); } |
109 void updateAnimations(double monotonicFrameBeginTime); | 110 void updateAnimations(base::TimeTicks monotonicFrameBeginTime); |
110 void layout(); | 111 void layout(); |
111 void beginCommitOnImplThread(LayerTreeHostImpl*); | 112 void beginCommitOnImplThread(LayerTreeHostImpl*); |
112 void finishCommitOnImplThread(LayerTreeHostImpl*); | 113 void finishCommitOnImplThread(LayerTreeHostImpl*); |
113 void willCommit(); | 114 void willCommit(); |
114 void commitComplete(); | 115 void commitComplete(); |
115 scoped_ptr<GraphicsContext> createContext(); | 116 scoped_ptr<GraphicsContext> createContext(); |
116 scoped_ptr<InputHandler> createInputHandler(); | 117 scoped_ptr<InputHandler> createInputHandler(); |
117 virtual scoped_ptr<LayerTreeHostImpl> createLayerTreeHostImpl(LayerTreeHostI
mplClient*); | 118 virtual scoped_ptr<LayerTreeHostImpl> createLayerTreeHostImpl(LayerTreeHostI
mplClient*); |
118 void didLoseContext(); | 119 void didLoseContext(); |
119 enum RecreateResult { | 120 enum RecreateResult { |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 | 157 |
157 // Test only hook | 158 // Test only hook |
158 void loseContext(int numTimes); | 159 void loseContext(int numTimes); |
159 | 160 |
160 void setNeedsAnimate(); | 161 void setNeedsAnimate(); |
161 // virtual for testing | 162 // virtual for testing |
162 virtual void setNeedsCommit(); | 163 virtual void setNeedsCommit(); |
163 void setNeedsRedraw(); | 164 void setNeedsRedraw(); |
164 bool commitRequested() const; | 165 bool commitRequested() const; |
165 | 166 |
166 void setAnimationEvents(scoped_ptr<AnimationEventsVector>, double wallClockT
ime); | 167 void setAnimationEvents(scoped_ptr<AnimationEventsVector>, base::Time wallCl
ockTime); |
167 virtual void didAddAnimation(); | 168 virtual void didAddAnimation(); |
168 | 169 |
169 Layer* rootLayer() { return m_rootLayer.get(); } | 170 Layer* rootLayer() { return m_rootLayer.get(); } |
170 const Layer* rootLayer() const { return m_rootLayer.get(); } | 171 const Layer* rootLayer() const { return m_rootLayer.get(); } |
171 void setRootLayer(scoped_refptr<Layer>); | 172 void setRootLayer(scoped_refptr<Layer>); |
172 | 173 |
173 const LayerTreeSettings& settings() const { return m_settings; } | 174 const LayerTreeSettings& settings() const { return m_settings; } |
174 | 175 |
175 void setViewportSize(const IntSize& layoutViewportSize, const IntSize& devic
eViewportSize); | 176 void setViewportSize(const IntSize& layoutViewportSize, const IntSize& devic
eViewportSize); |
176 | 177 |
177 const IntSize& layoutViewportSize() const { return m_layoutViewportSize; } | 178 const IntSize& layoutViewportSize() const { return m_layoutViewportSize; } |
178 const IntSize& deviceViewportSize() const { return m_deviceViewportSize; } | 179 const IntSize& deviceViewportSize() const { return m_deviceViewportSize; } |
179 | 180 |
180 void setPageScaleFactorAndLimits(float pageScaleFactor, float minPageScaleFa
ctor, float maxPageScaleFactor); | 181 void setPageScaleFactorAndLimits(float pageScaleFactor, float minPageScaleFa
ctor, float maxPageScaleFactor); |
181 | 182 |
182 void setBackgroundColor(SkColor color) { m_backgroundColor = color; } | 183 void setBackgroundColor(SkColor color) { m_backgroundColor = color; } |
183 | 184 |
184 void setHasTransparentBackground(bool transparent) { m_hasTransparentBackgro
und = transparent; } | 185 void setHasTransparentBackground(bool transparent) { m_hasTransparentBackgro
und = transparent; } |
185 | 186 |
186 PrioritizedTextureManager* contentsTextureManager() const; | 187 PrioritizedTextureManager* contentsTextureManager() const; |
187 | 188 |
188 bool visible() const { return m_visible; } | 189 bool visible() const { return m_visible; } |
189 void setVisible(bool); | 190 void setVisible(bool); |
190 | 191 |
191 void startPageScaleAnimation(const IntSize& targetPosition, bool useAnchor,
float scale, double durationSec); | 192 void startPageScaleAnimation(const IntSize& targetPosition, bool useAnchor,
float scale, base::TimeDelta duration); |
192 | 193 |
193 void applyScrollAndScale(const ScrollAndScaleSet&); | 194 void applyScrollAndScale(const ScrollAndScaleSet&); |
194 void setImplTransform(const WebKit::WebTransformationMatrix&); | 195 void setImplTransform(const WebKit::WebTransformationMatrix&); |
195 | 196 |
196 void startRateLimiter(WebKit::WebGraphicsContext3D*); | 197 void startRateLimiter(WebKit::WebGraphicsContext3D*); |
197 void stopRateLimiter(WebKit::WebGraphicsContext3D*); | 198 void stopRateLimiter(WebKit::WebGraphicsContext3D*); |
198 | 199 |
199 // RateLimitClient implementation | 200 // RateLimitClient implementation |
200 virtual void rateLimit() OVERRIDE; | 201 virtual void rateLimit() OVERRIDE; |
201 | 202 |
(...skipping 21 matching lines...) Expand all Loading... |
223 bool paintMasksForRenderSurface(Layer*, ResourceUpdateQueue&); | 224 bool paintMasksForRenderSurface(Layer*, ResourceUpdateQueue&); |
224 | 225 |
225 void updateLayers(Layer*, ResourceUpdateQueue&); | 226 void updateLayers(Layer*, ResourceUpdateQueue&); |
226 void triggerPrepaint(); | 227 void triggerPrepaint(); |
227 | 228 |
228 void prioritizeTextures(const LayerList&, OverdrawMetrics&); | 229 void prioritizeTextures(const LayerList&, OverdrawMetrics&); |
229 void setPrioritiesForSurfaces(size_t surfaceMemoryBytes); | 230 void setPrioritiesForSurfaces(size_t surfaceMemoryBytes); |
230 void setPrioritiesForLayers(const LayerList&); | 231 void setPrioritiesForLayers(const LayerList&); |
231 size_t calculateMemoryForRenderSurfaces(const LayerList& updateList); | 232 size_t calculateMemoryForRenderSurfaces(const LayerList& updateList); |
232 | 233 |
233 void animateLayers(double monotonicTime); | 234 void animateLayers(base::TimeTicks monotonicTime); |
234 bool animateLayersRecursive(Layer* current, double monotonicTime); | 235 bool animateLayersRecursive(Layer* current, base::TimeTicks time); |
235 void setAnimationEventsRecursive(const AnimationEventsVector&, Layer*, doubl
e wallClockTime); | 236 void setAnimationEventsRecursive(const AnimationEventsVector&, Layer*, base:
:Time wallClockTime); |
236 | 237 |
237 bool m_animating; | 238 bool m_animating; |
238 bool m_needsAnimateLayers; | 239 bool m_needsAnimateLayers; |
239 | 240 |
240 base::CancelableClosure m_prepaintCallback; | 241 base::CancelableClosure m_prepaintCallback; |
241 | 242 |
242 LayerTreeHostClient* m_client; | 243 LayerTreeHostClient* m_client; |
243 | 244 |
244 int m_commitNumber; | 245 int m_commitNumber; |
245 RenderingStats m_renderingStats; | 246 RenderingStats m_renderingStats; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 size_t m_partialTextureUpdateRequests; | 281 size_t m_partialTextureUpdateRequests; |
281 | 282 |
282 static bool s_needsFilterContext; | 283 static bool s_needsFilterContext; |
283 | 284 |
284 DISALLOW_COPY_AND_ASSIGN(LayerTreeHost); | 285 DISALLOW_COPY_AND_ASSIGN(LayerTreeHost); |
285 }; | 286 }; |
286 | 287 |
287 } // namespace cc | 288 } // namespace cc |
288 | 289 |
289 #endif | 290 #endif |
OLD | NEW |