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

Side by Side Diff: content/renderer/pepper/ppb_image_data_impl.h

Issue 1873783003: Convert //content/renderer from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 CONTENT_RENDERER_PEPPER_PPB_IMAGE_DATA_IMPL_H_ 5 #ifndef CONTENT_RENDERER_PEPPER_PPB_IMAGE_DATA_IMPL_H_
6 #define CONTENT_RENDERER_PEPPER_PPB_IMAGE_DATA_IMPL_H_ 6 #define CONTENT_RENDERER_PEPPER_PPB_IMAGE_DATA_IMPL_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory>
11
10 #include "base/macros.h" 12 #include "base/macros.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "base/memory/shared_memory.h" 13 #include "base/memory/shared_memory.h"
13 #include "content/common/content_export.h" 14 #include "content/common/content_export.h"
14 #include "ppapi/c/ppb_image_data.h" 15 #include "ppapi/c/ppb_image_data.h"
15 #include "ppapi/shared_impl/ppb_image_data_shared.h" 16 #include "ppapi/shared_impl/ppb_image_data_shared.h"
16 #include "ppapi/shared_impl/resource.h" 17 #include "ppapi/shared_impl/resource.h"
17 #include "ppapi/thunk/ppb_image_data_api.h" 18 #include "ppapi/thunk/ppb_image_data_api.h"
18 #include "third_party/skia/include/core/SkCanvas.h" 19 #include "third_party/skia/include/core/SkCanvas.h"
19 20
20 class SkBitmap; 21 class SkBitmap;
21 class SkCanvas; 22 class SkCanvas;
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 void SetIsCandidateForReuse() override; 102 void SetIsCandidateForReuse() override;
102 103
103 const SkBitmap* GetMappedBitmap() const; 104 const SkBitmap* GetMappedBitmap() const;
104 105
105 private: 106 private:
106 ~PPB_ImageData_Impl() override; 107 ~PPB_ImageData_Impl() override;
107 108
108 PP_ImageDataFormat format_; 109 PP_ImageDataFormat format_;
109 int width_; 110 int width_;
110 int height_; 111 int height_;
111 scoped_ptr<Backend> backend_; 112 std::unique_ptr<Backend> backend_;
112 113
113 DISALLOW_COPY_AND_ASSIGN(PPB_ImageData_Impl); 114 DISALLOW_COPY_AND_ASSIGN(PPB_ImageData_Impl);
114 }; 115 };
115 116
116 class ImageDataPlatformBackend : public PPB_ImageData_Impl::Backend { 117 class ImageDataPlatformBackend : public PPB_ImageData_Impl::Backend {
117 public: 118 public:
118 // |is_browser_allocated| indicates whether the backing shared memory should 119 // |is_browser_allocated| indicates whether the backing shared memory should
119 // be allocated by the browser process. 120 // be allocated by the browser process.
120 ImageDataPlatformBackend(); 121 ImageDataPlatformBackend();
121 ~ImageDataPlatformBackend() override; 122 ~ImageDataPlatformBackend() override;
(...skipping 12 matching lines...) Expand all
134 uint32_t* byte_count) override; 135 uint32_t* byte_count) override;
135 SkCanvas* GetPlatformCanvas() override; 136 SkCanvas* GetPlatformCanvas() override;
136 SkCanvas* GetCanvas() override; 137 SkCanvas* GetCanvas() override;
137 const SkBitmap* GetMappedBitmap() const override; 138 const SkBitmap* GetMappedBitmap() const override;
138 139
139 private: 140 private:
140 // This will be NULL before initialization, and if this PPB_ImageData_Impl is 141 // This will be NULL before initialization, and if this PPB_ImageData_Impl is
141 // swapped with another. 142 // swapped with another.
142 int width_; 143 int width_;
143 int height_; 144 int height_;
144 scoped_ptr<TransportDIB> dib_; 145 std::unique_ptr<TransportDIB> dib_;
145 146
146 // When the device is mapped, this is the image. Null when umapped. 147 // When the device is mapped, this is the image. Null when umapped.
147 sk_sp<SkCanvas> mapped_canvas_; 148 sk_sp<SkCanvas> mapped_canvas_;
148 149
149 DISALLOW_COPY_AND_ASSIGN(ImageDataPlatformBackend); 150 DISALLOW_COPY_AND_ASSIGN(ImageDataPlatformBackend);
150 }; 151 };
151 152
152 class ImageDataSimpleBackend : public PPB_ImageData_Impl::Backend { 153 class ImageDataSimpleBackend : public PPB_ImageData_Impl::Backend {
153 public: 154 public:
154 ImageDataSimpleBackend(); 155 ImageDataSimpleBackend();
155 ~ImageDataSimpleBackend() override; 156 ~ImageDataSimpleBackend() override;
156 157
157 // PPB_ImageData_Impl::Backend implementation. 158 // PPB_ImageData_Impl::Backend implementation.
158 bool Init(PPB_ImageData_Impl* impl, 159 bool Init(PPB_ImageData_Impl* impl,
159 PP_ImageDataFormat format, 160 PP_ImageDataFormat format,
160 int width, 161 int width,
161 int height, 162 int height,
162 bool init_to_zero) override; 163 bool init_to_zero) override;
163 bool IsMapped() const override; 164 bool IsMapped() const override;
164 TransportDIB* GetTransportDIB() const override; 165 TransportDIB* GetTransportDIB() const override;
165 void* Map() override; 166 void* Map() override;
166 void Unmap() override; 167 void Unmap() override;
167 int32_t GetSharedMemory(base::SharedMemory** shm, 168 int32_t GetSharedMemory(base::SharedMemory** shm,
168 uint32_t* byte_count) override; 169 uint32_t* byte_count) override;
169 SkCanvas* GetPlatformCanvas() override; 170 SkCanvas* GetPlatformCanvas() override;
170 SkCanvas* GetCanvas() override; 171 SkCanvas* GetCanvas() override;
171 const SkBitmap* GetMappedBitmap() const override; 172 const SkBitmap* GetMappedBitmap() const override;
172 173
173 private: 174 private:
174 scoped_ptr<base::SharedMemory> shared_memory_; 175 std::unique_ptr<base::SharedMemory> shared_memory_;
175 // skia_bitmap_ is backed by shared_memory_. 176 // skia_bitmap_ is backed by shared_memory_.
176 SkBitmap skia_bitmap_; 177 SkBitmap skia_bitmap_;
177 sk_sp<SkCanvas> skia_canvas_; 178 sk_sp<SkCanvas> skia_canvas_;
178 uint32_t map_count_; 179 uint32_t map_count_;
179 180
180 DISALLOW_COPY_AND_ASSIGN(ImageDataSimpleBackend); 181 DISALLOW_COPY_AND_ASSIGN(ImageDataSimpleBackend);
181 }; 182 };
182 183
183 // Manages mapping an image resource if necessary. Use this to ensure the 184 // Manages mapping an image resource if necessary. Use this to ensure the
184 // image is mapped. The destructor will put the image back into the previous 185 // image is mapped. The destructor will put the image back into the previous
(...skipping 30 matching lines...) Expand all
215 PPB_ImageData_Impl* image_data_; 216 PPB_ImageData_Impl* image_data_;
216 bool is_valid_; 217 bool is_valid_;
217 bool needs_unmap_; 218 bool needs_unmap_;
218 219
219 DISALLOW_COPY_AND_ASSIGN(ImageDataAutoMapper); 220 DISALLOW_COPY_AND_ASSIGN(ImageDataAutoMapper);
220 }; 221 };
221 222
222 } // namespace content 223 } // namespace content
223 224
224 #endif // CONTENT_RENDERER_PEPPER_PPB_IMAGE_DATA_IMPL_H_ 225 #endif // CONTENT_RENDERER_PEPPER_PPB_IMAGE_DATA_IMPL_H_
OLDNEW
« no previous file with comments | « content/renderer/pepper/ppb_graphics_3d_impl.h ('k') | content/renderer/pepper/ppb_image_data_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698