Chromium Code Reviews| 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 <list> | 8 #include <list> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 169 virtual bool PrepareToDraw(FrameData* frame, | 169 virtual bool PrepareToDraw(FrameData* frame, |
| 170 gfx::Rect device_viewport_damage_rect); | 170 gfx::Rect device_viewport_damage_rect); |
| 171 virtual void DrawLayers(FrameData* frame, base::TimeTicks frame_begin_time); | 171 virtual void DrawLayers(FrameData* frame, base::TimeTicks frame_begin_time); |
| 172 // Must be called if and only if PrepareToDraw was called. | 172 // Must be called if and only if PrepareToDraw was called. |
| 173 void DidDrawAllLayers(const FrameData& frame); | 173 void DidDrawAllLayers(const FrameData& frame); |
| 174 | 174 |
| 175 const LayerTreeSettings& settings() const { return settings_; } | 175 const LayerTreeSettings& settings() const { return settings_; } |
| 176 | 176 |
| 177 // Returns the currently visible viewport size in DIP. This value excludes | 177 // Returns the currently visible viewport size in DIP. This value excludes |
| 178 // the URL bar and non-overlay scrollbars. | 178 // the URL bar and non-overlay scrollbars. |
| 179 gfx::SizeF VisibleViewportSize() const; | 179 gfx::SizeF UnscaledScrollableViewportSize() const; |
| 180 | 180 |
| 181 // Evict all textures by enforcing a memory policy with an allocation of 0. | 181 // Evict all textures by enforcing a memory policy with an allocation of 0. |
| 182 void EvictTexturesForTesting(); | 182 void EvictTexturesForTesting(); |
| 183 | 183 |
| 184 // When blocking, this prevents client_->NotifyReadyToActivate() from being | 184 // When blocking, this prevents client_->NotifyReadyToActivate() from being |
| 185 // called. When disabled, it calls client_->NotifyReadyToActivate() | 185 // called. When disabled, it calls client_->NotifyReadyToActivate() |
| 186 // immediately if any notifications had been blocked while blocking. | 186 // immediately if any notifications had been blocked while blocking. |
| 187 virtual void BlockNotifyReadyToActivateForTesting(bool block); | 187 virtual void BlockNotifyReadyToActivateForTesting(bool block); |
| 188 | 188 |
| 189 bool device_viewport_valid_for_tile_management() const { | |
| 190 return device_viewport_valid_for_tile_management_; | |
| 191 } | |
| 192 | |
| 189 // RendererClient implementation | 193 // RendererClient implementation |
| 190 virtual gfx::Rect DeviceViewport() const OVERRIDE; | 194 virtual gfx::Rect DeviceViewport() const OVERRIDE; |
| 195 virtual gfx::Rect DeviceClip() const OVERRIDE; | |
| 191 private: | 196 private: |
| 192 virtual float DeviceScaleFactor() const OVERRIDE; | 197 virtual float DeviceScaleFactor() const OVERRIDE; |
| 193 virtual const LayerTreeSettings& Settings() const OVERRIDE; | 198 virtual const LayerTreeSettings& Settings() const OVERRIDE; |
| 194 public: | 199 public: |
| 195 virtual void SetFullRootLayerDamage() OVERRIDE; | 200 virtual void SetFullRootLayerDamage() OVERRIDE; |
| 196 virtual bool HasImplThread() const OVERRIDE; | 201 virtual bool HasImplThread() const OVERRIDE; |
| 197 virtual bool ShouldClearRootRenderPass() const OVERRIDE; | 202 virtual bool ShouldClearRootRenderPass() const OVERRIDE; |
| 198 virtual CompositorFrameMetadata MakeCompositorFrameMetadata() const OVERRIDE; | 203 virtual CompositorFrameMetadata MakeCompositorFrameMetadata() const OVERRIDE; |
| 199 virtual bool AllowPartialSwap() const OVERRIDE; | 204 virtual bool AllowPartialSwap() const OVERRIDE; |
| 200 virtual bool ExternalStencilTestEnabled() const OVERRIDE; | 205 virtual bool ExternalStencilTestEnabled() const OVERRIDE; |
| 201 | 206 |
| 202 // TileManagerClient implementation. | 207 // TileManagerClient implementation. |
| 203 virtual void NotifyReadyToActivate() OVERRIDE; | 208 virtual void NotifyReadyToActivate() OVERRIDE; |
| 204 | 209 |
| 205 // OutputSurfaceClient implementation. | 210 // OutputSurfaceClient implementation. |
| 206 virtual bool DeferredInitialize( | 211 virtual bool DeferredInitialize( |
| 207 scoped_refptr<ContextProvider> offscreen_context_provider) OVERRIDE; | 212 scoped_refptr<ContextProvider> offscreen_context_provider) OVERRIDE; |
| 208 virtual void ReleaseGL() OVERRIDE; | 213 virtual void ReleaseGL() OVERRIDE; |
| 209 virtual void SetNeedsRedrawRect(gfx::Rect rect) OVERRIDE; | 214 virtual void SetNeedsRedrawRect(gfx::Rect rect) OVERRIDE; |
| 210 virtual void BeginFrame(const BeginFrameArgs& args) OVERRIDE; | 215 virtual void BeginFrame(const BeginFrameArgs& args) OVERRIDE; |
| 211 virtual void SetExternalDrawConstraints(const gfx::Transform& transform, | 216 virtual void SetExternalDrawConstraints( |
| 212 gfx::Rect viewport) OVERRIDE; | 217 const gfx::Transform& transform, |
| 218 gfx::Rect viewport, | |
| 219 gfx::Rect clip, | |
| 220 bool valid_for_tile_management) OVERRIDE; | |
| 213 virtual void SetExternalStencilTest(bool enabled) OVERRIDE; | 221 virtual void SetExternalStencilTest(bool enabled) OVERRIDE; |
| 214 virtual void DidLoseOutputSurface() OVERRIDE; | 222 virtual void DidLoseOutputSurface() OVERRIDE; |
| 215 virtual void OnSwapBuffersComplete(const CompositorFrameAck* ack) OVERRIDE; | 223 virtual void OnSwapBuffersComplete(const CompositorFrameAck* ack) OVERRIDE; |
| 216 virtual void SetMemoryPolicy(const ManagedMemoryPolicy& policy) OVERRIDE; | 224 virtual void SetMemoryPolicy(const ManagedMemoryPolicy& policy) OVERRIDE; |
| 217 virtual void SetDiscardBackBufferWhenNotVisible(bool discard) OVERRIDE; | 225 virtual void SetDiscardBackBufferWhenNotVisible(bool discard) OVERRIDE; |
| 218 virtual void SetTreeActivationCallback(const base::Closure& callback) | 226 virtual void SetTreeActivationCallback(const base::Closure& callback) |
| 219 OVERRIDE; | 227 OVERRIDE; |
| 220 | 228 |
| 221 // Called from LayerTreeImpl. | 229 // Called from LayerTreeImpl. |
| 222 void OnCanDrawStateChangedForTree(); | 230 void OnCanDrawStateChangedForTree(); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 266 bool visible() const { return visible_; } | 274 bool visible() const { return visible_; } |
| 267 | 275 |
| 268 void SetNeedsCommit() { client_->SetNeedsCommitOnImplThread(); } | 276 void SetNeedsCommit() { client_->SetNeedsCommitOnImplThread(); } |
| 269 void SetNeedsRedraw() { client_->SetNeedsRedrawOnImplThread(); } | 277 void SetNeedsRedraw() { client_->SetNeedsRedrawOnImplThread(); } |
| 270 | 278 |
| 271 ManagedMemoryPolicy ActualManagedMemoryPolicy() const; | 279 ManagedMemoryPolicy ActualManagedMemoryPolicy() const; |
| 272 | 280 |
| 273 size_t memory_allocation_limit_bytes() const; | 281 size_t memory_allocation_limit_bytes() const; |
| 274 | 282 |
| 275 void SetViewportSize(gfx::Size device_viewport_size); | 283 void SetViewportSize(gfx::Size device_viewport_size); |
| 276 gfx::Size device_viewport_size() const { return device_viewport_size_; } | |
| 277 | 284 |
| 278 void SetOverdrawBottomHeight(float overdraw_bottom_height); | 285 void SetOverdrawBottomHeight(float overdraw_bottom_height); |
| 279 float overdraw_bottom_height() const { return overdraw_bottom_height_; } | 286 float overdraw_bottom_height() const { return overdraw_bottom_height_; } |
| 280 | 287 |
| 281 void SetDeviceScaleFactor(float device_scale_factor); | 288 void SetDeviceScaleFactor(float device_scale_factor); |
| 282 float device_scale_factor() const { return device_scale_factor_; } | 289 float device_scale_factor() const { return device_scale_factor_; } |
| 283 | 290 |
| 284 const gfx::Transform& DeviceTransform() const; | 291 const gfx::Transform& DeviceTransform() const; |
| 285 | 292 |
| 286 scoped_ptr<ScrollAndScaleSet> ProcessScrollDeltas(); | 293 scoped_ptr<ScrollAndScaleSet> ProcessScrollDeltas(); |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 405 base::Time wall_clock_time); | 412 base::Time wall_clock_time); |
| 406 | 413 |
| 407 // Virtual for testing. | 414 // Virtual for testing. |
| 408 virtual base::TimeDelta LowFrequencyAnimationInterval() const; | 415 virtual base::TimeDelta LowFrequencyAnimationInterval() const; |
| 409 | 416 |
| 410 const AnimationRegistrar::AnimationControllerMap& | 417 const AnimationRegistrar::AnimationControllerMap& |
| 411 active_animation_controllers() const { | 418 active_animation_controllers() const { |
| 412 return animation_registrar_->active_animation_controllers(); | 419 return animation_registrar_->active_animation_controllers(); |
| 413 } | 420 } |
| 414 | 421 |
| 422 bool manage_tiles_needed() const { return manage_tiles_needed_; } | |
| 423 | |
| 415 LayerTreeHostImplClient* client_; | 424 LayerTreeHostImplClient* client_; |
| 416 Proxy* proxy_; | 425 Proxy* proxy_; |
| 417 | 426 |
| 418 private: | 427 private: |
| 419 void CreateAndSetRenderer( | 428 void CreateAndSetRenderer( |
| 420 OutputSurface* output_surface, | 429 OutputSurface* output_surface, |
| 421 ResourceProvider* resource_provider, | 430 ResourceProvider* resource_provider, |
| 422 bool skip_gl_renderer); | 431 bool skip_gl_renderer); |
| 423 void CreateAndSetTileManager(ResourceProvider* resource_provider, | 432 void CreateAndSetTileManager(ResourceProvider* resource_provider, |
| 424 bool using_map_image); | 433 bool using_map_image); |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 526 // The maximum memory that would be used by the prioritized resource | 535 // The maximum memory that would be used by the prioritized resource |
| 527 // manager, if there were no limit on memory usage. | 536 // manager, if there were no limit on memory usage. |
| 528 size_t max_memory_needed_bytes_; | 537 size_t max_memory_needed_bytes_; |
| 529 | 538 |
| 530 size_t last_sent_memory_visible_bytes_; | 539 size_t last_sent_memory_visible_bytes_; |
| 531 size_t last_sent_memory_visible_and_nearby_bytes_; | 540 size_t last_sent_memory_visible_and_nearby_bytes_; |
| 532 size_t last_sent_memory_use_bytes_; | 541 size_t last_sent_memory_use_bytes_; |
| 533 bool zero_budget_; | 542 bool zero_budget_; |
| 534 | 543 |
| 535 // Viewport size passed in from the main thread, in physical pixels. | 544 // Viewport size passed in from the main thread, in physical pixels. |
| 536 gfx::Size device_viewport_size_; | 545 gfx::Size device_viewport_size_; |
|
aelias_OOO_until_Jul13
2013/09/03 19:52:09
Added a comment explaining the role of this better
| |
| 537 | 546 |
| 538 // Conversion factor from CSS pixels to physical pixels when | 547 // Conversion factor from CSS pixels to physical pixels when |
| 539 // pageScaleFactor=1. | 548 // pageScaleFactor=1. |
| 540 float device_scale_factor_; | 549 float device_scale_factor_; |
| 541 | 550 |
| 542 // Vertical amount of the viewport size that's known to covered by a | 551 // Vertical amount of the viewport size that's known to covered by a |
| 543 // browser-side UI element, such as an on-screen-keyboard. This affects | 552 // browser-side UI element, such as an on-screen-keyboard. This affects |
| 544 // scrollable size since we want to still be able to scroll to the bottom of | 553 // scrollable size since we want to still be able to scroll to the bottom of |
| 545 // the page when the keyboard is up. | 554 // the page when the keyboard is up. |
| 546 float overdraw_bottom_height_; | 555 float overdraw_bottom_height_; |
| 547 | 556 |
| 548 // Optional top-level constraints that can be set by the OutputSurface. The | 557 // Optional top-level constraints that can be set by the OutputSurface. |
| 549 // external_viewport_'s size takes precedence over device_viewport_size_ for | 558 // - external_transform_ applies a transform above the root layer |
| 550 // DrawQuad generation and Renderer; however, device_viewport_size_ is still | 559 // - external_viewport_ is used DrawProperties, tile management and |
| 551 // used for scrollable size. | 560 // glViewport/window projection matrix. |
| 561 // - external_clip_ specifies a top-level clip rect | |
| 562 // - external_stencil_test_enabled_ tells CC to respect existing stencil bits | |
| 563 // (When these are specified, device_viewport_size_ remains used only for | |
| 564 // scrollable size.) | |
| 552 gfx::Transform external_transform_; | 565 gfx::Transform external_transform_; |
| 553 gfx::Rect external_viewport_; | 566 gfx::Rect external_viewport_; |
| 567 gfx::Rect external_clip_; | |
| 568 bool device_viewport_valid_for_tile_management_; | |
| 554 bool external_stencil_test_enabled_; | 569 bool external_stencil_test_enabled_; |
| 555 | 570 |
| 556 gfx::Rect viewport_damage_rect_; | 571 gfx::Rect viewport_damage_rect_; |
| 557 | 572 |
| 558 base::TimeTicks current_frame_timeticks_; | 573 base::TimeTicks current_frame_timeticks_; |
| 559 base::Time current_frame_time_; | 574 base::Time current_frame_time_; |
| 560 | 575 |
| 561 scoped_ptr<AnimationRegistrar> animation_registrar_; | 576 scoped_ptr<AnimationRegistrar> animation_registrar_; |
| 562 | 577 |
| 563 RenderingStatsInstrumentation* rendering_stats_instrumentation_; | 578 RenderingStatsInstrumentation* rendering_stats_instrumentation_; |
| 564 | 579 |
| 565 bool need_to_update_visible_tiles_before_draw_; | 580 bool need_to_update_visible_tiles_before_draw_; |
| 566 | 581 |
| 567 // Optional callback to notify of new tree activations. | 582 // Optional callback to notify of new tree activations. |
| 568 base::Closure tree_activation_callback_; | 583 base::Closure tree_activation_callback_; |
| 569 | 584 |
| 570 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); | 585 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); |
| 571 }; | 586 }; |
| 572 | 587 |
| 573 } // namespace cc | 588 } // namespace cc |
| 574 | 589 |
| 575 #endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_ | 590 #endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_ |
| OLD | NEW |