1 // Copyright 2020 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef COMPONENTS_VIZ_SERVICE_DISPLAY_AGGREGATED_FRAME_H_
6 #define COMPONENTS_VIZ_SERVICE_DISPLAY_AGGREGATED_FRAME_H_
7 
8 #include <memory>
9 #include <vector>
10 
11 #include "base/optional.h"
12 #include "components/viz/common/delegated_ink_metadata.h"
13 #include "components/viz/common/quads/aggregated_render_pass.h"
14 #include "components/viz/service/viz_service_export.h"
15 #include "ui/gfx/display_color_spaces.h"
16 #include "ui/latency/latency_info.h"
17 
18 namespace viz {
19 
20 typedef std::vector<gfx::Rect> SurfaceDamageRectList;
21 
22 class VIZ_SERVICE_EXPORT AggregatedFrame {
23  public:
24   AggregatedFrame();
25   AggregatedFrame(AggregatedFrame&& other);
26   ~AggregatedFrame();
27 
28   AggregatedFrame& operator=(AggregatedFrame&& other);
29 
30   // The visible height of the top-controls. If the value is not set, then the
31   // visible height should be the same as in the latest submitted frame with a
32   // value set.
33   base::Optional<float> top_controls_visible_height;
34 
35   // A list of latency info used for this frame.
36   std::vector<ui::LatencyInfo> latency_info;
37 
38   // Indicates the content color usage for this frame.
39   gfx::ContentColorUsage content_color_usage = gfx::ContentColorUsage::kSRGB;
40 
41   // Indicates whether any render passes have a copy output request.
42   bool has_copy_requests = false;
43 
44   // Indicates whether this frame may contain video.
45   bool may_contain_video = false;
46 
47   // A list of surface damage rects in the current frame, used for overlays.
48   SurfaceDamageRectList surface_damage_rect_list_;
49 
50   // Contains the metadata required for drawing a delegated ink trail onto the
51   // end of a rendered ink stroke. This should only be present when two
52   // conditions are met:
53   //   1. The JS API |updateInkTrailStartPoint| is used - This gathers the
54   //     metadata and puts it onto a compositor frame to be sent to viz.
55   //   2. This frame will not be submitted to the root surface - The browser UI
56   //     does not use this, and the frame must be contained within a
57   //     SurfaceDrawQuad.
58   // The ink trail created with this metadata will only last for a single frame
59   // before it disappears, regardless of whether or not the next frame contains
60   // delegated ink metadata.
61   std::unique_ptr<DelegatedInkMetadata> delegated_ink_metadata;
62 
63   AggregatedRenderPassList render_pass_list;
64 };
65 
66 }  // namespace viz
67 
68 #endif  // COMPONENTS_VIZ_SERVICE_DISPLAY_AGGREGATED_FRAME_H_
69