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

Unified Diff: sky/compositor/resource_manager.h

Issue 740923002: Add a simple compositor for Sky (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Address reviewer comments Created 6 years, 1 month 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
Index: sky/compositor/resource_manager.h
diff --git a/sky/compositor/resource_manager.h b/sky/compositor/resource_manager.h
new file mode 100644
index 0000000000000000000000000000000000000000..24f4dbcb573c12e5227761acbf6b9da4ac5a8b08
--- /dev/null
+++ b/sky/compositor/resource_manager.h
@@ -0,0 +1,45 @@
+// Copyright 2014 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 SKY_COMPOSITOR_RESOURCE_MANAGER_H_
+#define SKY_COMPOSITOR_RESOURCE_MANAGER_H_
+
+#include "base/containers/hash_tables.h"
+#include "base/memory/weak_ptr.h"
+#include "mojo/services/public/interfaces/surfaces/surfaces.mojom.h"
+
+namespace gfx {
+class Size;
+}
+
+namespace mojo {
+class GLContext;
+class GLTexture;
+}
+
+namespace sky {
+class Layer;
+class LayerHost;
+
+class ResourceManager {
+ public:
+ explicit ResourceManager(base::WeakPtr<mojo::GLContext> gl_context);
+ ~ResourceManager();
+
+ scoped_ptr<mojo::GLTexture> CreateTexture(const gfx::Size& size);
+
+ mojo::TransferableResourcePtr CreateTransferableResource(Layer* layer);
+ void ReturnResources(mojo::Array<mojo::ReturnedResourcePtr> resources);
+
+ private:
+ base::WeakPtr<mojo::GLContext> gl_context_;
+ uint32_t next_resource_id_;
+ base::hash_map<uint32_t, mojo::GLTexture*> resource_to_texture_map_;
+
+ DISALLOW_COPY_AND_ASSIGN(ResourceManager);
+};
+
+} // namespace examples
+
+#endif // SKY_COMPOSITOR_RESOURCE_MANAGER_H_

Powered by Google App Engine
This is Rietveld 408576698