File: layer_tree_frame_sink_client.h

package info (click to toggle)
chromium 139.0.7258.127-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 6,122,068 kB
  • sloc: cpp: 35,100,771; ansic: 7,163,530; javascript: 4,103,002; python: 1,436,920; asm: 946,517; xml: 746,709; pascal: 187,653; perl: 88,691; sh: 88,436; objc: 79,953; sql: 51,488; cs: 44,583; fortran: 24,137; makefile: 22,147; tcl: 15,277; php: 13,980; yacc: 8,984; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (103 lines) | stat: -rw-r--r-- 3,990 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CC_TREES_LAYER_TREE_FRAME_SINK_CLIENT_H_
#define CC_TREES_LAYER_TREE_FRAME_SINK_CLIENT_H_

#include <optional>
#include <vector>

#include "base/functional/callback.h"
#include "cc/cc_export.h"
#include "components/viz/common/resources/returned_resource.h"
#include "components/viz/common/surfaces/local_surface_id.h"
#include "ui/gfx/geometry/rect.h"

namespace gfx {
class Transform;
}

namespace viz {
class BeginFrameSource;
struct FrameTimingDetails;
struct HitTestRegionList;
}

namespace cc {

struct ManagedMemoryPolicy;

class CC_EXPORT LayerTreeFrameSinkClient {
 public:
  // Pass the begin frame source for the client to observe.  Client does not own
  // the viz::BeginFrameSource. LayerTreeFrameSink should call this once after
  // binding to the client and then call again with a null while detaching.
  virtual void SetBeginFrameSource(viz::BeginFrameSource* source) = 0;

  // Builds and returns a HitTestRegionList from the active LayerTreeImpl. To be
  // called during SubmitCompositorFrame().
  // TODO(danakj): Just pass it into SubmitCompositorFrame(), with a
  // LayerTreeSetting to enable it or not.
  virtual std::optional<viz::HitTestRegionList> BuildHitTestData() = 0;

  // Returns resources sent to SubmitCompositorFrame to be reused or freed.
  virtual void ReclaimResources(
      std::vector<viz::ReturnedResource> resources) = 0;

  // If set, |callback| will be called subsequent to each new tree activation,
  // regardless of the compositor visibility or damage. |callback| must remain
  // valid for the lifetime of the LayerTreeFrameSinkClient or until
  // unregistered by giving a null callback.
  virtual void SetTreeActivationCallback(base::RepeatingClosure callback) = 0;

  // Notification that the previous CompositorFrame given to
  // SubmitCompositorFrame() has been processed and that another frame
  // can be submitted. This provides backpressure from the display compositor
  // so that frames are submitted only at the rate it can handle them.
  virtual void DidReceiveCompositorFrameAck() = 0;

  // See components/viz/common/frame_timing_details.h for details on args.
  virtual void DidPresentCompositorFrame(
      uint32_t frame_token,
      const viz::FrameTimingDetails& details) = 0;

  // The LayerTreeFrameSink is lost when the viz::RasterContextProviders held by
  // it encounter an error. In this case the LayerTreeFrameSink (and the
  // viz::RasterContextProviders) must be recreated.
  virtual void DidLoseLayerTreeFrameSink() = 0;

  // For SynchronousCompositor (WebView) to ask the layer compositor to submit
  // a new CompositorFrame synchronously.
  virtual void OnDraw(const gfx::Transform& transform,
                      const gfx::Rect& viewport,
                      bool resourceless_software_draw,
                      bool skip_draw) = 0;

  // For SynchronousCompositor (WebView) to set how much memory the compositor
  // can use without changing visibility.
  virtual void SetMemoryPolicy(const ManagedMemoryPolicy& policy) = 0;

  // For SynchronousCompositor (WebView) to change which tiles should be
  // included in submitted CompositorFrames independently of what the viewport
  // is.
  // |viewport_rect| is in device viewport space.
  // |transform| transforms from from device viewport space to screen space.
  virtual void SetExternalTilePriorityConstraints(
      const gfx::Rect& viewport_rect,
      const gfx::Transform& transform) = 0;

  // Notification that the compositor frame transition directive has been
  // processed.
  virtual void OnCompositorFrameTransitionDirectiveProcessed(
      uint32_t sequence_id) {}

  virtual void OnSurfaceEvicted(const viz::LocalSurfaceId& local_surface_id) {}

 protected:
  virtual ~LayerTreeFrameSinkClient() {}
};

}  // namespace cc

#endif  // CC_TREES_LAYER_TREE_FRAME_SINK_CLIENT_H_