layer_tree.h 2.1 KB
Newer Older
1 2 3 4
// 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.

A
Adam Barth 已提交
5 6
#ifndef FLOW_LAYERS_LAYER_TREE_H_
#define FLOW_LAYERS_LAYER_TREE_H_
7

8
#include <stdint.h>
9 10 11
#include <memory>

#include "base/macros.h"
12
#include "base/time/time.h"
13
#include "flow/compositor_context.h"
A
Adam Barth 已提交
14
#include "flow/layers/layer.h"
15 16
#include "third_party/skia/include/core/SkSize.h"

A
Adam Barth 已提交
17
namespace flow {
18 19 20 21 22 23

class LayerTree {
 public:
  LayerTree();
  ~LayerTree();

24 25 26 27 28 29
  // TODO(abarth): Integrate scene updates with the rasterization pass so that
  // we can draw on top of child scenes (and so that we can apply clips and
  // blending operations to child scene).
  void UpdateScene(mojo::gfx::composition::SceneUpdate* update,
                   mojo::gfx::composition::Node* container);

30
  Layer* root_layer() const { return root_layer_.get(); }
31

32 33 34 35
  void set_root_layer(std::unique_ptr<Layer> root_layer) {
    root_layer_ = std::move(root_layer);
  }

36
  SkRect GetBounds() const;
37
  const SkISize& frame_size() const { return frame_size_; }
38

39 40
  void set_frame_size(const SkISize& frame_size) { frame_size_ = frame_size; }

41 42 43 44 45
  uint32_t scene_version() const { return scene_version_; }
  void set_scene_version(uint32_t scene_version) {
    scene_version_ = scene_version;
  }

46 47 48 49 50 51 52 53
  void set_construction_time(const base::TimeDelta& delta) {
    construction_time_ = delta;
  }

  const base::TimeDelta& construction_time() const {
    return construction_time_;
  }

54 55 56 57
  // The number of frame intervals missed after which the compositor must
  // trace the rasterized picture to a trace file. Specify 0 to disable all
  // tracing
  void set_rasterizer_tracing_threshold(uint32_t interval) {
J
Jason Simmons 已提交
58
    rasterizer_tracing_threshold_ = interval;
59 60 61
  }

  uint32_t rasterizer_tracing_threshold() const {
J
Jason Simmons 已提交
62
    return rasterizer_tracing_threshold_;
63 64
  }

65
 private:
66
  SkISize frame_size_;  // Physical pixels.
67
  uint32_t scene_version_;
68 69
  std::unique_ptr<Layer> root_layer_;

70
  base::TimeDelta construction_time_;
J
Jason Simmons 已提交
71
  uint32_t rasterizer_tracing_threshold_;
72

73 74 75
  DISALLOW_COPY_AND_ASSIGN(LayerTree);
};

A
Adam Barth 已提交
76
}  // namespace flow
77

A
Adam Barth 已提交
78
#endif  // FLOW_LAYERS_LAYER_TREE_H_