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

Unified Diff: mojo/examples/surfaces_app/child_gl_impl.h

Issue 451753003: Mojo multiple command buffer support and sample (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: better casts Created 6 years, 4 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 | « mojo/examples/surfaces_app/child_gl_app.cc ('k') | mojo/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: mojo/examples/surfaces_app/child_gl_impl.h
diff --git a/mojo/examples/surfaces_app/child_impl.h b/mojo/examples/surfaces_app/child_gl_impl.h
similarity index 55%
copy from mojo/examples/surfaces_app/child_impl.h
copy to mojo/examples/surfaces_app/child_gl_impl.h
index 338b17f3d104f70a9400fcdebda837b88f7ed878..e99059164aa6461c6a3c6eb0a77c354c29b64735 100644
--- a/mojo/examples/surfaces_app/child_impl.h
+++ b/mojo/examples/surfaces_app/child_gl_impl.h
@@ -2,13 +2,17 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef MOJO_EXAMPLES_SURFACES_APP_CHILD_IMPL_H_
-#define MOJO_EXAMPLES_SURFACES_APP_CHILD_IMPL_H_
+#ifndef MOJO_EXAMPLES_SURFACES_APP_CHILD_GL_IMPL_H_
+#define MOJO_EXAMPLES_SURFACES_APP_CHILD_GL_IMPL_H_
+#include "base/containers/hash_tables.h"
#include "base/memory/scoped_ptr.h"
+#include "base/time/time.h"
#include "cc/surfaces/surface_id.h"
#include "cc/surfaces/surface_id_allocator.h"
+#include "mojo/examples/sample_app/spinning_cube.h"
#include "mojo/examples/surfaces_app/child.mojom.h"
+#include "mojo/public/c/gles2/gles2.h"
#include "mojo/public/cpp/bindings/string.h"
#include "mojo/services/public/interfaces/surfaces/surface_id.mojom.h"
#include "mojo/services/public/interfaces/surfaces/surfaces.mojom.h"
@@ -23,27 +27,18 @@ namespace mojo {
class ApplicationConnection;
-namespace surfaces {
-class Surface;
-}
-
namespace examples {
-// Simple example of a child app using surfaces.
-class ChildImpl : public InterfaceImpl<Child>, public SurfaceClient {
+// Simple example of a child app using surfaces + GL.
+class ChildGLImpl : public InterfaceImpl<Child>, public SurfaceClient {
public:
- class Context {
- public:
- virtual ApplicationConnection* ShellConnection(
- const mojo::String& application_url) = 0;
- };
- explicit ChildImpl(ApplicationConnection* surfaces_service_connection);
- virtual ~ChildImpl();
+ ChildGLImpl(ApplicationConnection* surfaces_service_connection,
+ CommandBufferPtr command_buffer);
+ virtual ~ChildGLImpl();
// SurfaceClient implementation
virtual void SetIdNamespace(uint32_t id_namespace) OVERRIDE;
- virtual void ReturnResources(
- Array<ReturnedResourcePtr> resources) OVERRIDE;
+ virtual void ReturnResources(Array<ReturnedResourcePtr> resources) OVERRIDE;
private:
// Child implementation.
@@ -52,19 +47,25 @@ class ChildImpl : public InterfaceImpl<Child>, public SurfaceClient {
SizePtr size,
const mojo::Callback<void(SurfaceIdPtr id)>& callback) OVERRIDE;
+ void AllocateSurface();
void Draw();
SkColor color_;
gfx::Size size_;
scoped_ptr<cc::SurfaceIdAllocator> allocator_;
SurfacePtr surface_;
+ MojoGLES2Context context_;
cc::SurfaceId id_;
- mojo::Callback<void(SurfaceIdPtr id)> produce_callback_;
+ ::examples::SpinningCube cube_;
+ Callback<void(SurfaceIdPtr id)> produce_callback_;
+ base::TimeTicks start_time_;
+ uint32_t next_resource_id_;
+ base::hash_map<uint32_t, GLuint> id_to_tex_map_;
- DISALLOW_COPY_AND_ASSIGN(ChildImpl);
+ DISALLOW_COPY_AND_ASSIGN(ChildGLImpl);
};
} // namespace examples
} // namespace mojo
-#endif // MOJO_EXAMPLES_SURFACES_APP_CHILD_IMPL_H_
+#endif // MOJO_EXAMPLES_SURFACES_APP_CHILD_GL_IMPL_H_
« no previous file with comments | « mojo/examples/surfaces_app/child_gl_app.cc ('k') | mojo/examples/surfaces_app/child_gl_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698