summaryrefslogtreecommitdiffstats
path: root/components/mus/surfaces/surfaces_state.h
blob: f67e962b21f32aace864ef014edf15b19d821e49 (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
49
50
51
52
53
54
55
// 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 COMPONENTS_MUS_SURFACES_SURFACES_STATE_H_
#define COMPONENTS_MUS_SURFACES_SURFACES_STATE_H_

#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "cc/surfaces/surface_hittest.h"
#include "cc/surfaces/surface_manager.h"
#include "components/mus/surfaces/surfaces_scheduler.h"

namespace cc {
class SurfaceHittest;
class SurfaceManager;
}  // namespace cc

namespace mus {

// The SurfacesState object is an object global to the Window Manager app that
// holds the SurfaceManager, SurfacesScheduler and allocates new Surfaces
// namespaces. This object lives on the main thread of the Window Manager.
// TODO(rjkroege, fsamuel): This object will need to change to support multiple
// displays.
class SurfacesState : public base::RefCounted<SurfacesState> {
 public:
  SurfacesState();

  uint32_t next_id_namespace() { return next_id_namespace_++; }

  cc::SurfaceManager* manager() { return &manager_; }

  cc::SurfaceHittest* hit_tester() { return &hit_tester_; }

  SurfacesScheduler* scheduler() { return &scheduler_; }

 private:
  friend class base::RefCounted<SurfacesState>;
  ~SurfacesState();

  // A Surface ID is an unsigned 64-bit int where the high 32-bits are generated
  // by the Surfaces service, and the low 32-bits are generated by the process
  // that requested the Surface.
  uint32_t next_id_namespace_;
  cc::SurfaceManager manager_;
  cc::SurfaceHittest hit_tester_;
  SurfacesScheduler scheduler_;

  DISALLOW_COPY_AND_ASSIGN(SurfacesState);
};

}  // namespace mus

#endif  //  COMPONENTS_MUS_SURFACES_SURFACES_STATE_H_