summaryrefslogtreecommitdiffstats
path: root/components/mus/public/cpp/output_surface.h
blob: 001050dd816cbf71ec418c2ab88a11278f54da25 (plain)
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
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef COMPONENTS_MUS_PUBLIC_CPP_OUTPUT_SURFACE_H_
#define COMPONENTS_MUS_PUBLIC_CPP_OUTPUT_SURFACE_H_

#include "base/macros.h"
#include "cc/output/output_surface.h"
#include "cc/surfaces/surface_id.h"
#include "components/mus/public/cpp/window_surface.h"
#include "components/mus/public/cpp/window_surface_client.h"
#include "mojo/public/cpp/bindings/binding.h"

namespace mus {

class OutputSurface : public cc::OutputSurface, public WindowSurfaceClient {
 public:
  OutputSurface(const scoped_refptr<cc::ContextProvider>& context_provider,
                scoped_ptr<WindowSurface> surface);
  ~OutputSurface() override;

  // cc::OutputSurface implementation.
  void SwapBuffers(cc::CompositorFrame* frame) override;
  bool BindToClient(cc::OutputSurfaceClient* client) override;
  void DetachFromClient() override;

 private:
  // WindowSurfaceClient implementation:
  void OnResourcesReturned(
      WindowSurface* surface,
      mojo::Array<mojom::ReturnedResourcePtr> resources) override;

  void SwapBuffersComplete();

  scoped_ptr<WindowSurface> surface_;

  DISALLOW_COPY_AND_ASSIGN(OutputSurface);
};

}  // namespace mus

#endif  // COMPONENTS_MUS_PUBLIC_CPP_OUTPUT_SURFACE_H_