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

Unified Diff: examples/surfaces_app/child_gl_impl.h

Issue 1537803002: Revert "Delete the Surfaces service." (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years 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 | « examples/surfaces_app/child_gl_app.cc ('k') | examples/surfaces_app/child_gl_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: examples/surfaces_app/child_gl_impl.h
diff --git a/examples/surfaces_app/child_gl_impl.h b/examples/surfaces_app/child_gl_impl.h
new file mode 100644
index 0000000000000000000000000000000000000000..752d227e7c5241fdd5995853fedf42d9c743d2a5
--- /dev/null
+++ b/examples/surfaces_app/child_gl_impl.h
@@ -0,0 +1,74 @@
+// 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 EXAMPLES_SURFACES_APP_CHILD_GL_IMPL_H_
+#define EXAMPLES_SURFACES_APP_CHILD_GL_IMPL_H_
+
+#include <GLES2/gl2.h>
+#include <MGL/mgl_types.h>
+
+#include "base/containers/hash_tables.h"
+#include "base/macros.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/time/time.h"
+#include "examples/spinning_cube/spinning_cube.h"
+#include "examples/surfaces_app/child.mojom.h"
+#include "mojo/public/cpp/bindings/string.h"
+#include "mojo/public/cpp/bindings/strong_binding.h"
+#include "mojo/services/gpu/interfaces/command_buffer.mojom.h"
+#include "mojo/services/surfaces/interfaces/surface_id.mojom.h"
+#include "mojo/services/surfaces/interfaces/surfaces.mojom.h"
+#include "third_party/skia/include/core/SkColor.h"
+#include "ui/gfx/size.h"
+
+namespace mojo {
+
+class ApplicationConnection;
+
+namespace examples {
+
+// Simple example of a child app using surfaces + GL.
+class ChildGLImpl : public Child, public ResourceReturner {
+ public:
+ ChildGLImpl(ApplicationConnection* surfaces_service_connection,
+ CommandBufferPtr command_buffer,
+ InterfaceRequest<Child> request);
+ ~ChildGLImpl() override;
+
+ private:
+ using ProduceCallback = mojo::Callback<void(SurfaceIdPtr id)>;
+
+ // Child implementation.
+ void ProduceFrame(ColorPtr color,
+ SizePtr size,
+ const ProduceCallback& callback) override;
+
+ // ResourceReturner implementation
+ void ReturnResources(Array<ReturnedResourcePtr> resources) override;
+
+ void SetIdNamespace(uint32_t id_namespace);
+ void Draw();
+ void RunProduceCallback();
+
+ SkColor color_;
+ gfx::Size size_;
+ SurfacePtr surface_;
+ MGLContext context_;
+ uint32_t id_namespace_;
+ uint32_t local_id_;
+ ::examples::SpinningCube cube_;
+ base::TimeTicks start_time_;
+ uint32_t next_resource_id_;
+ base::hash_map<uint32_t, GLuint> id_to_tex_map_;
+ ProduceCallback produce_callback_;
+ Binding<ResourceReturner> returner_binding_;
+ StrongBinding<Child> binding_;
+
+ DISALLOW_COPY_AND_ASSIGN(ChildGLImpl);
+};
+
+} // namespace examples
+} // namespace mojo
+
+#endif // EXAMPLES_SURFACES_APP_CHILD_GL_IMPL_H_
« no previous file with comments | « examples/surfaces_app/child_gl_app.cc ('k') | examples/surfaces_app/child_gl_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698