| Index: cc/trees/layer_tree_impl.h
|
| diff --git a/cc/trees/layer_tree_impl.h b/cc/trees/layer_tree_impl.h
|
| index 27faef70bfb58beb9279927f1d6bc3014242db87..9f3418bc9e43d8b7c3c1c14b34af29e18b167840 100644
|
| --- a/cc/trees/layer_tree_impl.h
|
| +++ b/cc/trees/layer_tree_impl.h
|
| @@ -54,6 +54,35 @@ typedef std::vector<UIResourceRequest> UIResourceRequestQueue;
|
| typedef SyncedProperty<AdditionGroup<float>> SyncedBrowserControls;
|
| typedef SyncedProperty<AdditionGroup<gfx::Vector2dF>> SyncedElasticOverscroll;
|
|
|
| +class LayerTreeLifecycle {
|
| + public:
|
| + enum LifecycleState {
|
| + kNotSyncing,
|
| +
|
| + // The following states are the steps performed when syncing properties to
|
| + // this tree (see: LayerTreeHost::FinishCommitOnImplThread or
|
| + // LayerTreeHostImpl::ActivateSyncTree).
|
| + kBeginningSync,
|
| + kSyncedPropertyTrees,
|
| + kSyncedLayerProperties,
|
| + kLastSyncState = kSyncedLayerProperties,
|
| +
|
| + // TODO(pdr): Add states to cover more than just the synchronization steps.
|
| + };
|
| +
|
| + void AdvanceTo(LifecycleState);
|
| +
|
| + bool AllowsPropertyTreeAccess() const {
|
| + return state_ == kNotSyncing || state_ >= kSyncedPropertyTrees;
|
| + }
|
| + bool AllowsLayerPropertyAccess() const {
|
| + return state_ == kNotSyncing || state_ >= kSyncedLayerProperties;
|
| + }
|
| +
|
| + private:
|
| + LifecycleState state_ = kNotSyncing;
|
| +};
|
| +
|
| class CC_EXPORT LayerTreeImpl {
|
| public:
|
| // This is the number of times a fixed point has to be hit continuously by a
|
| @@ -130,8 +159,14 @@ class CC_EXPORT LayerTreeImpl {
|
| std::unique_ptr<OwnedLayerImplList> DetachLayers();
|
|
|
| void SetPropertyTrees(PropertyTrees* property_trees);
|
| - PropertyTrees* property_trees() { return &property_trees_; }
|
| + PropertyTrees* property_trees() {
|
| + // TODO(pdr): We should enable this DCHECK because it will catch uses of
|
| + // stale property trees, but it currently fails too many existing tests.
|
| + // DCHECK(lifecycle().AllowsPropertyTreeAccess());
|
| + return &property_trees_;
|
| + }
|
|
|
| + void PushPropertyTreesTo(LayerTreeImpl* tree_impl);
|
| void PushPropertiesTo(LayerTreeImpl* tree_impl);
|
|
|
| void MoveChangeTrackingToLayers();
|
| @@ -186,9 +221,6 @@ class CC_EXPORT LayerTreeImpl {
|
| int inner_viewport_scroll_layer_id,
|
| int outer_viewport_scroll_layer_id);
|
| void ClearViewportLayers();
|
| - // Sets the viewport layer types. This depends on the viewport layers from
|
| - // SetViewportLayersFromIds and the viewport layer's scroll_clip_layer_ids.
|
| - void UpdateViewportLayerTypes();
|
| LayerImpl* OverscrollElasticityLayer() {
|
| return LayerById(overscroll_elasticity_layer_id_);
|
| }
|
| @@ -467,6 +499,8 @@ class CC_EXPORT LayerTreeImpl {
|
|
|
| void InvalidateRegionForImages(const ImageIdFlatSet& images_to_invalidate);
|
|
|
| + LayerTreeLifecycle& lifecycle() { return lifecycle_; }
|
| +
|
| protected:
|
| float ClampPageScaleFactorToLimits(float page_scale_factor) const;
|
| void PushPageScaleFactorAndLimits(const float* page_scale_factor,
|
| @@ -581,6 +615,10 @@ class CC_EXPORT LayerTreeImpl {
|
|
|
| std::unique_ptr<PendingPageScaleAnimation> pending_page_scale_animation_;
|
|
|
| + // Tracks the lifecycle which is used for enforcing dependencies between
|
| + // lifecycle states. See: |LayerTreeLifecycle|.
|
| + LayerTreeLifecycle lifecycle_;
|
| +
|
| private:
|
| DISALLOW_COPY_AND_ASSIGN(LayerTreeImpl);
|
| };
|
|
|