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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 void setVisible(bool); | 183 void setVisible(bool); |
185 | 184 |
186 size_t memoryAllocationLimitBytes() const { return m_managedMemoryPolicy.byt
esLimitWhenVisible; } | 185 size_t memoryAllocationLimitBytes() const { return m_managedMemoryPolicy.byt
esLimitWhenVisible; } |
187 | 186 |
188 void setViewportSize(const gfx::Size& layoutViewportSize, const gfx::Size& d
eviceViewportSize); | 187 void setViewportSize(const gfx::Size& layoutViewportSize, const gfx::Size& d
eviceViewportSize); |
189 const gfx::Size& layoutViewportSize() const { return m_layoutViewportSize; } | 188 const gfx::Size& layoutViewportSize() const { return m_layoutViewportSize; } |
190 | 189 |
191 float deviceScaleFactor() const { return m_deviceScaleFactor; } | 190 float deviceScaleFactor() const { return m_deviceScaleFactor; } |
192 void setDeviceScaleFactor(float); | 191 void setDeviceScaleFactor(float); |
193 | 192 |
194 float pageScaleFactor() const; | |
195 void setPageScaleFactorAndLimits(float pageScaleFactor, float minPageScaleFa
ctor, float maxPageScaleFactor); | |
196 | |
197 scoped_ptr<ScrollAndScaleSet> processScrollDeltas(); | 193 scoped_ptr<ScrollAndScaleSet> processScrollDeltas(); |
198 gfx::Transform implTransform() const; | |
199 | 194 |
200 void startPageScaleAnimation(gfx::Vector2d targetOffset, bool useAnchor, flo
at scale, base::TimeDelta duration); | 195 void startPageScaleAnimation(gfx::Vector2d targetOffset, bool useAnchor, flo
at scale, base::TimeDelta duration); |
201 | 196 |
202 bool needsAnimateLayers() const { return !m_animationRegistrar->active_anima
tion_controllers().empty(); } | 197 bool needsAnimateLayers() const { return !m_animationRegistrar->active_anima
tion_controllers().empty(); } |
203 | 198 |
204 void renderingStats(RenderingStats*) const; | 199 void renderingStats(RenderingStats*) const; |
205 | 200 |
206 void sendManagedMemoryStats( | 201 void sendManagedMemoryStats( |
207 size_t memoryVisibleBytes, | 202 size_t memoryVisibleBytes, |
208 size_t memoryVisibleAndNearbyBytes, | 203 size_t memoryVisibleAndNearbyBytes, |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 // Iterates in draw order, so that when a surface is removed, and its | 241 // Iterates in draw order, so that when a surface is removed, and its |
247 // target becomes empty, then its target can be removed also. | 242 // target becomes empty, then its target can be removed also. |
248 size_t renderPassListBegin(const RenderPassList&) const { return 0; } | 243 size_t renderPassListBegin(const RenderPassList&) const { return 0; } |
249 size_t renderPassListEnd(const RenderPassList& list) const { return list
.size(); } | 244 size_t renderPassListEnd(const RenderPassList& list) const { return list
.size(); } |
250 size_t renderPassListNext(size_t it) const { return it + 1; } | 245 size_t renderPassListNext(size_t it) const { return it + 1; } |
251 }; | 246 }; |
252 | 247 |
253 template<typename RenderPassCuller> | 248 template<typename RenderPassCuller> |
254 static void removeRenderPasses(RenderPassCuller, FrameData&); | 249 static void removeRenderPasses(RenderPassCuller, FrameData&); |
255 | 250 |
256 float totalPageScaleFactorForTesting() const { return m_pinchZoomViewport.to
tal_page_scale_factor(); } | |
257 | |
258 const PinchZoomViewport& pinchZoomViewport() const { return m_pinchZoomViewp
ort; } | |
259 | |
260 skia::RefPtr<SkPicture> capturePicture(); | 251 skia::RefPtr<SkPicture> capturePicture(); |
261 | 252 |
262 bool pinchGestureActive() const { return m_pinchGestureActive; } | 253 bool pinchGestureActive() const { return m_pinchGestureActive; } |
263 | 254 |
264 void setTreePriority(TreePriority priority); | 255 void setTreePriority(TreePriority priority); |
265 | 256 |
266 void beginNextFrame(); | 257 void beginNextFrame(); |
267 base::TimeTicks currentFrameTime(); | 258 base::TimeTicks currentFrameTime(); |
268 | 259 |
269 protected: | 260 protected: |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 bool m_pinchGestureActive; | 332 bool m_pinchGestureActive; |
342 gfx::Point m_previousPinchAnchor; | 333 gfx::Point m_previousPinchAnchor; |
343 | 334 |
344 scoped_ptr<TopControlsManager> m_topControlsManager; | 335 scoped_ptr<TopControlsManager> m_topControlsManager; |
345 | 336 |
346 scoped_ptr<PageScaleAnimation> m_pageScaleAnimation; | 337 scoped_ptr<PageScaleAnimation> m_pageScaleAnimation; |
347 | 338 |
348 // This is used for ticking animations slowly when hidden. | 339 // This is used for ticking animations slowly when hidden. |
349 scoped_ptr<LayerTreeHostImplTimeSourceAdapter> m_timeSourceClientAdapter; | 340 scoped_ptr<LayerTreeHostImplTimeSourceAdapter> m_timeSourceClientAdapter; |
350 | 341 |
351 PinchZoomViewport m_pinchZoomViewport; | |
352 | |
353 scoped_ptr<FrameRateCounter> m_fpsCounter; | 342 scoped_ptr<FrameRateCounter> m_fpsCounter; |
354 scoped_ptr<PaintTimeCounter> m_paintTimeCounter; | 343 scoped_ptr<PaintTimeCounter> m_paintTimeCounter; |
355 scoped_ptr<DebugRectHistory> m_debugRectHistory; | 344 scoped_ptr<DebugRectHistory> m_debugRectHistory; |
356 | 345 |
357 int64 m_numImplThreadScrolls; | 346 int64 m_numImplThreadScrolls; |
358 int64 m_numMainThreadScrolls; | 347 int64 m_numMainThreadScrolls; |
359 | 348 |
360 int64 m_cumulativeNumLayersDrawn; | 349 int64 m_cumulativeNumLayersDrawn; |
361 | 350 |
362 int64 m_cumulativeNumMissingTiles; | 351 int64 m_cumulativeNumMissingTiles; |
363 | 352 |
364 size_t m_lastSentMemoryVisibleBytes; | 353 size_t m_lastSentMemoryVisibleBytes; |
365 size_t m_lastSentMemoryVisibleAndNearbyBytes; | 354 size_t m_lastSentMemoryVisibleAndNearbyBytes; |
366 size_t m_lastSentMemoryUseBytes; | 355 size_t m_lastSentMemoryUseBytes; |
367 | 356 |
368 base::TimeTicks m_currentFrameTime; | 357 base::TimeTicks m_currentFrameTime; |
369 | 358 |
370 scoped_ptr<AnimationRegistrar> m_animationRegistrar; | 359 scoped_ptr<AnimationRegistrar> m_animationRegistrar; |
371 | 360 |
372 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); | 361 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); |
373 }; | 362 }; |
374 | 363 |
375 } // namespace cc | 364 } // namespace cc |
376 | 365 |
377 #endif // CC_LAYER_TREE_HOST_IMPL_H_ | 366 #endif // CC_LAYER_TREE_HOST_IMPL_H_ |
OLD | NEW |