Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(53)

Side by Side Diff: cc/trees/layer_tree_host_impl.h

Issue 16871016: cc: Use BeginFrameArgs (Closed) Base URL: http://git.chromium.org/chromium/src.git@bfargs2
Patch Set: rebase Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 NotifyReadyToActivate() = 0;
64 virtual void OnHasPendingTreeStateChanged(bool has_pending_tree) = 0; 65 virtual void OnHasPendingTreeStateChanged(bool has_pending_tree) = 0;
65 virtual void SetNeedsRedrawOnImplThread() = 0; 66 virtual void SetNeedsRedrawOnImplThread() = 0;
66 virtual void SetNeedsRedrawRectOnImplThread(gfx::Rect damage_rect) = 0; 67 virtual void SetNeedsRedrawRectOnImplThread(gfx::Rect damage_rect) = 0;
67 virtual void DidInitializeVisibleTileOnImplThread() = 0; 68 virtual void DidInitializeVisibleTileOnImplThread() = 0;
68 virtual void SetNeedsCommitOnImplThread() = 0; 69 virtual void SetNeedsCommitOnImplThread() = 0;
69 virtual void PostAnimationEventsToMainThreadOnImplThread( 70 virtual void PostAnimationEventsToMainThreadOnImplThread(
70 scoped_ptr<AnimationEventsVector> events, 71 scoped_ptr<AnimationEventsVector> events,
71 base::Time wall_clock_time) = 0; 72 base::Time wall_clock_time) = 0;
72 // Returns true if resources were deleted by this call. 73 // Returns true if resources were deleted by this call.
73 virtual bool ReduceContentsTextureMemoryOnImplThread( 74 virtual bool ReduceContentsTextureMemoryOnImplThread(
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 156
156 virtual void BeginCommit(); 157 virtual void BeginCommit();
157 virtual void CommitComplete(); 158 virtual void CommitComplete();
158 virtual void Animate(base::TimeTicks monotonic_time, 159 virtual void Animate(base::TimeTicks monotonic_time,
159 base::Time wall_clock_time); 160 base::Time wall_clock_time);
160 virtual void UpdateAnimationState(bool start_ready_animations); 161 virtual void UpdateAnimationState(bool start_ready_animations);
161 void MainThreadHasStoppedFlinging(); 162 void MainThreadHasStoppedFlinging();
162 void UpdateBackgroundAnimateTicking(bool should_background_tick); 163 void UpdateBackgroundAnimateTicking(bool should_background_tick);
163 void SetViewportDamage(gfx::Rect damage_rect); 164 void SetViewportDamage(gfx::Rect damage_rect);
164 165
165 void ManageTiles(); 166 // Returns false if ManageTiles was not necessary and the pending tree
167 // can be activated.
168 bool ManageTiles();
166 169
167 // Returns false if problems occured preparing the frame, and we should try 170 // Returns false if problems occured preparing the frame, and we should try
168 // to avoid displaying the frame. If PrepareToDraw is called, DidDrawAllLayers 171 // to avoid displaying the frame. If PrepareToDraw is called, DidDrawAllLayers
169 // must also be called, regardless of whether DrawLayers is called between the 172 // must also be called, regardless of whether DrawLayers is called between the
170 // two. 173 // two.
171 virtual bool PrepareToDraw(FrameData* frame, 174 virtual bool PrepareToDraw(FrameData* frame,
172 gfx::Rect device_viewport_damage_rect); 175 gfx::Rect device_viewport_damage_rect);
173 virtual void DrawLayers(FrameData* frame, base::TimeTicks frame_begin_time); 176 virtual void DrawLayers(FrameData* frame, base::TimeTicks frame_begin_time);
174 // Must be called if and only if PrepareToDraw was called. 177 // Must be called if and only if PrepareToDraw was called.
175 void DidDrawAllLayers(const FrameData& frame); 178 void DidDrawAllLayers(const FrameData& frame);
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 void Readback(void* pixels, gfx::Rect rect_in_device_viewport); 243 void Readback(void* pixels, gfx::Rect rect_in_device_viewport);
241 244
242 LayerTreeImpl* active_tree() { return active_tree_.get(); } 245 LayerTreeImpl* active_tree() { return active_tree_.get(); }
243 const LayerTreeImpl* active_tree() const { return active_tree_.get(); } 246 const LayerTreeImpl* active_tree() const { return active_tree_.get(); }
244 LayerTreeImpl* pending_tree() { return pending_tree_.get(); } 247 LayerTreeImpl* pending_tree() { return pending_tree_.get(); }
245 const LayerTreeImpl* pending_tree() const { return pending_tree_.get(); } 248 const LayerTreeImpl* pending_tree() const { return pending_tree_.get(); }
246 const LayerTreeImpl* recycle_tree() const { return recycle_tree_.get(); } 249 const LayerTreeImpl* recycle_tree() const { return recycle_tree_.get(); }
247 virtual void CreatePendingTree(); 250 virtual void CreatePendingTree();
248 void UpdateVisibleTiles(); 251 void UpdateVisibleTiles();
249 virtual void ActivatePendingTreeIfNeeded(); 252 virtual void ActivatePendingTreeIfNeeded();
253 virtual void ActivatePendingTree();
250 254
251 // Shortcuts to layers on the active tree. 255 // Shortcuts to layers on the active tree.
252 LayerImpl* RootLayer() const; 256 LayerImpl* RootLayer() const;
253 LayerImpl* RootScrollLayer() const; 257 LayerImpl* RootScrollLayer() const;
254 LayerImpl* CurrentlyScrollingLayer() const; 258 LayerImpl* CurrentlyScrollingLayer() const;
255 259
256 virtual void SetVisible(bool visible); 260 virtual void SetVisible(bool visible);
257 bool visible() const { return visible_; } 261 bool visible() const { return visible_; }
258 262
259 void SetNeedsCommit() { client_->SetNeedsCommitOnImplThread(); } 263 void SetNeedsCommit() { client_->SetNeedsCommitOnImplThread(); }
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 void DeleteUIResource(UIResourceId uid); 386 void DeleteUIResource(UIResourceId uid);
383 387
384 ResourceProvider::ResourceId ResourceIdForUIResource(UIResourceId uid) const; 388 ResourceProvider::ResourceId ResourceIdForUIResource(UIResourceId uid) const;
385 389
386 protected: 390 protected:
387 LayerTreeHostImpl( 391 LayerTreeHostImpl(
388 const LayerTreeSettings& settings, 392 const LayerTreeSettings& settings,
389 LayerTreeHostImplClient* client, 393 LayerTreeHostImplClient* client,
390 Proxy* proxy, 394 Proxy* proxy,
391 RenderingStatsInstrumentation* rendering_stats_instrumentation); 395 RenderingStatsInstrumentation* rendering_stats_instrumentation);
392 virtual void ActivatePendingTree();
393 396
394 // Virtual for testing. 397 // Virtual for testing.
395 virtual void AnimateLayers(base::TimeTicks monotonic_time, 398 virtual void AnimateLayers(base::TimeTicks monotonic_time,
396 base::Time wall_clock_time); 399 base::Time wall_clock_time);
397 400
398 // Virtual for testing. 401 // Virtual for testing.
399 virtual base::TimeDelta LowFrequencyAnimationInterval() const; 402 virtual base::TimeDelta LowFrequencyAnimationInterval() const;
400 403
401 const AnimationRegistrar::AnimationControllerMap& 404 const AnimationRegistrar::AnimationControllerMap&
402 active_animation_controllers() const { 405 active_animation_controllers() const {
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 bool zero_budget); 454 bool zero_budget);
452 void EnforceManagedMemoryPolicy(const ManagedMemoryPolicy& policy); 455 void EnforceManagedMemoryPolicy(const ManagedMemoryPolicy& policy);
453 456
454 void DidInitializeVisibleTile(); 457 void DidInitializeVisibleTile();
455 458
456 typedef base::hash_map<UIResourceId, ResourceProvider::ResourceId> 459 typedef base::hash_map<UIResourceId, ResourceProvider::ResourceId>
457 UIResourceMap; 460 UIResourceMap;
458 UIResourceMap ui_resource_map_; 461 UIResourceMap ui_resource_map_;
459 462
460 scoped_ptr<OutputSurface> output_surface_; 463 scoped_ptr<OutputSurface> output_surface_;
464 bool output_surface_lost_;
461 465
462 // |resource_provider_| and |tile_manager_| can be NULL, e.g. when using tile- 466 // |resource_provider_| and |tile_manager_| can be NULL, e.g. when using tile-
463 // free rendering - see OutputSurface::ForcedDrawToSoftwareDevice(). 467 // free rendering - see OutputSurface::ForcedDrawToSoftwareDevice().
464 scoped_ptr<ResourceProvider> resource_provider_; 468 scoped_ptr<ResourceProvider> resource_provider_;
465 scoped_ptr<TileManager> tile_manager_; 469 scoped_ptr<TileManager> tile_manager_;
466 scoped_ptr<Renderer> renderer_; 470 scoped_ptr<Renderer> renderer_;
467 471
468 // Tree currently being drawn. 472 // Tree currently being drawn.
469 scoped_ptr<LayerTreeImpl> active_tree_; 473 scoped_ptr<LayerTreeImpl> active_tree_;
470 474
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 559
556 // Optional callback to notify of new tree activations. 560 // Optional callback to notify of new tree activations.
557 base::Closure tree_activation_callback_; 561 base::Closure tree_activation_callback_;
558 562
559 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); 563 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl);
560 }; 564 };
561 565
562 } // namespace cc 566 } // namespace cc
563 567
564 #endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_ 568 #endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698