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

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

Issue 1862693002: Replace skia::RefPtr with sk_sp<> in content/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: unget 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 "base/macros.h" 10 #include "base/macros.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/memory/shared_memory.h" 12 #include "base/memory/shared_memory.h"
13 #include "content/common/content_export.h" 13 #include "content/common/content_export.h"
14 #include "ppapi/c/ppb_image_data.h" 14 #include "ppapi/c/ppb_image_data.h"
15 #include "ppapi/shared_impl/ppb_image_data_shared.h" 15 #include "ppapi/shared_impl/ppb_image_data_shared.h"
16 #include "ppapi/shared_impl/resource.h" 16 #include "ppapi/shared_impl/resource.h"
17 #include "ppapi/thunk/ppb_image_data_api.h" 17 #include "ppapi/thunk/ppb_image_data_api.h"
18 #include "skia/ext/refptr.h"
19 #include "third_party/skia/include/core/SkCanvas.h" 18 #include "third_party/skia/include/core/SkCanvas.h"
20 19
21 class SkBitmap; 20 class SkBitmap;
22 class SkCanvas; 21 class SkCanvas;
23 class TransportDIB; 22 class TransportDIB;
24 23
25 namespace base { 24 namespace base {
26 class SharedMemory; 25 class SharedMemory;
27 } 26 }
28 27
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 const SkBitmap* GetMappedBitmap() const override; 137 const SkBitmap* GetMappedBitmap() const override;
139 138
140 private: 139 private:
141 // This will be NULL before initialization, and if this PPB_ImageData_Impl is 140 // This will be NULL before initialization, and if this PPB_ImageData_Impl is
142 // swapped with another. 141 // swapped with another.
143 int width_; 142 int width_;
144 int height_; 143 int height_;
145 scoped_ptr<TransportDIB> dib_; 144 scoped_ptr<TransportDIB> dib_;
146 145
147 // When the device is mapped, this is the image. Null when umapped. 146 // When the device is mapped, this is the image. Null when umapped.
148 skia::RefPtr<SkCanvas> mapped_canvas_; 147 sk_sp<SkCanvas> mapped_canvas_;
149 148
150 DISALLOW_COPY_AND_ASSIGN(ImageDataPlatformBackend); 149 DISALLOW_COPY_AND_ASSIGN(ImageDataPlatformBackend);
151 }; 150 };
152 151
153 class ImageDataSimpleBackend : public PPB_ImageData_Impl::Backend { 152 class ImageDataSimpleBackend : public PPB_ImageData_Impl::Backend {
154 public: 153 public:
155 ImageDataSimpleBackend(); 154 ImageDataSimpleBackend();
156 ~ImageDataSimpleBackend() override; 155 ~ImageDataSimpleBackend() override;
157 156
158 // PPB_ImageData_Impl::Backend implementation. 157 // PPB_ImageData_Impl::Backend implementation.
159 bool Init(PPB_ImageData_Impl* impl, 158 bool Init(PPB_ImageData_Impl* impl,
160 PP_ImageDataFormat format, 159 PP_ImageDataFormat format,
161 int width, 160 int width,
162 int height, 161 int height,
163 bool init_to_zero) override; 162 bool init_to_zero) override;
164 bool IsMapped() const override; 163 bool IsMapped() const override;
165 TransportDIB* GetTransportDIB() const override; 164 TransportDIB* GetTransportDIB() const override;
166 void* Map() override; 165 void* Map() override;
167 void Unmap() override; 166 void Unmap() override;
168 int32_t GetSharedMemory(base::SharedMemory** shm, 167 int32_t GetSharedMemory(base::SharedMemory** shm,
169 uint32_t* byte_count) override; 168 uint32_t* byte_count) override;
170 SkCanvas* GetPlatformCanvas() override; 169 SkCanvas* GetPlatformCanvas() override;
171 SkCanvas* GetCanvas() override; 170 SkCanvas* GetCanvas() override;
172 const SkBitmap* GetMappedBitmap() const override; 171 const SkBitmap* GetMappedBitmap() const override;
173 172
174 private: 173 private:
175 scoped_ptr<base::SharedMemory> shared_memory_; 174 scoped_ptr<base::SharedMemory> shared_memory_;
176 // skia_bitmap_ is backed by shared_memory_. 175 // skia_bitmap_ is backed by shared_memory_.
177 SkBitmap skia_bitmap_; 176 SkBitmap skia_bitmap_;
178 skia::RefPtr<SkCanvas> skia_canvas_; 177 sk_sp<SkCanvas> skia_canvas_;
179 uint32_t map_count_; 178 uint32_t map_count_;
180 179
181 DISALLOW_COPY_AND_ASSIGN(ImageDataSimpleBackend); 180 DISALLOW_COPY_AND_ASSIGN(ImageDataSimpleBackend);
182 }; 181 };
183 182
184 // Manages mapping an image resource if necessary. Use this to ensure the 183 // Manages mapping an image resource if necessary. Use this to ensure the
185 // image is mapped. The destructor will put the image back into the previous 184 // image is mapped. The destructor will put the image back into the previous
186 // state. You must check is_valid() to make sure the image was successfully 185 // state. You must check is_valid() to make sure the image was successfully
187 // mapped before using it. 186 // mapped before using it.
188 // 187 //
(...skipping 27 matching lines...) Expand all
216 PPB_ImageData_Impl* image_data_; 215 PPB_ImageData_Impl* image_data_;
217 bool is_valid_; 216 bool is_valid_;
218 bool needs_unmap_; 217 bool needs_unmap_;
219 218
220 DISALLOW_COPY_AND_ASSIGN(ImageDataAutoMapper); 219 DISALLOW_COPY_AND_ASSIGN(ImageDataAutoMapper);
221 }; 220 };
222 221
223 } // namespace content 222 } // namespace content
224 223
225 #endif // CONTENT_RENDERER_PEPPER_PPB_IMAGE_DATA_IMPL_H_ 224 #endif // CONTENT_RENDERER_PEPPER_PPB_IMAGE_DATA_IMPL_H_
OLDNEW
« no previous file with comments | « content/renderer/pepper/pepper_plugin_instance_impl.cc ('k') | content/renderer/pepper/ppb_image_data_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698