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

Side by Side Diff: examples/bitmap_uploader/bitmap_uploader.h

Issue 826423008: Use local ids for Surfaces APIs that can only apply to local surfaces (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 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
« no previous file with comments | « no previous file | examples/bitmap_uploader/bitmap_uploader.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_BITMAP_UPLOADER_BITMAP_UPLOADER_H_ 5 #ifndef EXAMPLES_BITMAP_UPLOADER_BITMAP_UPLOADER_H_
6 #define EXAMPLES_BITMAP_UPLOADER_BITMAP_UPLOADER_H_ 6 #define EXAMPLES_BITMAP_UPLOADER_BITMAP_UPLOADER_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/containers/hash_tables.h" 9 #include "base/containers/hash_tables.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "base/memory/weak_ptr.h"
12 #include "mojo/public/c/gles2/gles2.h" 11 #include "mojo/public/c/gles2/gles2.h"
13 #include "mojo/services/geometry/public/interfaces/geometry.mojom.h" 12 #include "mojo/services/geometry/public/interfaces/geometry.mojom.h"
14 #include "mojo/services/gpu/public/interfaces/gpu.mojom.h" 13 #include "mojo/services/gpu/public/interfaces/gpu.mojom.h"
15 #include "mojo/services/surfaces/public/interfaces/surface_id.mojom.h" 14 #include "mojo/services/surfaces/public/interfaces/surface_id.mojom.h"
16 #include "mojo/services/surfaces/public/interfaces/surfaces.mojom.h" 15 #include "mojo/services/surfaces/public/interfaces/surfaces.mojom.h"
17 #include "mojo/services/surfaces/public/interfaces/surfaces_service.mojom.h" 16 #include "mojo/services/surfaces/public/interfaces/surfaces_service.mojom.h"
18 17
19 namespace mojo { 18 namespace mojo {
20 class Shell; 19 class Shell;
21 class View; 20 class View;
(...skipping 15 matching lines...) Expand all
37 }; 36 };
38 37
39 // Sets a bitmap. 38 // Sets a bitmap.
40 void SetBitmap(int width, 39 void SetBitmap(int width,
41 int height, 40 int height,
42 scoped_ptr<std::vector<unsigned char>> data, 41 scoped_ptr<std::vector<unsigned char>> data,
43 Format format); 42 Format format);
44 43
45 private: 44 private:
46 void Upload(); 45 void Upload();
47 void OnSurfaceConnectionCreated(SurfacePtr surface, uint32_t id_namespace);
48 uint32_t BindTextureForSize(const Size size); 46 uint32_t BindTextureForSize(const Size size);
49 uint32_t TextureFormat(); 47 uint32_t TextureFormat();
50 48
51 // SurfaceClient implementation. 49 // SurfaceClient implementation.
52 void SetIdNamespace(uint32_t id_namespace) override; 50 void SetIdNamespace(uint32_t id_namespace) override;
53 void ReturnResources(Array<ReturnedResourcePtr> resources) override; 51 void ReturnResources(Array<ReturnedResourcePtr> resources) override;
54 52
55 View* view_; 53 View* view_;
56 SurfacesServicePtr surfaces_service_;
57 GpuPtr gpu_service_; 54 GpuPtr gpu_service_;
58 MojoGLES2Context gles2_context_; 55 MojoGLES2Context gles2_context_;
59 56
60 Size size_; 57 Size size_;
61 uint32_t color_; 58 uint32_t color_;
62 int width_; 59 int width_;
63 int height_; 60 int height_;
64 Format format_; 61 Format format_;
65 scoped_ptr<std::vector<unsigned char>> bitmap_; 62 scoped_ptr<std::vector<unsigned char>> bitmap_;
66 SurfacePtr surface_; 63 SurfacePtr surface_;
67 Size surface_size_; 64 Size surface_size_;
68 uint32_t next_resource_id_; 65 uint32_t next_resource_id_;
69 uint32_t id_namespace_; 66 uint32_t id_namespace_;
70 SurfaceIdPtr surface_id_; 67 uint32_t local_id_;
71 base::hash_map<uint32_t, uint32_t> resource_to_texture_id_map_; 68 base::hash_map<uint32_t, uint32_t> resource_to_texture_id_map_;
72 69
73 base::WeakPtrFactory<BitmapUploader> weak_factory_;
74
75 DISALLOW_COPY_AND_ASSIGN(BitmapUploader); 70 DISALLOW_COPY_AND_ASSIGN(BitmapUploader);
76 }; 71 };
77 72
78 } // namespace mojo 73 } // namespace mojo
79 74
80 #endif // EXAMPLES_BITMAP_UPLOADER_BITMAP_UPLOADER_H_ 75 #endif // EXAMPLES_BITMAP_UPLOADER_BITMAP_UPLOADER_H_
OLDNEW
« no previous file with comments | « no previous file | examples/bitmap_uploader/bitmap_uploader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698