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

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

Issue 871373015: De-Client Surface interface (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef EXAMPLES_SURFACES_APP_CHILD_GL_IMPL_H_ 5 #ifndef EXAMPLES_SURFACES_APP_CHILD_GL_IMPL_H_
6 #define EXAMPLES_SURFACES_APP_CHILD_GL_IMPL_H_ 6 #define EXAMPLES_SURFACES_APP_CHILD_GL_IMPL_H_
7 7
8 #include "base/containers/hash_tables.h" 8 #include "base/containers/hash_tables.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 12 matching lines...) Expand all
23 class CompositorFrame; 23 class CompositorFrame;
24 } 24 }
25 25
26 namespace mojo { 26 namespace mojo {
27 27
28 class ApplicationConnection; 28 class ApplicationConnection;
29 29
30 namespace examples { 30 namespace examples {
31 31
32 // Simple example of a child app using surfaces + GL. 32 // Simple example of a child app using surfaces + GL.
33 class ChildGLImpl : public InterfaceImpl<Child>, public SurfaceClient { 33 class ChildGLImpl : public InterfaceImpl<Child>, public ResourceReturner {
34 public: 34 public:
35 ChildGLImpl(ApplicationConnection* surfaces_service_connection, 35 ChildGLImpl(ApplicationConnection* surfaces_service_connection,
36 CommandBufferPtr command_buffer); 36 CommandBufferPtr command_buffer);
37 ~ChildGLImpl() override; 37 ~ChildGLImpl() override;
38 38
39 private: 39 private:
40 using ProduceCallback = mojo::Callback<void(SurfaceIdPtr id)>; 40 using ProduceCallback = mojo::Callback<void(SurfaceIdPtr id)>;
41 41
42 // Child implementation. 42 // Child implementation.
43 void ProduceFrame(ColorPtr color, 43 void ProduceFrame(ColorPtr color,
44 SizePtr size, 44 SizePtr size,
45 const ProduceCallback& callback) override; 45 const ProduceCallback& callback) override;
46 46
47 // SurfaceClient implementation 47 // ResourceReturner implementation
48 void SetIdNamespace(uint32_t id_namespace) override;
49 void ReturnResources(Array<ReturnedResourcePtr> resources) override; 48 void ReturnResources(Array<ReturnedResourcePtr> resources) override;
50 49
50 void SetIdNamespace(uint32_t id_namespace);
51 void Draw(); 51 void Draw();
52 void RunProduceCallback(); 52 void RunProduceCallback();
53 53
54 SkColor color_; 54 SkColor color_;
55 gfx::Size size_; 55 gfx::Size size_;
56 SurfacePtr surface_; 56 SurfacePtr surface_;
57 MojoGLES2Context context_; 57 MojoGLES2Context context_;
58 uint32_t id_namespace_; 58 uint32_t id_namespace_;
59 uint32_t local_id_; 59 uint32_t local_id_;
60 ::examples::SpinningCube cube_; 60 ::examples::SpinningCube cube_;
61 base::TimeTicks start_time_; 61 base::TimeTicks start_time_;
62 uint32_t next_resource_id_; 62 uint32_t next_resource_id_;
63 base::hash_map<uint32_t, GLuint> id_to_tex_map_; 63 base::hash_map<uint32_t, GLuint> id_to_tex_map_;
64 ProduceCallback produce_callback_; 64 ProduceCallback produce_callback_;
65 Binding<ResourceReturner> returner_binding_;
65 66
66 DISALLOW_COPY_AND_ASSIGN(ChildGLImpl); 67 DISALLOW_COPY_AND_ASSIGN(ChildGLImpl);
67 }; 68 };
68 69
69 } // namespace examples 70 } // namespace examples
70 } // namespace mojo 71 } // namespace mojo
71 72
72 #endif // EXAMPLES_SURFACES_APP_CHILD_GL_IMPL_H_ 73 #endif // EXAMPLES_SURFACES_APP_CHILD_GL_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698