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

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

Issue 2476113002: Change call-sites now that SkCanvas is not ref-counted (Closed)
Patch Set: try fixing win again Created 4 years, 1 month 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> 10 #include <memory>
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 SkBitmap GetMappedBitmap() const override; 142 SkBitmap GetMappedBitmap() const override;
143 143
144 private: 144 private:
145 // This will be NULL before initialization, and if this PPB_ImageData_Impl is 145 // This will be NULL before initialization, and if this PPB_ImageData_Impl is
146 // swapped with another. 146 // swapped with another.
147 int width_; 147 int width_;
148 int height_; 148 int height_;
149 std::unique_ptr<TransportDIB> dib_; 149 std::unique_ptr<TransportDIB> dib_;
150 150
151 // When the device is mapped, this is the image. Null when umapped. 151 // When the device is mapped, this is the image. Null when umapped.
152 sk_sp<SkCanvas> mapped_canvas_; 152 std::unique_ptr<SkCanvas> mapped_canvas_;
153 153
154 DISALLOW_COPY_AND_ASSIGN(ImageDataPlatformBackend); 154 DISALLOW_COPY_AND_ASSIGN(ImageDataPlatformBackend);
155 }; 155 };
156 156
157 class ImageDataSimpleBackend : public PPB_ImageData_Impl::Backend { 157 class ImageDataSimpleBackend : public PPB_ImageData_Impl::Backend {
158 public: 158 public:
159 ImageDataSimpleBackend(); 159 ImageDataSimpleBackend();
160 ~ImageDataSimpleBackend() override; 160 ~ImageDataSimpleBackend() override;
161 161
162 // PPB_ImageData_Impl::Backend implementation. 162 // PPB_ImageData_Impl::Backend implementation.
163 bool Init(PPB_ImageData_Impl* impl, 163 bool Init(PPB_ImageData_Impl* impl,
164 PP_ImageDataFormat format, 164 PP_ImageDataFormat format,
165 int width, 165 int width,
166 int height, 166 int height,
167 bool init_to_zero) override; 167 bool init_to_zero) override;
168 bool IsMapped() const override; 168 bool IsMapped() const override;
169 TransportDIB* GetTransportDIB() const override; 169 TransportDIB* GetTransportDIB() const override;
170 void* Map() override; 170 void* Map() override;
171 void Unmap() override; 171 void Unmap() override;
172 int32_t GetSharedMemory(base::SharedMemory** shm, 172 int32_t GetSharedMemory(base::SharedMemory** shm,
173 uint32_t* byte_count) override; 173 uint32_t* byte_count) override;
174 SkCanvas* GetPlatformCanvas() override; 174 SkCanvas* GetPlatformCanvas() override;
175 SkCanvas* GetCanvas() override; 175 SkCanvas* GetCanvas() override;
176 SkBitmap GetMappedBitmap() const override; 176 SkBitmap GetMappedBitmap() const override;
177 177
178 private: 178 private:
179 std::unique_ptr<base::SharedMemory> shared_memory_; 179 std::unique_ptr<base::SharedMemory> shared_memory_;
180 // skia_bitmap_ is backed by shared_memory_. 180 // skia_bitmap_ is backed by shared_memory_.
181 SkBitmap skia_bitmap_; 181 SkBitmap skia_bitmap_;
182 sk_sp<SkCanvas> skia_canvas_; 182 std::unique_ptr<SkCanvas> skia_canvas_;
183 uint32_t map_count_; 183 uint32_t map_count_;
184 184
185 DISALLOW_COPY_AND_ASSIGN(ImageDataSimpleBackend); 185 DISALLOW_COPY_AND_ASSIGN(ImageDataSimpleBackend);
186 }; 186 };
187 187
188 // Manages mapping an image resource if necessary. Use this to ensure the 188 // Manages mapping an image resource if necessary. Use this to ensure the
189 // image is mapped. The destructor will put the image back into the previous 189 // image is mapped. The destructor will put the image back into the previous
190 // state. You must check is_valid() to make sure the image was successfully 190 // state. You must check is_valid() to make sure the image was successfully
191 // mapped before using it. 191 // mapped before using it.
192 // 192 //
(...skipping 27 matching lines...) Expand all
220 PPB_ImageData_Impl* image_data_; 220 PPB_ImageData_Impl* image_data_;
221 bool is_valid_; 221 bool is_valid_;
222 bool needs_unmap_; 222 bool needs_unmap_;
223 223
224 DISALLOW_COPY_AND_ASSIGN(ImageDataAutoMapper); 224 DISALLOW_COPY_AND_ASSIGN(ImageDataAutoMapper);
225 }; 225 };
226 226
227 } // namespace content 227 } // namespace content
228 228
229 #endif // CONTENT_RENDERER_PEPPER_PPB_IMAGE_DATA_IMPL_H_ 229 #endif // CONTENT_RENDERER_PEPPER_PPB_IMAGE_DATA_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698