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