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

Side by Side Diff: examples/surfaces_app/child_gl_impl.h

Issue 1534693002: Delete the Surfaces service. (Closed) Base URL: git@github.com:domokit/mojo.git@cl-2d
Patch Set: rebase 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 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 EXAMPLES_SURFACES_APP_CHILD_GL_IMPL_H_
6 #define EXAMPLES_SURFACES_APP_CHILD_GL_IMPL_H_
7
8 #include <GLES2/gl2.h>
9 #include <MGL/mgl_types.h>
10
11 #include "base/containers/hash_tables.h"
12 #include "base/macros.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "base/time/time.h"
15 #include "examples/spinning_cube/spinning_cube.h"
16 #include "examples/surfaces_app/child.mojom.h"
17 #include "mojo/public/cpp/bindings/string.h"
18 #include "mojo/public/cpp/bindings/strong_binding.h"
19 #include "mojo/services/gpu/interfaces/command_buffer.mojom.h"
20 #include "mojo/services/surfaces/interfaces/surface_id.mojom.h"
21 #include "mojo/services/surfaces/interfaces/surfaces.mojom.h"
22 #include "third_party/skia/include/core/SkColor.h"
23 #include "ui/gfx/size.h"
24
25 namespace mojo {
26
27 class ApplicationConnection;
28
29 namespace examples {
30
31 // Simple example of a child app using surfaces + GL.
32 class ChildGLImpl : public Child, public ResourceReturner {
33 public:
34 ChildGLImpl(ApplicationConnection* surfaces_service_connection,
35 CommandBufferPtr command_buffer,
36 InterfaceRequest<Child> request);
37 ~ChildGLImpl() override;
38
39 private:
40 using ProduceCallback = mojo::Callback<void(SurfaceIdPtr id)>;
41
42 // Child implementation.
43 void ProduceFrame(ColorPtr color,
44 SizePtr size,
45 const ProduceCallback& callback) override;
46
47 // ResourceReturner implementation
48 void ReturnResources(Array<ReturnedResourcePtr> resources) override;
49
50 void SetIdNamespace(uint32_t id_namespace);
51 void Draw();
52 void RunProduceCallback();
53
54 SkColor color_;
55 gfx::Size size_;
56 SurfacePtr surface_;
57 MGLContext context_;
58 uint32_t id_namespace_;
59 uint32_t local_id_;
60 ::examples::SpinningCube cube_;
61 base::TimeTicks start_time_;
62 uint32_t next_resource_id_;
63 base::hash_map<uint32_t, GLuint> id_to_tex_map_;
64 ProduceCallback produce_callback_;
65 Binding<ResourceReturner> returner_binding_;
66 StrongBinding<Child> binding_;
67
68 DISALLOW_COPY_AND_ASSIGN(ChildGLImpl);
69 };
70
71 } // namespace examples
72 } // namespace mojo
73
74 #endif // EXAMPLES_SURFACES_APP_CHILD_GL_IMPL_H_
OLDNEW
« 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