blob: a54142bef31d75416d4daf0287079925936ec678 [file] [log] [blame]
[email protected]25e9e1e2014-03-11 16:26:021// Copyright 2014 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 UI_COMPOSITOR_LAYER_TREE_OWNER_H_
6#define UI_COMPOSITOR_LAYER_TREE_OWNER_H_
7
pkasting5cd84442014-11-21 01:37:228#include "base/compiler_specific.h"
avi87b8b582015-12-24 21:35:259#include "base/macros.h"
[email protected]25e9e1e2014-03-11 16:26:0210#include "ui/compositor/compositor_export.h"
11
12namespace ui {
13
14class Layer;
15
16// Scoping object that owns a Layer and all its descendants.
17class COMPOSITOR_EXPORT LayerTreeOwner {
18 public:
19 explicit LayerTreeOwner(Layer* root);
20 ~LayerTreeOwner();
21
[email protected]d662858c2014-04-11 17:46:5622 Layer* release() WARN_UNUSED_RESULT {
23 Layer* root = root_;
24 root_ = NULL;
25 return root;
26 }
27
[email protected]25e9e1e2014-03-11 16:26:0228 Layer* root() { return root_; }
29 const Layer* root() const { return root_; }
30
31 private:
32 Layer* root_;
33
34 DISALLOW_COPY_AND_ASSIGN(LayerTreeOwner);
35};
36
37} // namespace
38
39#endif // UI_COMPOSITOR_LAYER_TREE_OWNER_H_