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 CC_LAYER_TREE_HOST_IMPL_H_ | 5 #ifndef CC_LAYER_TREE_HOST_IMPL_H_ |
6 #define CC_LAYER_TREE_HOST_IMPL_H_ | 6 #define CC_LAYER_TREE_HOST_IMPL_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/time.h" | 10 #include "base/time.h" |
11 #include "cc/animation_events.h" | 11 #include "cc/animation_events.h" |
12 #include "cc/animation_registrar.h" | 12 #include "cc/animation_registrar.h" |
13 #include "cc/cc_export.h" | 13 #include "cc/cc_export.h" |
14 #include "cc/input_handler.h" | 14 #include "cc/input_handler.h" |
15 #include "cc/output_surface_client.h" | 15 #include "cc/output_surface_client.h" |
16 #include "cc/pinch_zoom_viewport.h" | |
17 #include "cc/render_pass.h" | 16 #include "cc/render_pass.h" |
18 #include "cc/render_pass_sink.h" | 17 #include "cc/render_pass_sink.h" |
19 #include "cc/renderer.h" | 18 #include "cc/renderer.h" |
20 #include "cc/tile_manager.h" | 19 #include "cc/tile_manager.h" |
21 #include "cc/top_controls_manager_client.h" | 20 #include "cc/top_controls_manager_client.h" |
22 #include "skia/ext/refptr.h" | 21 #include "skia/ext/refptr.h" |
23 #include "third_party/skia/include/core/SkColor.h" | 22 #include "third_party/skia/include/core/SkColor.h" |
24 #include "third_party/skia/include/core/SkPicture.h" | 23 #include "third_party/skia/include/core/SkPicture.h" |
25 #include "ui/gfx/rect.h" | 24 #include "ui/gfx/rect.h" |
26 | 25 |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 void setVisible(bool); | 182 void setVisible(bool); |
184 | 183 |
185 size_t memoryAllocationLimitBytes() const { return m_managedMemoryPolicy.byt
esLimitWhenVisible; } | 184 size_t memoryAllocationLimitBytes() const { return m_managedMemoryPolicy.byt
esLimitWhenVisible; } |
186 | 185 |
187 void setViewportSize(const gfx::Size& layoutViewportSize, const gfx::Size& d
eviceViewportSize); | 186 void setViewportSize(const gfx::Size& layoutViewportSize, const gfx::Size& d
eviceViewportSize); |
188 const gfx::Size& layoutViewportSize() const { return m_layoutViewportSize; } | 187 const gfx::Size& layoutViewportSize() const { return m_layoutViewportSize; } |
189 | 188 |
190 float deviceScaleFactor() const { return m_deviceScaleFactor; } | 189 float deviceScaleFactor() const { return m_deviceScaleFactor; } |
191 void setDeviceScaleFactor(float); | 190 void setDeviceScaleFactor(float); |
192 | 191 |
193 float pageScaleFactor() const; | |
194 void setPageScaleFactorAndLimits(float pageScaleFactor, float minPageScaleFa
ctor, float maxPageScaleFactor); | |
195 | |
196 scoped_ptr<ScrollAndScaleSet> processScrollDeltas(); | 192 scoped_ptr<ScrollAndScaleSet> processScrollDeltas(); |
197 gfx::Transform implTransform() const; | |
198 | 193 |
199 void startPageScaleAnimation(gfx::Vector2d targetOffset, bool useAnchor, flo
at scale, base::TimeDelta duration); | 194 void startPageScaleAnimation(gfx::Vector2d targetOffset, bool useAnchor, flo
at scale, base::TimeDelta duration); |
200 | 195 |
201 bool needsAnimateLayers() const { return !m_animationRegistrar->active_anima
tion_controllers().empty(); } | 196 bool needsAnimateLayers() const { return !m_animationRegistrar->active_anima
tion_controllers().empty(); } |
202 | 197 |
203 void renderingStats(RenderingStats*) const; | 198 void renderingStats(RenderingStats*) const; |
204 | 199 |
205 void sendManagedMemoryStats( | 200 void sendManagedMemoryStats( |
206 size_t memoryVisibleBytes, | 201 size_t memoryVisibleBytes, |
207 size_t memoryVisibleAndNearbyBytes, | 202 size_t memoryVisibleAndNearbyBytes, |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 // Iterates in draw order, so that when a surface is removed, and its | 240 // Iterates in draw order, so that when a surface is removed, and its |
246 // target becomes empty, then its target can be removed also. | 241 // target becomes empty, then its target can be removed also. |
247 size_t renderPassListBegin(const RenderPassList&) const { return 0; } | 242 size_t renderPassListBegin(const RenderPassList&) const { return 0; } |
248 size_t renderPassListEnd(const RenderPassList& list) const { return list
.size(); } | 243 size_t renderPassListEnd(const RenderPassList& list) const { return list
.size(); } |
249 size_t renderPassListNext(size_t it) const { return it + 1; } | 244 size_t renderPassListNext(size_t it) const { return it + 1; } |
250 }; | 245 }; |
251 | 246 |
252 template<typename RenderPassCuller> | 247 template<typename RenderPassCuller> |
253 static void removeRenderPasses(RenderPassCuller, FrameData&); | 248 static void removeRenderPasses(RenderPassCuller, FrameData&); |
254 | 249 |
255 float totalPageScaleFactorForTesting() const { return m_pinchZoomViewport.to
tal_page_scale_factor(); } | |
256 | |
257 const PinchZoomViewport& pinchZoomViewport() const { return m_pinchZoomViewp
ort; } | |
258 | |
259 skia::RefPtr<SkPicture> capturePicture(); | 250 skia::RefPtr<SkPicture> capturePicture(); |
260 | 251 |
261 bool pinchGestureActive() const { return m_pinchGestureActive; } | 252 bool pinchGestureActive() const { return m_pinchGestureActive; } |
262 | 253 |
263 void setTreePriority(TreePriority priority); | 254 void setTreePriority(TreePriority priority); |
264 | 255 |
265 protected: | 256 protected: |
266 LayerTreeHostImpl(const LayerTreeSettings&, LayerTreeHostImplClient*, Proxy*
); | 257 LayerTreeHostImpl(const LayerTreeSettings&, LayerTreeHostImplClient*, Proxy*
); |
267 void activatePendingTree(); | 258 void activatePendingTree(); |
268 | 259 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 bool m_pinchGestureActive; | 328 bool m_pinchGestureActive; |
338 gfx::Point m_previousPinchAnchor; | 329 gfx::Point m_previousPinchAnchor; |
339 | 330 |
340 scoped_ptr<TopControlsManager> m_topControlsManager; | 331 scoped_ptr<TopControlsManager> m_topControlsManager; |
341 | 332 |
342 scoped_ptr<PageScaleAnimation> m_pageScaleAnimation; | 333 scoped_ptr<PageScaleAnimation> m_pageScaleAnimation; |
343 | 334 |
344 // This is used for ticking animations slowly when hidden. | 335 // This is used for ticking animations slowly when hidden. |
345 scoped_ptr<LayerTreeHostImplTimeSourceAdapter> m_timeSourceClientAdapter; | 336 scoped_ptr<LayerTreeHostImplTimeSourceAdapter> m_timeSourceClientAdapter; |
346 | 337 |
347 PinchZoomViewport m_pinchZoomViewport; | |
348 | |
349 scoped_ptr<FrameRateCounter> m_fpsCounter; | 338 scoped_ptr<FrameRateCounter> m_fpsCounter; |
350 scoped_ptr<PaintTimeCounter> m_paintTimeCounter; | 339 scoped_ptr<PaintTimeCounter> m_paintTimeCounter; |
351 scoped_ptr<DebugRectHistory> m_debugRectHistory; | 340 scoped_ptr<DebugRectHistory> m_debugRectHistory; |
352 | 341 |
353 int64 m_numImplThreadScrolls; | 342 int64 m_numImplThreadScrolls; |
354 int64 m_numMainThreadScrolls; | 343 int64 m_numMainThreadScrolls; |
355 | 344 |
356 int64 m_cumulativeNumLayersDrawn; | 345 int64 m_cumulativeNumLayersDrawn; |
357 | 346 |
358 int64 m_cumulativeNumMissingTiles; | 347 int64 m_cumulativeNumMissingTiles; |
359 | 348 |
360 size_t m_lastSentMemoryVisibleBytes; | 349 size_t m_lastSentMemoryVisibleBytes; |
361 size_t m_lastSentMemoryVisibleAndNearbyBytes; | 350 size_t m_lastSentMemoryVisibleAndNearbyBytes; |
362 size_t m_lastSentMemoryUseBytes; | 351 size_t m_lastSentMemoryUseBytes; |
363 | 352 |
364 scoped_ptr<AnimationRegistrar> m_animationRegistrar; | 353 scoped_ptr<AnimationRegistrar> m_animationRegistrar; |
365 | 354 |
366 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); | 355 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); |
367 }; | 356 }; |
368 | 357 |
369 } // namespace cc | 358 } // namespace cc |
370 | 359 |
371 #endif // CC_LAYER_TREE_HOST_IMPL_H_ | 360 #endif // CC_LAYER_TREE_HOST_IMPL_H_ |
OLD | NEW |