| 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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 | |
| 183 #if USE_IOSURFACE_FOR_2D_CANVAS | 181 #if USE_IOSURFACE_FOR_2D_CANVAS |
| 184 // All information associated with a CHROMIUM image. | 182 // All information associated with a CHROMIUM image. |
| 185 struct ImageInfo; | 183 struct ImageInfo; |
| 186 #endif // USE_IOSURFACE_FOR_2D_CANVAS | 184 #endif // USE_IOSURFACE_FOR_2D_CANVAS |
| 187 | 185 |
| 188 struct MailboxInfo { | 186 struct MailboxInfo { |
| 189 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); | 187 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); |
| 190 gpu::Mailbox m_mailbox; | 188 gpu::Mailbox m_mailbox; |
| 191 sk_sp<SkImage> m_image; | 189 sk_sp<SkImage> m_image; |
| 192 RefPtr<Canvas2DLayerBridge> m_parentLayerBridge; | 190 RefPtr<Canvas2DLayerBridge> m_parentLayerBridge; |
| 193 | 191 |
| 194 #if USE_IOSURFACE_FOR_2D_CANVAS | 192 #if USE_IOSURFACE_FOR_2D_CANVAS |
| 195 // If this mailbox wraps an IOSurface-backed texture, the ids of the | 193 // If this mailbox wraps an IOSurface-backed texture, the ids of the |
| 196 // CHROMIUM image and the texture. | 194 // CHROMIUM image and the texture. |
| 197 RefPtr<ImageInfo> m_imageInfo; | 195 RefPtr<ImageInfo> m_imageInfo; |
| 198 #endif // USE_IOSURFACE_FOR_2D_CANVAS | 196 #endif // USE_IOSURFACE_FOR_2D_CANVAS |
| 199 | 197 |
| 200 MailboxInfo(const MailboxInfo&); | 198 MailboxInfo(const MailboxInfo&); |
| 201 MailboxInfo(); | 199 MailboxInfo(); |
| 202 }; | 200 }; |
| 203 | 201 |
| 204 gpu::gles2::GLES2Interface* contextGL(); | 202 gpu::gles2::GLES2Interface* contextGL(); |
| 205 void startRecording(); | 203 void startRecording(); |
| 206 void skipQueuedDrawCommands(); | 204 void skipQueuedDrawCommands(); |
| 207 void flushRecordingOnly(); | 205 void flushRecordingOnly(); |
| 208 void reportSurfaceCreationFailure(); | 206 void reportSurfaceCreationFailure(); |
| 209 | 207 |
| 210 SkSurface* getOrCreateSurface(AccelerationHint = PreferAcceleration); | 208 PaintSurface* getOrCreateSurface(AccelerationHint = PreferAcceleration); |
| 211 bool shouldAccelerate(AccelerationHint) const; | 209 bool shouldAccelerate(AccelerationHint) const; |
| 212 | 210 |
| 213 // Returns the GL filter associated with |m_filterQuality|. | 211 // Returns the GL filter associated with |m_filterQuality|. |
| 214 GLenum getGLFilter(); | 212 GLenum getGLFilter(); |
| 215 | 213 |
| 216 #if USE_IOSURFACE_FOR_2D_CANVAS | 214 #if USE_IOSURFACE_FOR_2D_CANVAS |
| 217 // Creates an IOSurface-backed texture. Copies |image| into the texture. | 215 // Creates an IOSurface-backed texture. Copies |image| into the texture. |
| 218 // Prepares a mailbox from the texture. The caller must have created a new | 216 // Prepares a mailbox from the texture. The caller must have created a new |
| 219 // MailboxInfo, and prepended it to |m_mailboxs|. Returns whether the | 217 // MailboxInfo, and prepended it to |m_mailboxs|. Returns whether the |
| 220 // mailbox was successfully prepared. |mailbox| is an out parameter only | 218 // mailbox was successfully prepared. |mailbox| is an out parameter only |
| (...skipping 16 matching lines...) Expand all Loading... |
| 237 | 235 |
| 238 // Returns whether the mailbox was successfully prepared from the SkImage. | 236 // Returns whether the mailbox was successfully prepared from the SkImage. |
| 239 // The mailbox is an out parameter only populated on success. | 237 // The mailbox is an out parameter only populated on success. |
| 240 bool prepareMailboxFromImage(sk_sp<SkImage>, cc::TextureMailbox*); | 238 bool prepareMailboxFromImage(sk_sp<SkImage>, cc::TextureMailbox*); |
| 241 | 239 |
| 242 // Resets Skia's texture bindings. This method should be called after | 240 // Resets Skia's texture bindings. This method should be called after |
| 243 // changing texture bindings. | 241 // changing texture bindings. |
| 244 void resetSkiaTextureBinding(); | 242 void resetSkiaTextureBinding(); |
| 245 | 243 |
| 246 std::unique_ptr<PaintRecorder> m_recorder; | 244 std::unique_ptr<PaintRecorder> m_recorder; |
| 247 sk_sp<SkSurface> m_surface; | 245 sk_sp<PaintSurface> m_surface; |
| 248 std::unique_ptr<PaintCanvas> m_surfacePaintCanvas; | |
| 249 sk_sp<SkImage> m_hibernationImage; | 246 sk_sp<SkImage> m_hibernationImage; |
| 250 int m_initialSurfaceSaveCount; | 247 int m_initialSurfaceSaveCount; |
| 251 std::unique_ptr<WebExternalTextureLayer> m_layer; | 248 std::unique_ptr<WebExternalTextureLayer> m_layer; |
| 252 std::unique_ptr<WebGraphicsContext3DProvider> m_contextProvider; | 249 std::unique_ptr<WebGraphicsContext3DProvider> m_contextProvider; |
| 253 std::unique_ptr<SharedContextRateLimiter> m_rateLimiter; | 250 std::unique_ptr<SharedContextRateLimiter> m_rateLimiter; |
| 254 std::unique_ptr<Logger> m_logger; | 251 std::unique_ptr<Logger> m_logger; |
| 255 WeakPtrFactory<Canvas2DLayerBridge> m_weakPtrFactory; | 252 WeakPtrFactory<Canvas2DLayerBridge> m_weakPtrFactory; |
| 256 ImageBuffer* m_imageBuffer; | 253 ImageBuffer* m_imageBuffer; |
| 257 int m_msaaSampleCount; | 254 int m_msaaSampleCount; |
| 258 int m_framesSinceLastCommit = 0; | 255 int m_framesSinceLastCommit = 0; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 // Each element in this vector represents an IOSurface backed texture that | 295 // Each element in this vector represents an IOSurface backed texture that |
| 299 // is ready to be reused. | 296 // is ready to be reused. |
| 300 // Elements in this vector can safely be purged in low memory conditions. | 297 // Elements in this vector can safely be purged in low memory conditions. |
| 301 Vector<RefPtr<ImageInfo>> m_imageInfoCache; | 298 Vector<RefPtr<ImageInfo>> m_imageInfoCache; |
| 302 #endif // USE_IOSURFACE_FOR_2D_CANVAS | 299 #endif // USE_IOSURFACE_FOR_2D_CANVAS |
| 303 }; | 300 }; |
| 304 | 301 |
| 305 } // namespace blink | 302 } // namespace blink |
| 306 | 303 |
| 307 #endif | 304 #endif |
| OLD | NEW |