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