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

Unified 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: fix android build 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « services/gfx/compositor/graph/node_def.cc ('k') | services/gfx/compositor/graph/resource_def.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/gfx/compositor/graph/resource_def.h
diff --git a/services/gfx/compositor/graph/resource_def.h b/services/gfx/compositor/graph/resource_def.h
new file mode 100644
index 0000000000000000000000000000000000000000..9f3d8c8f3921029a4fbd219aa18283cbc3c09c7d
--- /dev/null
+++ b/services/gfx/compositor/graph/resource_def.h
@@ -0,0 +1,75 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef SERVICES_GFX_COMPOSITOR_GRAPH_RESOURCE_DEF_H_
+#define SERVICES_GFX_COMPOSITOR_GRAPH_RESOURCE_DEF_H_
+
+#include <memory>
+
+#include "base/macros.h"
+#include "mojo/services/gfx/composition/interfaces/resources.mojom.h"
+#include "services/gfx/compositor/render/render_image.h"
+
+namespace compositor {
+
+class SceneDef;
+
+// Abstract scene graph resource definition.
+class ResourceDef {
+ public:
+ enum class Type { kScene, kImage };
+
+ ResourceDef() = default;
+ virtual ~ResourceDef() = default;
+
+ // Gets the resource type.
+ virtual Type type() const = 0;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ResourceDef);
+};
+
+// Reference to another scene expressed as a resource definition.
+// The pointer may be null if the referenced scene has become unavailable.
+class SceneResourceDef : public ResourceDef {
+ public:
+ explicit SceneResourceDef(SceneDef* referenced_scene);
+ ~SceneResourceDef() override;
+
+ Type type() const override;
+
+ // The referenced scene, may be null if unavailable.
+ SceneDef* referenced_scene() { return referenced_scene_; }
+
+ // Clears the referenced scene.
+ // This is called by |SceneDef::UnlinkReferencedScene| when the
+ // referenced scene is no longer available.
+ void clear_referenced_scene() { referenced_scene_ = nullptr; }
+
+ private:
+ SceneDef* referenced_scene_;
+
+ DISALLOW_COPY_AND_ASSIGN(SceneResourceDef);
+};
+
+// Reference to an image expressed as a resource definition.
+class ImageResourceDef : public ResourceDef {
+ public:
+ explicit ImageResourceDef(const std::shared_ptr<RenderImage>& image);
+ ~ImageResourceDef() override;
+
+ Type type() const override;
+
+ // The referenced image, may be null if unavailable.
+ const std::shared_ptr<RenderImage>& image() { return image_; }
+
+ private:
+ std::shared_ptr<RenderImage> image_;
+
+ DISALLOW_COPY_AND_ASSIGN(ImageResourceDef);
+};
+
+} // namespace compositor
+
+#endif // SERVICES_GFX_COMPOSITOR_GRAPH_RESOURCE_DEF_H_
« no previous file with comments | « services/gfx/compositor/graph/node_def.cc ('k') | services/gfx/compositor/graph/resource_def.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698