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_TREES_LAYER_TREE_HOST_IMPL_H_ | 5 #ifndef CC_TREES_LAYER_TREE_HOST_IMPL_H_ |
6 #define CC_TREES_LAYER_TREE_HOST_IMPL_H_ | 6 #define CC_TREES_LAYER_TREE_HOST_IMPL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 // Must be called if and only if PrepareToDraw was called. | 169 // Must be called if and only if PrepareToDraw was called. |
170 void DidDrawAllLayers(const FrameData& frame); | 170 void DidDrawAllLayers(const FrameData& frame); |
171 | 171 |
172 const LayerTreeSettings& settings() const { return settings_; } | 172 const LayerTreeSettings& settings() const { return settings_; } |
173 | 173 |
174 // Returns the currently visible viewport size in DIP. This value excludes | 174 // Returns the currently visible viewport size in DIP. This value excludes |
175 // the URL bar and non-overlay scrollbars. | 175 // the URL bar and non-overlay scrollbars. |
176 gfx::SizeF VisibleViewportSize() const; | 176 gfx::SizeF VisibleViewportSize() const; |
177 | 177 |
178 // RendererClient implementation | 178 // RendererClient implementation |
| 179 virtual gfx::Rect DeviceViewport() const OVERRIDE; |
179 private: | 180 private: |
180 virtual gfx::Size DeviceViewportSize() const OVERRIDE; | |
181 virtual float DeviceScaleFactor() const OVERRIDE; | 181 virtual float DeviceScaleFactor() const OVERRIDE; |
182 virtual const LayerTreeSettings& Settings() const OVERRIDE; | 182 virtual const LayerTreeSettings& Settings() const OVERRIDE; |
183 public: | 183 public: |
184 virtual void DidLoseOutputSurface() OVERRIDE; | 184 virtual void DidLoseOutputSurface() OVERRIDE; |
185 virtual void OnSwapBuffersComplete() OVERRIDE; | 185 virtual void OnSwapBuffersComplete() OVERRIDE; |
186 virtual void SetFullRootLayerDamage() OVERRIDE; | 186 virtual void SetFullRootLayerDamage() OVERRIDE; |
187 virtual void SetManagedMemoryPolicy(const ManagedMemoryPolicy& policy) | 187 virtual void SetManagedMemoryPolicy(const ManagedMemoryPolicy& policy) |
188 OVERRIDE; | 188 OVERRIDE; |
189 virtual void EnforceManagedMemoryPolicy(const ManagedMemoryPolicy& policy) | 189 virtual void EnforceManagedMemoryPolicy(const ManagedMemoryPolicy& policy) |
190 OVERRIDE; | 190 OVERRIDE; |
191 virtual bool HasImplThread() const OVERRIDE; | 191 virtual bool HasImplThread() const OVERRIDE; |
192 virtual bool ShouldClearRootRenderPass() const OVERRIDE; | 192 virtual bool ShouldClearRootRenderPass() const OVERRIDE; |
193 virtual CompositorFrameMetadata MakeCompositorFrameMetadata() const OVERRIDE; | 193 virtual CompositorFrameMetadata MakeCompositorFrameMetadata() const OVERRIDE; |
194 virtual bool AllowPartialSwap() const OVERRIDE; | 194 virtual bool AllowPartialSwap() const OVERRIDE; |
195 | 195 |
196 // TileManagerClient implementation. | 196 // TileManagerClient implementation. |
197 virtual void ScheduleManageTiles() OVERRIDE; | 197 virtual void ScheduleManageTiles() OVERRIDE; |
198 virtual void DidInitializeVisibleTile() OVERRIDE; | 198 virtual void DidInitializeVisibleTile() OVERRIDE; |
199 virtual bool ShouldForceTileUploadsRequiredForActivationToComplete() const | 199 virtual bool ShouldForceTileUploadsRequiredForActivationToComplete() const |
200 OVERRIDE; | 200 OVERRIDE; |
201 | 201 |
202 // OutputSurfaceClient implementation. | 202 // OutputSurfaceClient implementation. |
203 virtual void SetNeedsRedrawRect(gfx::Rect rect) OVERRIDE; | 203 virtual void SetNeedsRedrawRect(gfx::Rect rect) OVERRIDE; |
204 virtual void OnVSyncParametersChanged(base::TimeTicks timebase, | 204 virtual void OnVSyncParametersChanged(base::TimeTicks timebase, |
205 base::TimeDelta interval) OVERRIDE; | 205 base::TimeDelta interval) OVERRIDE; |
206 virtual void BeginFrame(base::TimeTicks frame_time) | 206 virtual void BeginFrame(base::TimeTicks frame_time) |
207 OVERRIDE; | 207 OVERRIDE; |
208 virtual void OnSendFrameToParentCompositorAck(const CompositorFrameAck& ack) | 208 virtual void OnSendFrameToParentCompositorAck(const CompositorFrameAck& ack) |
209 OVERRIDE; | 209 OVERRIDE; |
| 210 virtual void SetExternalDrawConstraints(const gfx::Transform& transform, |
| 211 gfx::Rect viewport) OVERRIDE; |
210 | 212 |
211 // Called from LayerTreeImpl. | 213 // Called from LayerTreeImpl. |
212 void OnCanDrawStateChangedForTree(); | 214 void OnCanDrawStateChangedForTree(); |
213 | 215 |
214 // Implementation | 216 // Implementation |
215 bool CanDraw(); | 217 bool CanDraw(); |
216 OutputSurface* output_surface() const { return output_surface_.get(); } | 218 OutputSurface* output_surface() const { return output_surface_.get(); } |
217 | 219 |
218 std::string LayerTreeAsText() const; | 220 std::string LayerTreeAsText() const; |
219 std::string LayerTreeAsJson() const; | 221 std::string LayerTreeAsJson() const; |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 | 262 |
261 void SetViewportSize(gfx::Size device_viewport_size); | 263 void SetViewportSize(gfx::Size device_viewport_size); |
262 gfx::Size device_viewport_size() const { return device_viewport_size_; } | 264 gfx::Size device_viewport_size() const { return device_viewport_size_; } |
263 | 265 |
264 void SetOverdrawBottomHeight(float overdraw_bottom_height); | 266 void SetOverdrawBottomHeight(float overdraw_bottom_height); |
265 float overdraw_bottom_height() const { return overdraw_bottom_height_; } | 267 float overdraw_bottom_height() const { return overdraw_bottom_height_; } |
266 | 268 |
267 void SetDeviceScaleFactor(float device_scale_factor); | 269 void SetDeviceScaleFactor(float device_scale_factor); |
268 float device_scale_factor() const { return device_scale_factor_; } | 270 float device_scale_factor() const { return device_scale_factor_; } |
269 | 271 |
| 272 const gfx::Transform& DeviceTransform() const; |
| 273 |
270 scoped_ptr<ScrollAndScaleSet> ProcessScrollDeltas(); | 274 scoped_ptr<ScrollAndScaleSet> ProcessScrollDeltas(); |
271 | 275 |
272 bool needs_animate_layers() const { | 276 bool needs_animate_layers() const { |
273 return !animation_registrar_->active_animation_controllers().empty(); | 277 return !animation_registrar_->active_animation_controllers().empty(); |
274 } | 278 } |
275 | 279 |
276 void SendManagedMemoryStats( | 280 void SendManagedMemoryStats( |
277 size_t memory_visible_bytes, | 281 size_t memory_visible_bytes, |
278 size_t memory_visible_and_nearby_bytes, | 282 size_t memory_visible_and_nearby_bytes, |
279 size_t memory_use_bytes); | 283 size_t memory_use_bytes); |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
450 scoped_ptr<LayerTreeImpl> recycle_tree_; | 454 scoped_ptr<LayerTreeImpl> recycle_tree_; |
451 | 455 |
452 InputHandlerClient* input_handler_client_; | 456 InputHandlerClient* input_handler_client_; |
453 bool did_lock_scrolling_layer_; | 457 bool did_lock_scrolling_layer_; |
454 bool should_bubble_scrolls_; | 458 bool should_bubble_scrolls_; |
455 bool wheel_scrolling_; | 459 bool wheel_scrolling_; |
456 // The optional delegate for the root layer scroll offset. | 460 // The optional delegate for the root layer scroll offset. |
457 LayerScrollOffsetDelegate* root_layer_scroll_offset_delegate_; | 461 LayerScrollOffsetDelegate* root_layer_scroll_offset_delegate_; |
458 LayerTreeSettings settings_; | 462 LayerTreeSettings settings_; |
459 LayerTreeDebugState debug_state_; | 463 LayerTreeDebugState debug_state_; |
460 gfx::Size device_viewport_size_; | |
461 float overdraw_bottom_height_; | |
462 float device_scale_factor_; | |
463 bool visible_; | 464 bool visible_; |
464 ManagedMemoryPolicy managed_memory_policy_; | 465 ManagedMemoryPolicy managed_memory_policy_; |
465 | 466 |
466 gfx::Vector2dF accumulated_root_overscroll_; | 467 gfx::Vector2dF accumulated_root_overscroll_; |
467 gfx::Vector2dF current_fling_velocity_; | 468 gfx::Vector2dF current_fling_velocity_; |
468 | 469 |
469 bool pinch_gesture_active_; | 470 bool pinch_gesture_active_; |
470 gfx::Point previous_pinch_anchor_; | 471 gfx::Point previous_pinch_anchor_; |
471 | 472 |
472 // This is set by AnimateLayers() and used by UpdateAnimationState() | 473 // This is set by AnimateLayers() and used by UpdateAnimationState() |
(...skipping 13 matching lines...) Expand all Loading... |
486 scoped_ptr<DebugRectHistory> debug_rect_history_; | 487 scoped_ptr<DebugRectHistory> debug_rect_history_; |
487 | 488 |
488 // The maximum memory that would be used by the prioritized resource | 489 // The maximum memory that would be used by the prioritized resource |
489 // manager, if there were no limit on memory usage. | 490 // manager, if there were no limit on memory usage. |
490 size_t max_memory_needed_bytes_; | 491 size_t max_memory_needed_bytes_; |
491 | 492 |
492 size_t last_sent_memory_visible_bytes_; | 493 size_t last_sent_memory_visible_bytes_; |
493 size_t last_sent_memory_visible_and_nearby_bytes_; | 494 size_t last_sent_memory_visible_and_nearby_bytes_; |
494 size_t last_sent_memory_use_bytes_; | 495 size_t last_sent_memory_use_bytes_; |
495 | 496 |
| 497 // Viewport size passed in from the main thread, in physical pixels. |
| 498 gfx::Size device_viewport_size_; |
| 499 |
| 500 // Conversion factor from CSS pixels to physical pixels when |
| 501 // pageScaleFactor=1. |
| 502 float device_scale_factor_; |
| 503 |
| 504 // Vertical amount of the viewport size that's known to covered by a |
| 505 // browser-side UI element, such as an on-screen-keyboard. This affects |
| 506 // scrollable size since we want to still be able to scroll to the bottom of |
| 507 // the page when the keyboard is up. |
| 508 float overdraw_bottom_height_; |
| 509 |
| 510 // Optional top-level constraints that can be set by the OutputSurface. The |
| 511 // external_viewport_'s size takes precedence over device_viewport_size_ for |
| 512 // DrawQuad generation and Renderer; however, device_viewport_size_ is still |
| 513 // used for scrollable size. |
| 514 gfx::Transform external_transform_; |
| 515 gfx::Rect external_viewport_; |
| 516 |
496 gfx::Rect viewport_damage_rect_; | 517 gfx::Rect viewport_damage_rect_; |
497 | 518 |
498 base::TimeTicks current_frame_timeticks_; | 519 base::TimeTicks current_frame_timeticks_; |
499 base::Time current_frame_time_; | 520 base::Time current_frame_time_; |
500 | 521 |
501 scoped_ptr<AnimationRegistrar> animation_registrar_; | 522 scoped_ptr<AnimationRegistrar> animation_registrar_; |
502 | 523 |
503 RenderingStatsInstrumentation* rendering_stats_instrumentation_; | 524 RenderingStatsInstrumentation* rendering_stats_instrumentation_; |
504 | 525 |
505 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); | 526 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); |
506 }; | 527 }; |
507 | 528 |
508 } // namespace cc | 529 } // namespace cc |
509 | 530 |
510 #endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_ | 531 #endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_ |
OLD | NEW |