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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 // LayerTreeHost->Proxy callback interface. | 54 // LayerTreeHost->Proxy callback interface. |
55 class LayerTreeHostImplClient { | 55 class LayerTreeHostImplClient { |
56 public: | 56 public: |
57 virtual void DidTryInitializeRendererOnImplThread( | 57 virtual void DidTryInitializeRendererOnImplThread( |
58 bool success, | 58 bool success, |
59 scoped_refptr<ContextProvider> offscreen_context_provider) = 0; | 59 scoped_refptr<ContextProvider> offscreen_context_provider) = 0; |
60 virtual void DidLoseOutputSurfaceOnImplThread() = 0; | 60 virtual void DidLoseOutputSurfaceOnImplThread() = 0; |
61 virtual void OnSwapBuffersCompleteOnImplThread() = 0; | 61 virtual void OnSwapBuffersCompleteOnImplThread() = 0; |
62 virtual void BeginFrameOnImplThread(const BeginFrameArgs& args) = 0; | 62 virtual void BeginFrameOnImplThread(const BeginFrameArgs& args) = 0; |
63 virtual void OnCanDrawStateChanged(bool can_draw) = 0; | 63 virtual void OnCanDrawStateChanged(bool can_draw) = 0; |
64 virtual void OnHasPendingTreeStateChanged(bool has_pending_tree) = 0; | 64 virtual void NotifyReadyToActivate() = 0; |
65 virtual void SetNeedsRedrawOnImplThread() = 0; | 65 virtual void SetNeedsRedrawOnImplThread() = 0; |
66 virtual void SetNeedsRedrawRectOnImplThread(gfx::Rect damage_rect) = 0; | 66 virtual void SetNeedsRedrawRectOnImplThread(gfx::Rect damage_rect) = 0; |
67 virtual void DidInitializeVisibleTileOnImplThread() = 0; | 67 virtual void DidInitializeVisibleTileOnImplThread() = 0; |
68 virtual void SetNeedsCommitOnImplThread() = 0; | 68 virtual void SetNeedsCommitOnImplThread() = 0; |
69 virtual void PostAnimationEventsToMainThreadOnImplThread( | 69 virtual void PostAnimationEventsToMainThreadOnImplThread( |
70 scoped_ptr<AnimationEventsVector> events, | 70 scoped_ptr<AnimationEventsVector> events, |
71 base::Time wall_clock_time) = 0; | 71 base::Time wall_clock_time) = 0; |
72 // Returns true if resources were deleted by this call. | 72 // Returns true if resources were deleted by this call. |
73 virtual bool ReduceContentsTextureMemoryOnImplThread( | 73 virtual bool ReduceContentsTextureMemoryOnImplThread( |
74 size_t limit_bytes, | 74 size_t limit_bytes, |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 | 240 |
241 void Readback(void* pixels, gfx::Rect rect_in_device_viewport); | 241 void Readback(void* pixels, gfx::Rect rect_in_device_viewport); |
242 | 242 |
243 LayerTreeImpl* active_tree() { return active_tree_.get(); } | 243 LayerTreeImpl* active_tree() { return active_tree_.get(); } |
244 const LayerTreeImpl* active_tree() const { return active_tree_.get(); } | 244 const LayerTreeImpl* active_tree() const { return active_tree_.get(); } |
245 LayerTreeImpl* pending_tree() { return pending_tree_.get(); } | 245 LayerTreeImpl* pending_tree() { return pending_tree_.get(); } |
246 const LayerTreeImpl* pending_tree() const { return pending_tree_.get(); } | 246 const LayerTreeImpl* pending_tree() const { return pending_tree_.get(); } |
247 const LayerTreeImpl* recycle_tree() const { return recycle_tree_.get(); } | 247 const LayerTreeImpl* recycle_tree() const { return recycle_tree_.get(); } |
248 virtual void CreatePendingTree(); | 248 virtual void CreatePendingTree(); |
249 void UpdateVisibleTiles(); | 249 void UpdateVisibleTiles(); |
250 virtual void ActivatePendingTreeIfNeeded(); | 250 virtual void ActivatePendingTree(); |
251 | 251 |
252 // Shortcuts to layers on the active tree. | 252 // Shortcuts to layers on the active tree. |
253 LayerImpl* RootLayer() const; | 253 LayerImpl* RootLayer() const; |
254 LayerImpl* RootScrollLayer() const; | 254 LayerImpl* RootScrollLayer() const; |
255 LayerImpl* CurrentlyScrollingLayer() const; | 255 LayerImpl* CurrentlyScrollingLayer() const; |
256 | 256 |
257 virtual void SetVisible(bool visible); | 257 virtual void SetVisible(bool visible); |
258 bool visible() const { return visible_; } | 258 bool visible() const { return visible_; } |
259 | 259 |
260 void SetNeedsCommit() { client_->SetNeedsCommitOnImplThread(); } | 260 void SetNeedsCommit() { client_->SetNeedsCommitOnImplThread(); } |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 void DeleteUIResource(UIResourceId uid); | 384 void DeleteUIResource(UIResourceId uid); |
385 | 385 |
386 ResourceProvider::ResourceId ResourceIdForUIResource(UIResourceId uid) const; | 386 ResourceProvider::ResourceId ResourceIdForUIResource(UIResourceId uid) const; |
387 | 387 |
388 protected: | 388 protected: |
389 LayerTreeHostImpl( | 389 LayerTreeHostImpl( |
390 const LayerTreeSettings& settings, | 390 const LayerTreeSettings& settings, |
391 LayerTreeHostImplClient* client, | 391 LayerTreeHostImplClient* client, |
392 Proxy* proxy, | 392 Proxy* proxy, |
393 RenderingStatsInstrumentation* rendering_stats_instrumentation); | 393 RenderingStatsInstrumentation* rendering_stats_instrumentation); |
394 virtual void ActivatePendingTree(); | |
395 | 394 |
396 // Virtual for testing. | 395 // Virtual for testing. |
397 virtual void AnimateLayers(base::TimeTicks monotonic_time, | 396 virtual void AnimateLayers(base::TimeTicks monotonic_time, |
398 base::Time wall_clock_time); | 397 base::Time wall_clock_time); |
399 | 398 |
400 // Virtual for testing. | 399 // Virtual for testing. |
401 virtual base::TimeDelta LowFrequencyAnimationInterval() const; | 400 virtual base::TimeDelta LowFrequencyAnimationInterval() const; |
402 | 401 |
403 const AnimationRegistrar::AnimationControllerMap& | 402 const AnimationRegistrar::AnimationControllerMap& |
404 active_animation_controllers() const { | 403 active_animation_controllers() const { |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
464 // |resource_provider_| and |tile_manager_| can be NULL, e.g. when using tile- | 463 // |resource_provider_| and |tile_manager_| can be NULL, e.g. when using tile- |
465 // free rendering - see OutputSurface::ForcedDrawToSoftwareDevice(). | 464 // free rendering - see OutputSurface::ForcedDrawToSoftwareDevice(). |
466 scoped_ptr<ResourceProvider> resource_provider_; | 465 scoped_ptr<ResourceProvider> resource_provider_; |
467 scoped_ptr<TileManager> tile_manager_; | 466 scoped_ptr<TileManager> tile_manager_; |
468 scoped_ptr<Renderer> renderer_; | 467 scoped_ptr<Renderer> renderer_; |
469 | 468 |
470 // Tree currently being drawn. | 469 // Tree currently being drawn. |
471 scoped_ptr<LayerTreeImpl> active_tree_; | 470 scoped_ptr<LayerTreeImpl> active_tree_; |
472 | 471 |
473 // In impl-side painting mode, tree with possibly incomplete rasterized | 472 // In impl-side painting mode, tree with possibly incomplete rasterized |
474 // content. May be promoted to active by ActivatePendingTreeIfNeeded(). | 473 // content. May be promoted to active by ActivatePendingTree(). |
475 scoped_ptr<LayerTreeImpl> pending_tree_; | 474 scoped_ptr<LayerTreeImpl> pending_tree_; |
476 | 475 |
477 // In impl-side painting mode, inert tree with layers that can be recycled | 476 // In impl-side painting mode, inert tree with layers that can be recycled |
478 // by the next sync from the main thread. | 477 // by the next sync from the main thread. |
479 scoped_ptr<LayerTreeImpl> recycle_tree_; | 478 scoped_ptr<LayerTreeImpl> recycle_tree_; |
480 | 479 |
481 InputHandlerClient* input_handler_client_; | 480 InputHandlerClient* input_handler_client_; |
482 bool did_lock_scrolling_layer_; | 481 bool did_lock_scrolling_layer_; |
483 bool should_bubble_scrolls_; | 482 bool should_bubble_scrolls_; |
484 bool wheel_scrolling_; | 483 bool wheel_scrolling_; |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
557 | 556 |
558 // Optional callback to notify of new tree activations. | 557 // Optional callback to notify of new tree activations. |
559 base::Closure tree_activation_callback_; | 558 base::Closure tree_activation_callback_; |
560 | 559 |
561 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); | 560 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); |
562 }; | 561 }; |
563 | 562 |
564 } // namespace cc | 563 } // namespace cc |
565 | 564 |
566 #endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_ | 565 #endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_ |
OLD | NEW |