blob: 4412c2225a09d216fa9b2a57e8adf723248ee965 [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
domlaskowski4b33bfe2016-10-27 00:34:228#include <memory>
9
pkasting5cd84442014-11-21 01:37:2210#include "base/compiler_specific.h"
avi87b8b582015-12-24 21:35:2511#include "base/macros.h"
[email protected]25e9e1e2014-03-11 16:26:0212#include "ui/compositor/compositor_export.h"
13
14namespace ui {
15
16class Layer;
17
18// Scoping object that owns a Layer and all its descendants.
19class COMPOSITOR_EXPORT LayerTreeOwner {
20 public:
domlaskowski4b33bfe2016-10-27 00:34:2221 explicit LayerTreeOwner(std::unique_ptr<Layer> root);
[email protected]25e9e1e2014-03-11 16:26:0222 ~LayerTreeOwner();
23
[email protected]d662858c2014-04-11 17:46:5624 Layer* release() WARN_UNUSED_RESULT {
25 Layer* root = root_;
26 root_ = NULL;
27 return root;
28 }
29
[email protected]25e9e1e2014-03-11 16:26:0230 Layer* root() { return root_; }
31 const Layer* root() const { return root_; }
32
33 private:
34 Layer* root_;
35
36 DISALLOW_COPY_AND_ASSIGN(LayerTreeOwner);
37};
38
39} // namespace
40
41#endif // UI_COMPOSITOR_LAYER_TREE_OWNER_H_