summaryrefslogtreecommitdiffstats
path: root/mandoline/ui/aura/surface_binding.h
blob: f36002d060593d7a3db998f0d8246d39e3115cfb (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
44
45
46
47
48
// Copyright 2015 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 MANDOLINE_UI_AURA_SURFACE_BINDING_H_
#define MANDOLINE_UI_AURA_SURFACE_BINDING_H_

#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"

namespace cc {
class OutputSurface;
}

namespace mojo {
class Shell;
class View;
}

namespace mandoline {

// SurfaceBinding is responsible for managing the connections necessary to
// bind a View to the surfaces service.
// Internally SurfaceBinding manages one connection (and related structures) per
// ViewTreeConnection. That is, all Views from a particular ViewTreeConnection
// share the same connection.
class SurfaceBinding {
 public:
  SurfaceBinding(mojo::Shell* shell, mojo::View* view);
  ~SurfaceBinding();

  // Creates an OutputSurface that renders to the View supplied to the
  // constructor.
  scoped_ptr<cc::OutputSurface> CreateOutputSurface();

 private:
  class PerConnectionState;

  mojo::Shell* shell_;
  mojo::View* view_;
  scoped_refptr<PerConnectionState> state_;

  DISALLOW_COPY_AND_ASSIGN(SurfaceBinding);
};

}  // namespace mandoline

#endif  // MANDOLINE_UI_AURA_SURFACE_BINDING_H_