OLD | NEW |
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_GANESH_APP_TEXTURE_UPLOADER_H_ | 5 #ifndef EXAMPLES_GANESH_APP_TEXTURE_UPLOADER_H_ |
6 #define EXAMPLES_GANESH_APP_TEXTURE_UPLOADER_H_ | 6 #define EXAMPLES_GANESH_APP_TEXTURE_UPLOADER_H_ |
7 | 7 |
8 #include "base/containers/hash_tables.h" | 8 #include "base/containers/hash_tables.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
11 #include "mojo/gpu/gl_context.h" | 11 #include "mojo/gpu/gl_context.h" |
12 #include "mojo/gpu/gl_texture.h" | 12 #include "mojo/gpu/gl_texture.h" |
13 #include "mojo/services/geometry/public/interfaces/geometry.mojom.h" | 13 #include "mojo/services/geometry/public/interfaces/geometry.mojom.h" |
14 #include "mojo/services/surfaces/public/interfaces/surface_id.mojom.h" | 14 #include "mojo/services/surfaces/public/interfaces/surface_id.mojom.h" |
15 #include "mojo/services/surfaces/public/interfaces/surfaces.mojom.h" | 15 #include "mojo/services/surfaces/public/interfaces/surfaces.mojom.h" |
16 #include "mojo/services/surfaces/public/interfaces/surfaces_service.mojom.h" | |
17 | 16 |
18 namespace mojo { | 17 namespace mojo { |
19 class Shell; | 18 class Shell; |
20 } | 19 } |
21 | 20 |
22 namespace examples { | 21 namespace examples { |
23 | 22 |
24 class TextureUploader : public mojo::SurfaceClient, | 23 class TextureUploader : public mojo::SurfaceClient, |
25 public mojo::GLContext::Observer { | 24 public mojo::GLContext::Observer { |
26 public: | 25 public: |
(...skipping 13 matching lines...) Expand all Loading... |
40 void Upload(scoped_ptr<mojo::GLTexture> texture); | 39 void Upload(scoped_ptr<mojo::GLTexture> texture); |
41 | 40 |
42 private: | 41 private: |
43 // mojo::GLContext::Observer | 42 // mojo::GLContext::Observer |
44 void OnContextLost() override; | 43 void OnContextLost() override; |
45 | 44 |
46 // mojo::SurfaceClient | 45 // mojo::SurfaceClient |
47 void SetIdNamespace(uint32_t id_namespace) override; | 46 void SetIdNamespace(uint32_t id_namespace) override; |
48 void ReturnResources( | 47 void ReturnResources( |
49 mojo::Array<mojo::ReturnedResourcePtr> resources) override; | 48 mojo::Array<mojo::ReturnedResourcePtr> resources) override; |
50 void OnSurfaceConnectionCreated(mojo::SurfacePtr surface, | 49 |
51 uint32_t id_namespace); | |
52 void EnsureSurfaceForSize(const mojo::Size& size); | 50 void EnsureSurfaceForSize(const mojo::Size& size); |
| 51 void SendFullyQualifiedID(); |
53 | 52 |
54 Client* client_; | 53 Client* client_; |
55 base::WeakPtr<mojo::GLContext> context_; | 54 base::WeakPtr<mojo::GLContext> context_; |
56 mojo::SurfacesServicePtr surfaces_service_; | |
57 scoped_ptr<mojo::GLTexture> pending_upload_; | 55 scoped_ptr<mojo::GLTexture> pending_upload_; |
58 mojo::SurfacePtr surface_; | 56 mojo::SurfacePtr surface_; |
59 mojo::Size surface_size_; | 57 mojo::Size surface_size_; |
60 uint32_t next_resource_id_; | 58 uint32_t next_resource_id_; |
61 uint32_t id_namespace_; | 59 uint32_t id_namespace_; |
62 mojo::SurfaceIdPtr surface_id_; | 60 uint32_t local_id_; |
63 base::hash_map<uint32_t, mojo::GLTexture*> resource_to_texture_map_; | 61 base::hash_map<uint32_t, mojo::GLTexture*> resource_to_texture_map_; |
64 | 62 |
65 base::WeakPtrFactory<TextureUploader> weak_factory_; | 63 base::WeakPtrFactory<TextureUploader> weak_factory_; |
66 | 64 |
67 DISALLOW_COPY_AND_ASSIGN(TextureUploader); | 65 DISALLOW_COPY_AND_ASSIGN(TextureUploader); |
68 }; | 66 }; |
69 | 67 |
70 } // namespace examples | 68 } // namespace examples |
71 | 69 |
72 #endif // EXAMPLES_GANESH_APP_TEXTURE_UPLOADER_H_ | 70 #endif // EXAMPLES_GANESH_APP_TEXTURE_UPLOADER_H_ |
OLD | NEW |