Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(151)

Side by Side Diff: ui/compositor/layer_owner.h

Issue 10412044: layers: Consolidate the ownership of layers in views::View and aura::Window. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/compositor/compositor.gyp ('k') | ui/compositor/layer_owner.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2012 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_OWNER_H_
6 #define UI_COMPOSITOR_LAYER_OWNER_H_
7 #pragma once
8
9 #include "base/compiler_specific.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "ui/compositor/compositor_export.h"
12 #include "ui/compositor/layer.h"
13
14 namespace ui {
15
16 class COMPOSITOR_EXPORT LayerOwner {
17 public:
18 LayerOwner();
19 virtual ~LayerOwner();
20
21 // Releases the owning reference to its layer, and returns it.
22 // This is used when you need to animate the presentation of the owner just
23 // prior to destroying it. The Owner can be destroyed soon after calling this
24 // function, and the caller is then responsible for disposing of the layer
25 // once any animation completes. Note that layer() will remain valid until the
26 // end of ~LayerOwner().
27 Layer* AcquireLayer() WARN_UNUSED_RESULT;
28
29 ui::Layer* layer() { return layer_; }
30 const ui::Layer* layer() const { return layer_; }
31
32 protected:
33 // The LayerOwner owns its layer unless ownership is relinquished via a call
34 // to AcquireLayer(). After that moment |layer_| will still be valid but
35 // |layer_owner_| will be NULL. The reason for releasing ownership is that
36 // the client may wish to animate the layer beyond the lifetime of the owner,
37 // e.g. fading it out when it is destroyed.
38 scoped_ptr<Layer> layer_owner_;
39 Layer* layer_;
40
41 private:
42 DISALLOW_COPY_AND_ASSIGN(LayerOwner);
43 };
44
45 } // namespace ui
46
47 #endif // UI_COMPOSITOR_LAYER_OWNER_H_
OLDNEW
« no previous file with comments | « ui/compositor/compositor.gyp ('k') | ui/compositor/layer_owner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698