1 // Copyright 2012 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_OUTPUT_SURFACE_CLIENT_H_
6 #define COMPONENTS_VIZ_SERVICE_DISPLAY_OUTPUT_SURFACE_CLIENT_H_
7 
8 #include "base/callback.h"
9 #include "base/memory/ref_counted.h"
10 #include "base/time/time.h"
11 #include "components/viz/common/gpu/context_provider.h"
12 #include "components/viz/common/resources/returned_resource.h"
13 #include "components/viz/service/viz_service_export.h"
14 #include "gpu/command_buffer/common/texture_in_use_response.h"
15 #include "ui/gfx/geometry/rect.h"
16 #include "ui/latency/latency_info.h"
17 
18 namespace gfx {
19 struct CALayerParams;
20 struct PresentationFeedback;
21 struct SwapTimings;
22 }  // namespace gfx
23 
24 namespace viz {
25 
26 class VIZ_SERVICE_EXPORT OutputSurfaceClient {
27  public:
28   // A notification that the swap of the backbuffer to the hardware is complete
29   // and is now visible to the user, along with timing information on when the
30   // swapping of the backbuffer started and completed.
31   virtual void DidReceiveSwapBuffersAck(const gfx::SwapTimings& timings) = 0;
32 
33   // For surfaceless/ozone implementations to create damage for the next frame.
34   virtual void SetNeedsRedrawRect(const gfx::Rect& damage_rect) = 0;
35 
36   // For synchronizing IOSurface use with the macOS WindowServer.
37   virtual void DidReceiveTextureInUseResponses(
38       const gpu::TextureInUseResponses& responses) = 0;
39 
40   // For displaying a swapped frame's contents on macOS.
41   virtual void DidReceiveCALayerParams(
42       const gfx::CALayerParams& ca_layer_params) = 0;
43 
44   // For sending swap sizes back to the browser process. Currently only used on
45   // Android.
46   virtual void DidSwapWithSize(const gfx::Size& pixel_size) = 0;
47 
48   // See |gfx::PresentationFeedback| for detail.
DidReceivePresentationFeedback(const gfx::PresentationFeedback & feedback)49   virtual void DidReceivePresentationFeedback(
50       const gfx::PresentationFeedback& feedback) {}
51 
52  protected:
~OutputSurfaceClient()53   virtual ~OutputSurfaceClient() {}
54 };
55 
56 }  // namespace viz
57 
58 #endif  // COMPONENTS_VIZ_SERVICE_DISPLAY_OUTPUT_SURFACE_CLIENT_H_
59