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

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

Issue 1921973002: Convert //components/[a-e]* from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 7 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 COMPONENTS_BITMAP_UPLOADER_BITMAP_UPLOADER_H_ 5 #ifndef COMPONENTS_BITMAP_UPLOADER_BITMAP_UPLOADER_H_
6 #define COMPONENTS_BITMAP_UPLOADER_BITMAP_UPLOADER_H_ 6 #define COMPONENTS_BITMAP_UPLOADER_BITMAP_UPLOADER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory>
11
10 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
11 #include "base/containers/hash_tables.h" 13 #include "base/containers/hash_tables.h"
12 #include "base/macros.h" 14 #include "base/macros.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "components/bitmap_uploader/bitmap_uploader_export.h" 15 #include "components/bitmap_uploader/bitmap_uploader_export.h"
15 #include "components/mus/public/cpp/window_surface.h" 16 #include "components/mus/public/cpp/window_surface.h"
16 #include "components/mus/public/cpp/window_surface_client.h" 17 #include "components/mus/public/cpp/window_surface_client.h"
17 #include "components/mus/public/interfaces/compositor_frame.mojom.h" 18 #include "components/mus/public/interfaces/compositor_frame.mojom.h"
18 #include "components/mus/public/interfaces/gpu.mojom.h" 19 #include "components/mus/public/interfaces/gpu.mojom.h"
19 #include "gpu/GLES2/gl2chromium.h" 20 #include "gpu/GLES2/gl2chromium.h"
20 #include "gpu/GLES2/gl2extchromium.h" 21 #include "gpu/GLES2/gl2extchromium.h"
21 #include "mojo/public/c/gles2/gles2.h" 22 #include "mojo/public/c/gles2/gles2.h"
22 23
23 namespace shell { 24 namespace shell {
(...skipping 18 matching lines...) Expand all
42 void SetColor(uint32_t color); 43 void SetColor(uint32_t color);
43 44
44 enum Format { 45 enum Format {
45 RGBA, // Pixel layout on Android. 46 RGBA, // Pixel layout on Android.
46 BGRA, // Pixel layout everywhere else. 47 BGRA, // Pixel layout everywhere else.
47 }; 48 };
48 49
49 // Sets a bitmap. 50 // Sets a bitmap.
50 void SetBitmap(int width, 51 void SetBitmap(int width,
51 int height, 52 int height,
52 scoped_ptr<std::vector<unsigned char>> data, 53 std::unique_ptr<std::vector<unsigned char>> data,
53 Format format); 54 Format format);
54 55
55 private: 56 private:
56 void Upload(); 57 void Upload();
57 58
58 uint32_t BindTextureForSize(const mojo::Size size); 59 uint32_t BindTextureForSize(const mojo::Size size);
59 60
60 uint32_t TextureFormat() const { 61 uint32_t TextureFormat() const {
61 return format_ == BGRA ? GL_BGRA_EXT : GL_RGBA; 62 return format_ == BGRA ? GL_BGRA_EXT : GL_RGBA;
62 } 63 }
63 64
64 void SetIdNamespace(uint32_t id_namespace); 65 void SetIdNamespace(uint32_t id_namespace);
65 66
66 // WindowSurfaceClient implementation. 67 // WindowSurfaceClient implementation.
67 void OnResourcesReturned( 68 void OnResourcesReturned(
68 mus::WindowSurface* surface, 69 mus::WindowSurface* surface,
69 mojo::Array<mus::mojom::ReturnedResourcePtr> resources) override; 70 mojo::Array<mus::mojom::ReturnedResourcePtr> resources) override;
70 71
71 mus::Window* window_; 72 mus::Window* window_;
72 mus::mojom::GpuPtr gpu_service_; 73 mus::mojom::GpuPtr gpu_service_;
73 scoped_ptr<mus::WindowSurface> surface_; 74 std::unique_ptr<mus::WindowSurface> surface_;
74 MojoGLES2Context gles2_context_; 75 MojoGLES2Context gles2_context_;
75 76
76 mojo::Size size_; 77 mojo::Size size_;
77 uint32_t color_; 78 uint32_t color_;
78 int width_; 79 int width_;
79 int height_; 80 int height_;
80 Format format_; 81 Format format_;
81 scoped_ptr<std::vector<unsigned char>> bitmap_; 82 std::unique_ptr<std::vector<unsigned char>> bitmap_;
82 uint32_t next_resource_id_; 83 uint32_t next_resource_id_;
83 uint32_t id_namespace_; 84 uint32_t id_namespace_;
84 base::hash_map<uint32_t, uint32_t> resource_to_texture_id_map_; 85 base::hash_map<uint32_t, uint32_t> resource_to_texture_id_map_;
85 86
86 DISALLOW_COPY_AND_ASSIGN(BitmapUploader); 87 DISALLOW_COPY_AND_ASSIGN(BitmapUploader);
87 }; 88 };
88 89
89 } // namespace bitmap_uploader 90 } // namespace bitmap_uploader
90 91
91 #endif // COMPONENTS_BITMAP_UPLOADER_BITMAP_UPLAODER_H_ 92 #endif // COMPONENTS_BITMAP_UPLOADER_BITMAP_UPLAODER_H_
OLDNEW
« no previous file with comments | « components/autofill/core/browser/autofill_client.h ('k') | components/bitmap_uploader/bitmap_uploader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698