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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.h

Issue 2690583002: Make cc/paint have concrete types (Closed)
Patch Set: PaintRecord as typedef, fixup playback calls Created 3 years, 9 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 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 class PLATFORM_EXPORT Logger { 171 class PLATFORM_EXPORT Logger {
172 public: 172 public:
173 virtual void reportHibernationEvent(HibernationEvent); 173 virtual void reportHibernationEvent(HibernationEvent);
174 virtual void didStartHibernating() {} 174 virtual void didStartHibernating() {}
175 virtual ~Logger() {} 175 virtual ~Logger() {}
176 }; 176 };
177 177
178 void setLoggerForTesting(std::unique_ptr<Logger>); 178 void setLoggerForTesting(std::unique_ptr<Logger>);
179 179
180 private: 180 private:
181 void ResetSurface();
182
181 #if USE_IOSURFACE_FOR_2D_CANVAS 183 #if USE_IOSURFACE_FOR_2D_CANVAS
182 // All information associated with a CHROMIUM image. 184 // All information associated with a CHROMIUM image.
183 struct ImageInfo; 185 struct ImageInfo;
184 #endif // USE_IOSURFACE_FOR_2D_CANVAS 186 #endif // USE_IOSURFACE_FOR_2D_CANVAS
185 187
186 struct MailboxInfo { 188 struct MailboxInfo {
187 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); 189 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW();
188 gpu::Mailbox m_mailbox; 190 gpu::Mailbox m_mailbox;
189 sk_sp<SkImage> m_image; 191 sk_sp<SkImage> m_image;
190 RefPtr<Canvas2DLayerBridge> m_parentLayerBridge; 192 RefPtr<Canvas2DLayerBridge> m_parentLayerBridge;
191 193
192 #if USE_IOSURFACE_FOR_2D_CANVAS 194 #if USE_IOSURFACE_FOR_2D_CANVAS
193 // If this mailbox wraps an IOSurface-backed texture, the ids of the 195 // If this mailbox wraps an IOSurface-backed texture, the ids of the
194 // CHROMIUM image and the texture. 196 // CHROMIUM image and the texture.
195 RefPtr<ImageInfo> m_imageInfo; 197 RefPtr<ImageInfo> m_imageInfo;
196 #endif // USE_IOSURFACE_FOR_2D_CANVAS 198 #endif // USE_IOSURFACE_FOR_2D_CANVAS
197 199
198 MailboxInfo(const MailboxInfo&); 200 MailboxInfo(const MailboxInfo&);
199 MailboxInfo(); 201 MailboxInfo();
200 }; 202 };
201 203
202 gpu::gles2::GLES2Interface* contextGL(); 204 gpu::gles2::GLES2Interface* contextGL();
203 void startRecording(); 205 void startRecording();
204 void skipQueuedDrawCommands(); 206 void skipQueuedDrawCommands();
205 void flushRecordingOnly(); 207 void flushRecordingOnly();
206 void reportSurfaceCreationFailure(); 208 void reportSurfaceCreationFailure();
207 209
208 PaintSurface* getOrCreateSurface(AccelerationHint = PreferAcceleration); 210 SkSurface* getOrCreateSurface(AccelerationHint = PreferAcceleration);
209 bool shouldAccelerate(AccelerationHint) const; 211 bool shouldAccelerate(AccelerationHint) const;
210 212
211 // Returns the GL filter associated with |m_filterQuality|. 213 // Returns the GL filter associated with |m_filterQuality|.
212 GLenum getGLFilter(); 214 GLenum getGLFilter();
213 215
214 #if USE_IOSURFACE_FOR_2D_CANVAS 216 #if USE_IOSURFACE_FOR_2D_CANVAS
215 // Creates an IOSurface-backed texture. Copies |image| into the texture. 217 // Creates an IOSurface-backed texture. Copies |image| into the texture.
216 // Prepares a mailbox from the texture. The caller must have created a new 218 // Prepares a mailbox from the texture. The caller must have created a new
217 // MailboxInfo, and prepended it to |m_mailboxs|. Returns whether the 219 // MailboxInfo, and prepended it to |m_mailboxs|. Returns whether the
218 // mailbox was successfully prepared. |mailbox| is an out parameter only 220 // mailbox was successfully prepared. |mailbox| is an out parameter only
(...skipping 16 matching lines...) Expand all
235 237
236 // Returns whether the mailbox was successfully prepared from the SkImage. 238 // Returns whether the mailbox was successfully prepared from the SkImage.
237 // The mailbox is an out parameter only populated on success. 239 // The mailbox is an out parameter only populated on success.
238 bool prepareMailboxFromImage(sk_sp<SkImage>, cc::TextureMailbox*); 240 bool prepareMailboxFromImage(sk_sp<SkImage>, cc::TextureMailbox*);
239 241
240 // Resets Skia's texture bindings. This method should be called after 242 // Resets Skia's texture bindings. This method should be called after
241 // changing texture bindings. 243 // changing texture bindings.
242 void resetSkiaTextureBinding(); 244 void resetSkiaTextureBinding();
243 245
244 std::unique_ptr<PaintRecorder> m_recorder; 246 std::unique_ptr<PaintRecorder> m_recorder;
245 sk_sp<PaintSurface> m_surface; 247 sk_sp<SkSurface> m_surface;
248 std::unique_ptr<PaintCanvas> m_surfacePaintCanvas;
246 sk_sp<SkImage> m_hibernationImage; 249 sk_sp<SkImage> m_hibernationImage;
247 int m_initialSurfaceSaveCount; 250 int m_initialSurfaceSaveCount;
248 std::unique_ptr<WebExternalTextureLayer> m_layer; 251 std::unique_ptr<WebExternalTextureLayer> m_layer;
249 std::unique_ptr<WebGraphicsContext3DProvider> m_contextProvider; 252 std::unique_ptr<WebGraphicsContext3DProvider> m_contextProvider;
250 std::unique_ptr<SharedContextRateLimiter> m_rateLimiter; 253 std::unique_ptr<SharedContextRateLimiter> m_rateLimiter;
251 std::unique_ptr<Logger> m_logger; 254 std::unique_ptr<Logger> m_logger;
252 WeakPtrFactory<Canvas2DLayerBridge> m_weakPtrFactory; 255 WeakPtrFactory<Canvas2DLayerBridge> m_weakPtrFactory;
253 ImageBuffer* m_imageBuffer; 256 ImageBuffer* m_imageBuffer;
254 int m_msaaSampleCount; 257 int m_msaaSampleCount;
255 int m_framesSinceLastCommit = 0; 258 int m_framesSinceLastCommit = 0;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 // Each element in this vector represents an IOSurface backed texture that 298 // Each element in this vector represents an IOSurface backed texture that
296 // is ready to be reused. 299 // is ready to be reused.
297 // Elements in this vector can safely be purged in low memory conditions. 300 // Elements in this vector can safely be purged in low memory conditions.
298 Vector<RefPtr<ImageInfo>> m_imageInfoCache; 301 Vector<RefPtr<ImageInfo>> m_imageInfoCache;
299 #endif // USE_IOSURFACE_FOR_2D_CANVAS 302 #endif // USE_IOSURFACE_FOR_2D_CANVAS
300 }; 303 };
301 304
302 } // namespace blink 305 } // namespace blink
303 306
304 #endif 307 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698