Skip to content

Commit

Permalink
[Refactor] Add interface for input->LTHI
Browse files Browse the repository at this point in the history
This CL adds an interface for the InputHandler implementation to
communicate with the compositor. This CL is a start that mostly just
imposes an interface on the existing structure  of these objects. Future
CLs will continue to refine this into an interface that makes sense for
the compositor to expose. In particular, there are some cases that
definitely shouldn't be part of the compositor interface that require an
"escape hatch" where ThreadedInputHandler currently uses a reference to
the LayerTreeHostImpl:

- cc::Viewport
- The compositor Animation system
- FrameTrackers and metrics
- BrowserControls
- Scrollbar Animations
- Interaction with the PropertyTrees

These will need additional thought and more meaningful changes so will
be done separately.

Bug: 915926
Change-Id: I4bc79478f387614712c0f74bcb3c1355a917f591
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2359390
Reviewed-by: Khushal <khushalsagar@chromium.org>
Reviewed-by: Xida Chen <xidachen@chromium.org>
Commit-Queue: David Bokan <bokan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#801553}
  • Loading branch information
bokand authored and Commit Bot committed Aug 25, 2020
1 parent 8723a16 commit 583eaf6
Show file tree
Hide file tree
Showing 5 changed files with 257 additions and 164 deletions.
36 changes: 36 additions & 0 deletions cc/input/compositor_input_interfaces.h
Expand Up @@ -12,9 +12,16 @@ namespace viz {
struct BeginFrameArgs;
}

namespace gfx {
class Vector2dF;
}

namespace cc {

struct CompositorCommitData;
class LayerTreeHostImpl;
class LayerTreeSettings;
class ScrollTree;

// This is the interface that LayerTreeHostImpl and the "graphics" side of the
// compositor uses to talk to the compositor ThreadedInputHandler. This
Expand Down Expand Up @@ -71,6 +78,35 @@ class InputDelegateForCompositor {
virtual bool IsActivelyPrecisionScrolling() const = 0;
};

// This is the interface that's exposed by the LayerTreeHostImpl to the input
// handler.
class CompositorDelegateForInput {
public:
virtual ScrollTree& GetScrollTree() const = 0;
virtual bool HasAnimatedScrollbars() const = 0;
virtual void SetNeedsCommit() = 0;
virtual void SetNeedsFullViewportRedraw() = 0;
virtual void DidUpdateScrollAnimationCurve() = 0;
virtual void AccumulateScrollDeltaForTracing(const gfx::Vector2dF& delta) = 0;
virtual void DidStartPinchZoom() = 0;
virtual void DidUpdatePinchZoom() = 0;
virtual void DidEndPinchZoom() = 0;
virtual void DidStartScroll() = 0;
virtual void DidMouseLeave() = 0;
virtual bool IsInHighLatencyMode() const = 0;
virtual void WillScrollContent(ElementId element_id) = 0;
virtual void DidScrollContent(ElementId element_id, bool animated) = 0;
virtual float DeviceScaleFactor() const = 0;
virtual float PageScaleFactor() const = 0;
virtual const LayerTreeSettings& GetSettings() const = 0;

// TODO(bokan): Temporary escape hatch for code that hasn't yet been
// converted to use the input<->compositor interface. This will eventually be
// removed.
virtual LayerTreeHostImpl& GetImplDeprecated() = 0;
virtual const LayerTreeHostImpl& GetImplDeprecated() const = 0;
};

} // namespace cc

#endif // CC_INPUT_COMPOSITOR_INPUT_INTERFACES_H_

0 comments on commit 583eaf6

Please sign in to comment.