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