1a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// Copyright 2014 The Chromium Authors. All rights reserved.
2a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
3a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// found in the LICENSE file.
4a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
5a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#ifndef UI_COMPOSITOR_LAYER_TREE_OWNER_H_
6a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#define UI_COMPOSITOR_LAYER_TREE_OWNER_H_
7a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
8a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#include "base/basictypes.h"
9a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#include "ui/compositor/compositor_export.h"
10a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
11a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)namespace ui {
12a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
13a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)class Layer;
14a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
15a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// Scoping object that owns a Layer and all its descendants.
16a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)class COMPOSITOR_EXPORT LayerTreeOwner {
17a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) public:
18a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  explicit LayerTreeOwner(Layer* root);
19a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  ~LayerTreeOwner();
20a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
21a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  Layer* release() WARN_UNUSED_RESULT {
22a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch    Layer* root = root_;
23a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch    root_ = NULL;
24a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch    return root;
25a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  }
26a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
27a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  Layer* root() { return root_; }
28a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  const Layer* root() const { return root_; }
29a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
30a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) private:
31a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  Layer* root_;
32a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
33a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  DISALLOW_COPY_AND_ASSIGN(LayerTreeOwner);
34a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)};
35a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
36a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)}  // namespace
37a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
38a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#endif  // UI_COMPOSITOR_LAYER_TREE_OWNER_H_
39