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

Side by Side Diff: services/gfx/compositor/graph/resource_def.h

Issue 1552963002: Initial checkin of the new Mozart compositor. (Closed) Base URL: git@github.com:domokit/mojo.git@moz-11
Patch Set: Created 4 years, 11 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
OLDNEW
(Empty)
1 // Copyright 2015 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 SERVICES_GFX_COMPOSITOR_GRAPH_RESOURCE_DEF_H_
6 #define SERVICES_GFX_COMPOSITOR_GRAPH_RESOURCE_DEF_H_
7
8 #include <memory>
9
10 #include "base/macros.h"
11 #include "mojo/services/gfx/composition/interfaces/resources.mojom.h"
12 #include "services/gfx/compositor/render/render_image.h"
13
14 namespace compositor {
15
16 class SceneDef;
17
18 // Abstract scene graph resource definition.
19 class ResourceDef {
20 public:
21 enum class Type { kScene, kImage };
22
23 ResourceDef() = default;
24 virtual ~ResourceDef() = default;
25
26 // Gets the resource type.
27 virtual Type type() const = 0;
28
29 private:
30 DISALLOW_COPY_AND_ASSIGN(ResourceDef);
31 };
32
33 // Reference to another scene expressed as a resource definition.
34 // The pointer may be null if the referenced scene has become unavailable.
35 class SceneResourceDef : public ResourceDef {
36 public:
37 explicit SceneResourceDef(SceneDef* referenced_scene);
38 ~SceneResourceDef() override;
39
40 Type type() const override;
41
42 // The referenced scene, may be null if unavailable.
43 SceneDef* referenced_scene() { return referenced_scene_; }
44 void clear_referenced_scene() { referenced_scene_ = nullptr; }
45
46 private:
47 SceneDef* referenced_scene_;
abarth 2016/01/10 22:55:36 What is the lifetime relationship between this obj
jeffbrown 2016/01/16 03:28:32 I'm using bare pointers because I can guarantee th
48
49 DISALLOW_COPY_AND_ASSIGN(SceneResourceDef);
50 };
51
52 // Reference to an image expressed as a resource definition.
53 class ImageResourceDef : public ResourceDef {
54 public:
55 explicit ImageResourceDef(const std::shared_ptr<RenderImage>& image);
56 ~ImageResourceDef() override;
57
58 Type type() const override;
59
60 // The referenced image, may be null if unavailable.
61 const std::shared_ptr<RenderImage>& image() { return image_; }
62
63 private:
64 std::shared_ptr<RenderImage> image_;
abarth 2016/01/10 22:55:36 I think I raised this before, but shared_ptr is no
jeffbrown 2016/01/16 03:28:32 I am actually using weak_ptr semantics here. It's
65
66 DISALLOW_COPY_AND_ASSIGN(ImageResourceDef);
67 };
68
69 } // namespace compositor
70
71 #endif // SERVICES_GFX_COMPOSITOR_GRAPH_RESOURCE_DEF_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698