| OLD | NEW |
| 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 bool isAccelerated() const; | 106 bool isAccelerated() const; |
| 107 void setFilterQuality(SkFilterQuality); | 107 void setFilterQuality(SkFilterQuality); |
| 108 void setIsHidden(bool); | 108 void setIsHidden(bool); |
| 109 void setImageBuffer(ImageBuffer*); | 109 void setImageBuffer(ImageBuffer*); |
| 110 void didDraw(const FloatRect&); | 110 void didDraw(const FloatRect&); |
| 111 bool writePixels(const SkImageInfo&, const void* pixels, size_t rowBytes, in
t x, int y); | 111 bool writePixels(const SkImageInfo&, const void* pixels, size_t rowBytes, in
t x, int y); |
| 112 void flush(); | 112 void flush(); |
| 113 void flushGpu(); | 113 void flushGpu(); |
| 114 void prepareSurfaceForPaintingIfNeeded(); | 114 void prepareSurfaceForPaintingIfNeeded(); |
| 115 bool isHidden() { return m_isHidden; } | 115 bool isHidden() { return m_isHidden; } |
| 116 OpacityMode opacityMode() { return m_opacityMode; } | |
| 117 | 116 |
| 118 void beginDestruction(); | 117 void beginDestruction(); |
| 119 void hibernate(); | 118 void hibernate(); |
| 120 bool isHibernating() const { return m_hibernationImage.get(); } | 119 bool isHibernating() const { return m_hibernationImage.get(); } |
| 121 | 120 |
| 122 PassRefPtr<SkImage> newImageSnapshot(AccelerationHint, SnapshotReason); | 121 PassRefPtr<SkImage> newImageSnapshot(AccelerationHint, SnapshotReason); |
| 123 | 122 |
| 124 // The values of the enum entries must not change because they are used for | 123 // The values of the enum entries must not change because they are used for |
| 125 // usage metrics histograms. New values can be added to the end. | 124 // usage metrics histograms. New values can be added to the end. |
| 126 enum HibernationEvent { | 125 enum HibernationEvent { |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 }; | 186 }; |
| 188 | 187 |
| 189 Canvas2DLayerBridge(std::unique_ptr<WebGraphicsContext3DProvider>, const Int
Size&, int msaaSampleCount, OpacityMode, AccelerationMode); | 188 Canvas2DLayerBridge(std::unique_ptr<WebGraphicsContext3DProvider>, const Int
Size&, int msaaSampleCount, OpacityMode, AccelerationMode); |
| 190 gpu::gles2::GLES2Interface* contextGL(); | 189 gpu::gles2::GLES2Interface* contextGL(); |
| 191 void startRecording(); | 190 void startRecording(); |
| 192 void skipQueuedDrawCommands(); | 191 void skipQueuedDrawCommands(); |
| 193 void flushRecordingOnly(); | 192 void flushRecordingOnly(); |
| 194 void unregisterTaskObserver(); | 193 void unregisterTaskObserver(); |
| 195 void reportSurfaceCreationFailure(); | 194 void reportSurfaceCreationFailure(); |
| 196 | 195 |
| 197 void disableAcceleration(); | |
| 198 | |
| 199 // WebThread::TaskOberver implementation | 196 // WebThread::TaskOberver implementation |
| 200 void willProcessTask() override; | 197 void willProcessTask() override; |
| 201 void didProcessTask() override; | 198 void didProcessTask() override; |
| 202 | 199 |
| 203 SkSurface* getOrCreateSurface(AccelerationHint = PreferAcceleration); | 200 SkSurface* getOrCreateSurface(AccelerationHint = PreferAcceleration); |
| 204 bool shouldAccelerate(AccelerationHint) const; | 201 bool shouldAccelerate(AccelerationHint) const; |
| 205 | 202 |
| 206 // Returns the GL filter associated with |m_filterQuality|. | 203 // Returns the GL filter associated with |m_filterQuality|. |
| 207 GLenum getGLFilter(); | 204 GLenum getGLFilter(); |
| 208 | 205 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 SkFilterQuality m_filterQuality; | 250 SkFilterQuality m_filterQuality; |
| 254 bool m_isHidden; | 251 bool m_isHidden; |
| 255 bool m_isDeferralEnabled; | 252 bool m_isDeferralEnabled; |
| 256 bool m_isRegisteredTaskObserver; | 253 bool m_isRegisteredTaskObserver; |
| 257 bool m_renderingTaskCompletedForCurrentFrame; | 254 bool m_renderingTaskCompletedForCurrentFrame; |
| 258 bool m_softwareRenderingWhileHidden; | 255 bool m_softwareRenderingWhileHidden; |
| 259 bool m_surfaceCreationFailedAtLeastOnce = false; | 256 bool m_surfaceCreationFailedAtLeastOnce = false; |
| 260 bool m_hibernationScheduled = false; | 257 bool m_hibernationScheduled = false; |
| 261 | 258 |
| 262 friend class Canvas2DLayerBridgeTest; | 259 friend class Canvas2DLayerBridgeTest; |
| 263 friend class CanvasRenderingContext2DTest; | |
| 264 | 260 |
| 265 uint32_t m_lastImageId; | 261 uint32_t m_lastImageId; |
| 266 | 262 |
| 267 enum { | 263 enum { |
| 268 // We should normally not have more that two active mailboxes at a time, | 264 // We should normally not have more that two active mailboxes at a time, |
| 269 // but sometime we may have three due to the async nature of mailbox han
dling. | 265 // but sometime we may have three due to the async nature of mailbox han
dling. |
| 270 MaxActiveMailboxes = 3, | 266 MaxActiveMailboxes = 3, |
| 271 }; | 267 }; |
| 272 | 268 |
| 273 Deque<MailboxInfo, MaxActiveMailboxes> m_mailboxes; | 269 Deque<MailboxInfo, MaxActiveMailboxes> m_mailboxes; |
| 274 GLenum m_lastFilter; | 270 GLenum m_lastFilter; |
| 275 AccelerationMode m_accelerationMode; | 271 AccelerationMode m_accelerationMode; |
| 276 OpacityMode m_opacityMode; | 272 OpacityMode m_opacityMode; |
| 277 const IntSize m_size; | 273 const IntSize m_size; |
| 278 int m_recordingPixelCount; | 274 int m_recordingPixelCount; |
| 279 | 275 |
| 280 #if USE_IOSURFACE_FOR_2D_CANVAS | 276 #if USE_IOSURFACE_FOR_2D_CANVAS |
| 281 // Each element in this vector represents an IOSurface backed texture that | 277 // Each element in this vector represents an IOSurface backed texture that |
| 282 // is ready to be reused. | 278 // is ready to be reused. |
| 283 // Elements in this vector can safely be purged in low memory conditions. | 279 // Elements in this vector can safely be purged in low memory conditions. |
| 284 Vector<ImageInfo> m_imageInfoCache; | 280 Vector<ImageInfo> m_imageInfoCache; |
| 285 #endif // USE_IOSURFACE_FOR_2D_CANVAS | 281 #endif // USE_IOSURFACE_FOR_2D_CANVAS |
| 286 }; | 282 }; |
| 287 | 283 |
| 288 } // namespace blink | 284 } // namespace blink |
| 289 | 285 |
| 290 #endif | 286 #endif |
| OLD | NEW |