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

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

Issue 1154613006: Update pepper to not assume that SharedMemoryHandle is an int. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Another nits pass. Created 5 years, 6 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 "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/memory/shared_memory.h"
10 #include "content/common/content_export.h" 11 #include "content/common/content_export.h"
11 #include "ppapi/c/ppb_image_data.h" 12 #include "ppapi/c/ppb_image_data.h"
12 #include "ppapi/shared_impl/ppb_image_data_shared.h" 13 #include "ppapi/shared_impl/ppb_image_data_shared.h"
13 #include "ppapi/shared_impl/resource.h" 14 #include "ppapi/shared_impl/resource.h"
14 #include "ppapi/thunk/ppb_image_data_api.h" 15 #include "ppapi/thunk/ppb_image_data_api.h"
15 #include "third_party/skia/include/core/SkCanvas.h" 16 #include "third_party/skia/include/core/SkCanvas.h"
16 17
17 class SkBitmap; 18 class SkBitmap;
18 class SkCanvas; 19 class SkCanvas;
19 class TransportDIB; 20 class TransportDIB;
(...skipping 18 matching lines...) Expand all
38 virtual ~Backend() {}; 39 virtual ~Backend() {};
39 virtual bool Init(PPB_ImageData_Impl* impl, 40 virtual bool Init(PPB_ImageData_Impl* impl,
40 PP_ImageDataFormat format, 41 PP_ImageDataFormat format,
41 int width, 42 int width,
42 int height, 43 int height,
43 bool init_to_zero) = 0; 44 bool init_to_zero) = 0;
44 virtual bool IsMapped() const = 0; 45 virtual bool IsMapped() const = 0;
45 virtual TransportDIB* GetTransportDIB() const = 0; 46 virtual TransportDIB* GetTransportDIB() const = 0;
46 virtual void* Map() = 0; 47 virtual void* Map() = 0;
47 virtual void Unmap() = 0; 48 virtual void Unmap() = 0;
48 virtual int32_t GetSharedMemory(int* handle, uint32_t* byte_count) = 0; 49 virtual int32_t GetSharedMemory(base::SharedMemoryHandle* handle,
50 uint32_t* byte_count) = 0;
49 virtual SkCanvas* GetPlatformCanvas() = 0; 51 virtual SkCanvas* GetPlatformCanvas() = 0;
50 virtual SkCanvas* GetCanvas() = 0; 52 virtual SkCanvas* GetCanvas() = 0;
51 virtual const SkBitmap* GetMappedBitmap() const = 0; 53 virtual const SkBitmap* GetMappedBitmap() const = 0;
52 }; 54 };
53 55
54 // If you call this constructor, you must also call Init before use. Normally 56 // If you call this constructor, you must also call Init before use. Normally
55 // you should use the static Create function, but this constructor is needed 57 // you should use the static Create function, but this constructor is needed
56 // for some internal uses of ImageData (like Graphics2D). 58 // for some internal uses of ImageData (like Graphics2D).
57 PPB_ImageData_Impl(PP_Instance instance, 59 PPB_ImageData_Impl(PP_Instance instance,
58 PPB_ImageData_Shared::ImageDataType type); 60 PPB_ImageData_Shared::ImageDataType type);
(...skipping 24 matching lines...) Expand all
83 bool IsMapped() const; 85 bool IsMapped() const;
84 TransportDIB* GetTransportDIB() const; 86 TransportDIB* GetTransportDIB() const;
85 87
86 // Resource override. 88 // Resource override.
87 ppapi::thunk::PPB_ImageData_API* AsPPB_ImageData_API() override; 89 ppapi::thunk::PPB_ImageData_API* AsPPB_ImageData_API() override;
88 90
89 // PPB_ImageData_API implementation. 91 // PPB_ImageData_API implementation.
90 PP_Bool Describe(PP_ImageDataDesc* desc) override; 92 PP_Bool Describe(PP_ImageDataDesc* desc) override;
91 void* Map() override; 93 void* Map() override;
92 void Unmap() override; 94 void Unmap() override;
93 int32_t GetSharedMemory(int* handle, uint32_t* byte_count) override; 95 int32_t GetSharedMemory(base::SharedMemoryHandle* handle,
96 uint32_t* byte_count) override;
94 SkCanvas* GetPlatformCanvas() override; 97 SkCanvas* GetPlatformCanvas() override;
95 SkCanvas* GetCanvas() override; 98 SkCanvas* GetCanvas() override;
96 void SetIsCandidateForReuse() override; 99 void SetIsCandidateForReuse() override;
97 100
98 const SkBitmap* GetMappedBitmap() const; 101 const SkBitmap* GetMappedBitmap() const;
99 102
100 private: 103 private:
101 ~PPB_ImageData_Impl() override; 104 ~PPB_ImageData_Impl() override;
102 105
103 PP_ImageDataFormat format_; 106 PP_ImageDataFormat format_;
(...skipping 14 matching lines...) Expand all
118 // PPB_ImageData_Impl::Backend implementation. 121 // PPB_ImageData_Impl::Backend implementation.
119 bool Init(PPB_ImageData_Impl* impl, 122 bool Init(PPB_ImageData_Impl* impl,
120 PP_ImageDataFormat format, 123 PP_ImageDataFormat format,
121 int width, 124 int width,
122 int height, 125 int height,
123 bool init_to_zero) override; 126 bool init_to_zero) override;
124 bool IsMapped() const override; 127 bool IsMapped() const override;
125 TransportDIB* GetTransportDIB() const override; 128 TransportDIB* GetTransportDIB() const override;
126 void* Map() override; 129 void* Map() override;
127 void Unmap() override; 130 void Unmap() override;
128 int32_t GetSharedMemory(int* handle, uint32_t* byte_count) override; 131 int32_t GetSharedMemory(base::SharedMemoryHandle* handle,
132 uint32_t* byte_count) override;
129 SkCanvas* GetPlatformCanvas() override; 133 SkCanvas* GetPlatformCanvas() override;
130 SkCanvas* GetCanvas() override; 134 SkCanvas* GetCanvas() override;
131 const SkBitmap* GetMappedBitmap() const override; 135 const SkBitmap* GetMappedBitmap() const override;
132 136
133 private: 137 private:
134 // This will be NULL before initialization, and if this PPB_ImageData_Impl is 138 // This will be NULL before initialization, and if this PPB_ImageData_Impl is
135 // swapped with another. 139 // swapped with another.
136 int width_; 140 int width_;
137 int height_; 141 int height_;
138 scoped_ptr<TransportDIB> dib_; 142 scoped_ptr<TransportDIB> dib_;
(...skipping 12 matching lines...) Expand all
151 // PPB_ImageData_Impl::Backend implementation. 155 // PPB_ImageData_Impl::Backend implementation.
152 bool Init(PPB_ImageData_Impl* impl, 156 bool Init(PPB_ImageData_Impl* impl,
153 PP_ImageDataFormat format, 157 PP_ImageDataFormat format,
154 int width, 158 int width,
155 int height, 159 int height,
156 bool init_to_zero) override; 160 bool init_to_zero) override;
157 bool IsMapped() const override; 161 bool IsMapped() const override;
158 TransportDIB* GetTransportDIB() const override; 162 TransportDIB* GetTransportDIB() const override;
159 void* Map() override; 163 void* Map() override;
160 void Unmap() override; 164 void Unmap() override;
161 int32_t GetSharedMemory(int* handle, uint32_t* byte_count) override; 165 int32_t GetSharedMemory(base::SharedMemoryHandle* handle,
166 uint32_t* byte_count) override;
162 SkCanvas* GetPlatformCanvas() override; 167 SkCanvas* GetPlatformCanvas() override;
163 SkCanvas* GetCanvas() override; 168 SkCanvas* GetCanvas() override;
164 const SkBitmap* GetMappedBitmap() const override; 169 const SkBitmap* GetMappedBitmap() const override;
165 170
166 private: 171 private:
167 scoped_ptr<base::SharedMemory> shared_memory_; 172 scoped_ptr<base::SharedMemory> shared_memory_;
168 // skia_bitmap_ is backed by shared_memory_. 173 // skia_bitmap_ is backed by shared_memory_.
169 SkBitmap skia_bitmap_; 174 SkBitmap skia_bitmap_;
170 scoped_ptr<SkCanvas> skia_canvas_; 175 scoped_ptr<SkCanvas> skia_canvas_;
171 uint32 map_count_; 176 uint32 map_count_;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 PPB_ImageData_Impl* image_data_; 213 PPB_ImageData_Impl* image_data_;
209 bool is_valid_; 214 bool is_valid_;
210 bool needs_unmap_; 215 bool needs_unmap_;
211 216
212 DISALLOW_COPY_AND_ASSIGN(ImageDataAutoMapper); 217 DISALLOW_COPY_AND_ASSIGN(ImageDataAutoMapper);
213 }; 218 };
214 219
215 } // namespace content 220 } // namespace content
216 221
217 #endif // CONTENT_RENDERER_PEPPER_PPB_IMAGE_DATA_IMPL_H_ 222 #endif // CONTENT_RENDERER_PEPPER_PPB_IMAGE_DATA_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698