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

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

Issue 22926024: cc: Control activation from the Scheduler (Closed) Base URL: http://git.chromium.org/chromium/src.git@schedOutputSurface4
Patch Set: git cl format Created 7 years, 3 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
« no previous file with comments | « cc/test/layer_tree_test.cc ('k') | cc/trees/layer_tree_host_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 177
178 const LayerTreeSettings& settings() const { return settings_; } 178 const LayerTreeSettings& settings() const { return settings_; }
179 179
180 // Returns the currently visible viewport size in DIP. This value excludes 180 // Returns the currently visible viewport size in DIP. This value excludes
181 // the URL bar and non-overlay scrollbars. 181 // the URL bar and non-overlay scrollbars.
182 gfx::SizeF VisibleViewportSize() const; 182 gfx::SizeF VisibleViewportSize() const;
183 183
184 // Evict all textures by enforcing a memory policy with an allocation of 0. 184 // Evict all textures by enforcing a memory policy with an allocation of 0.
185 void EvictTexturesForTesting(); 185 void EvictTexturesForTesting();
186 186
187 // When blocking, this prevents client_->NotifyReadyToActivate() from being
188 // called. When disabled, it calls client_->NotifyReadyToActivate()
189 // immediately if any notifications had been blocked while blocking.
190 virtual void BlockNotifyReadyToActivateForTesting(bool block);
191
187 // RendererClient implementation 192 // RendererClient implementation
188 virtual gfx::Rect DeviceViewport() const OVERRIDE; 193 virtual gfx::Rect DeviceViewport() const OVERRIDE;
189 private: 194 private:
190 virtual float DeviceScaleFactor() const OVERRIDE; 195 virtual float DeviceScaleFactor() const OVERRIDE;
191 virtual const LayerTreeSettings& Settings() const OVERRIDE; 196 virtual const LayerTreeSettings& Settings() const OVERRIDE;
192 public: 197 public:
193 virtual void SetFullRootLayerDamage() OVERRIDE; 198 virtual void SetFullRootLayerDamage() OVERRIDE;
194 virtual bool HasImplThread() const OVERRIDE; 199 virtual bool HasImplThread() const OVERRIDE;
195 virtual bool ShouldClearRootRenderPass() const OVERRIDE; 200 virtual bool ShouldClearRootRenderPass() const OVERRIDE;
196 virtual CompositorFrameMetadata MakeCompositorFrameMetadata() const OVERRIDE; 201 virtual CompositorFrameMetadata MakeCompositorFrameMetadata() const OVERRIDE;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 245
241 void Readback(void* pixels, gfx::Rect rect_in_device_viewport); 246 void Readback(void* pixels, gfx::Rect rect_in_device_viewport);
242 247
243 LayerTreeImpl* active_tree() { return active_tree_.get(); } 248 LayerTreeImpl* active_tree() { return active_tree_.get(); }
244 const LayerTreeImpl* active_tree() const { return active_tree_.get(); } 249 const LayerTreeImpl* active_tree() const { return active_tree_.get(); }
245 LayerTreeImpl* pending_tree() { return pending_tree_.get(); } 250 LayerTreeImpl* pending_tree() { return pending_tree_.get(); }
246 const LayerTreeImpl* pending_tree() const { return pending_tree_.get(); } 251 const LayerTreeImpl* pending_tree() const { return pending_tree_.get(); }
247 const LayerTreeImpl* recycle_tree() const { return recycle_tree_.get(); } 252 const LayerTreeImpl* recycle_tree() const { return recycle_tree_.get(); }
248 virtual void CreatePendingTree(); 253 virtual void CreatePendingTree();
249 void UpdateVisibleTiles(); 254 void UpdateVisibleTiles();
250 virtual void ActivatePendingTreeIfNeeded(); 255 virtual void ActivatePendingTree();
251 256
252 // Shortcuts to layers on the active tree. 257 // Shortcuts to layers on the active tree.
253 LayerImpl* RootLayer() const; 258 LayerImpl* RootLayer() const;
254 LayerImpl* RootScrollLayer() const; 259 LayerImpl* RootScrollLayer() const;
255 LayerImpl* CurrentlyScrollingLayer() const; 260 LayerImpl* CurrentlyScrollingLayer() const;
256 261
257 virtual void SetVisible(bool visible); 262 virtual void SetVisible(bool visible);
258 bool visible() const { return visible_; } 263 bool visible() const { return visible_; }
259 264
260 void SetNeedsCommit() { client_->SetNeedsCommitOnImplThread(); } 265 void SetNeedsCommit() { client_->SetNeedsCommitOnImplThread(); }
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 void DeleteUIResource(UIResourceId uid); 389 void DeleteUIResource(UIResourceId uid);
385 390
386 ResourceProvider::ResourceId ResourceIdForUIResource(UIResourceId uid) const; 391 ResourceProvider::ResourceId ResourceIdForUIResource(UIResourceId uid) const;
387 392
388 protected: 393 protected:
389 LayerTreeHostImpl( 394 LayerTreeHostImpl(
390 const LayerTreeSettings& settings, 395 const LayerTreeSettings& settings,
391 LayerTreeHostImplClient* client, 396 LayerTreeHostImplClient* client,
392 Proxy* proxy, 397 Proxy* proxy,
393 RenderingStatsInstrumentation* rendering_stats_instrumentation); 398 RenderingStatsInstrumentation* rendering_stats_instrumentation);
394 virtual void ActivatePendingTree();
395 399
396 // Virtual for testing. 400 // Virtual for testing.
397 virtual void AnimateLayers(base::TimeTicks monotonic_time, 401 virtual void AnimateLayers(base::TimeTicks monotonic_time,
398 base::Time wall_clock_time); 402 base::Time wall_clock_time);
399 403
400 // Virtual for testing. 404 // Virtual for testing.
401 virtual base::TimeDelta LowFrequencyAnimationInterval() const; 405 virtual base::TimeDelta LowFrequencyAnimationInterval() const;
402 406
403 const AnimationRegistrar::AnimationControllerMap& 407 const AnimationRegistrar::AnimationControllerMap&
404 active_animation_controllers() const { 408 active_animation_controllers() const {
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 // |resource_provider_| and |tile_manager_| can be NULL, e.g. when using tile- 468 // |resource_provider_| and |tile_manager_| can be NULL, e.g. when using tile-
465 // free rendering - see OutputSurface::ForcedDrawToSoftwareDevice(). 469 // free rendering - see OutputSurface::ForcedDrawToSoftwareDevice().
466 scoped_ptr<ResourceProvider> resource_provider_; 470 scoped_ptr<ResourceProvider> resource_provider_;
467 scoped_ptr<TileManager> tile_manager_; 471 scoped_ptr<TileManager> tile_manager_;
468 scoped_ptr<Renderer> renderer_; 472 scoped_ptr<Renderer> renderer_;
469 473
470 // Tree currently being drawn. 474 // Tree currently being drawn.
471 scoped_ptr<LayerTreeImpl> active_tree_; 475 scoped_ptr<LayerTreeImpl> active_tree_;
472 476
473 // In impl-side painting mode, tree with possibly incomplete rasterized 477 // In impl-side painting mode, tree with possibly incomplete rasterized
474 // content. May be promoted to active by ActivatePendingTreeIfNeeded(). 478 // content. May be promoted to active by ActivatePendingTree().
475 scoped_ptr<LayerTreeImpl> pending_tree_; 479 scoped_ptr<LayerTreeImpl> pending_tree_;
476 480
477 // In impl-side painting mode, inert tree with layers that can be recycled 481 // In impl-side painting mode, inert tree with layers that can be recycled
478 // by the next sync from the main thread. 482 // by the next sync from the main thread.
479 scoped_ptr<LayerTreeImpl> recycle_tree_; 483 scoped_ptr<LayerTreeImpl> recycle_tree_;
480 484
481 InputHandlerClient* input_handler_client_; 485 InputHandlerClient* input_handler_client_;
482 bool did_lock_scrolling_layer_; 486 bool did_lock_scrolling_layer_;
483 bool should_bubble_scrolls_; 487 bool should_bubble_scrolls_;
484 bool wheel_scrolling_; 488 bool wheel_scrolling_;
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
557 561
558 // Optional callback to notify of new tree activations. 562 // Optional callback to notify of new tree activations.
559 base::Closure tree_activation_callback_; 563 base::Closure tree_activation_callback_;
560 564
561 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); 565 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl);
562 }; 566 };
563 567
564 } // namespace cc 568 } // namespace cc
565 569
566 #endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_ 570 #endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_
OLDNEW
« no previous file with comments | « cc/test/layer_tree_test.cc ('k') | cc/trees/layer_tree_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698