Chromium Code Reviews| 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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 152 virtual void reportHibernationEvent(HibernationEvent); | 152 virtual void reportHibernationEvent(HibernationEvent); |
| 153 virtual void didStartHibernating() { } | 153 virtual void didStartHibernating() { } |
| 154 virtual ~Logger() { } | 154 virtual ~Logger() { } |
| 155 }; | 155 }; |
| 156 | 156 |
| 157 void setLoggerForTesting(std::unique_ptr<Logger>); | 157 void setLoggerForTesting(std::unique_ptr<Logger>); |
| 158 | 158 |
| 159 private: | 159 private: |
| 160 #if USE_IOSURFACE_FOR_2D_CANVAS | 160 #if USE_IOSURFACE_FOR_2D_CANVAS |
| 161 // All information associated with a CHROMIUM image. | 161 // All information associated with a CHROMIUM image. |
| 162 struct ImageInfo { | 162 struct ImageInfo; |
| 163 ImageInfo() {} | |
| 164 ImageInfo(GLuint imageId, GLuint textureId); | |
| 165 | |
| 166 // Whether this structure holds references to a CHROMIUM image. | |
| 167 bool empty(); | |
| 168 | |
| 169 // The id of the CHROMIUM image. | |
| 170 GLuint m_imageId = 0; | |
| 171 | |
| 172 // The id of the texture bound to the CHROMIUM image. | |
| 173 GLuint m_textureId = 0; | |
| 174 }; | |
| 175 #endif // USE_IOSURFACE_FOR_2D_CANVAS | 163 #endif // USE_IOSURFACE_FOR_2D_CANVAS |
| 176 | 164 |
| 177 struct MailboxInfo { | 165 struct MailboxInfo { |
| 178 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); | 166 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); |
| 179 gpu::Mailbox m_mailbox; | 167 gpu::Mailbox m_mailbox; |
| 180 sk_sp<SkImage> m_image; | 168 sk_sp<SkImage> m_image; |
| 181 RefPtr<Canvas2DLayerBridge> m_parentLayerBridge; | 169 RefPtr<Canvas2DLayerBridge> m_parentLayerBridge; |
| 182 | 170 |
| 183 #if USE_IOSURFACE_FOR_2D_CANVAS | 171 #if USE_IOSURFACE_FOR_2D_CANVAS |
| 184 // If this mailbox wraps an IOSurface-backed texture, the ids of the | 172 // If this mailbox wraps an IOSurface-backed texture, the ids of the |
| 185 // CHROMIUM image and the texture. | 173 // CHROMIUM image and the texture. |
| 186 ImageInfo m_imageInfo; | 174 RefPtr<ImageInfo> m_imageInfo; |
|
ccameron
2016/09/27 19:53:14
This could reasonably be expected to be a std::uni
| |
| 187 #endif // USE_IOSURFACE_FOR_2D_CANVAS | 175 #endif // USE_IOSURFACE_FOR_2D_CANVAS |
| 188 | 176 |
| 189 MailboxInfo(const MailboxInfo&); | 177 MailboxInfo(const MailboxInfo&); |
| 190 MailboxInfo(); | 178 MailboxInfo(); |
| 191 }; | 179 }; |
| 192 | 180 |
| 193 gpu::gles2::GLES2Interface* contextGL(); | 181 gpu::gles2::GLES2Interface* contextGL(); |
| 194 void startRecording(); | 182 void startRecording(); |
| 195 void skipQueuedDrawCommands(); | 183 void skipQueuedDrawCommands(); |
| 196 void flushRecordingOnly(); | 184 void flushRecordingOnly(); |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 210 #if USE_IOSURFACE_FOR_2D_CANVAS | 198 #if USE_IOSURFACE_FOR_2D_CANVAS |
| 211 // Creates an IOSurface-backed texture. Copies |image| into the texture. | 199 // Creates an IOSurface-backed texture. Copies |image| into the texture. |
| 212 // Prepares a mailbox from the texture. The caller must have created a new | 200 // Prepares a mailbox from the texture. The caller must have created a new |
| 213 // MailboxInfo, and prepended it to |m_mailboxs|. Returns whether the | 201 // MailboxInfo, and prepended it to |m_mailboxs|. Returns whether the |
| 214 // mailbox was successfully prepared. |mailbox| is an out parameter only | 202 // mailbox was successfully prepared. |mailbox| is an out parameter only |
| 215 // populated on success. | 203 // populated on success. |
| 216 bool prepareIOSurfaceMailboxFromImage(SkImage*, cc::TextureMailbox*); | 204 bool prepareIOSurfaceMailboxFromImage(SkImage*, cc::TextureMailbox*); |
| 217 | 205 |
| 218 // Creates an IOSurface-backed texture. Returns an ImageInfo, which is empty | 206 // Creates an IOSurface-backed texture. Returns an ImageInfo, which is empty |
| 219 // on failure. The caller takes ownership of both the texture and the image. | 207 // on failure. The caller takes ownership of both the texture and the image. |
| 220 ImageInfo createIOSurfaceBackedTexture(); | 208 RefPtr<ImageInfo> createIOSurfaceBackedTexture(); |
| 221 | 209 |
| 222 // Releases all resources associated with a CHROMIUM image. | 210 // Releases all resources associated with a CHROMIUM image. |
| 223 void deleteCHROMIUMImage(ImageInfo); | 211 void deleteCHROMIUMImage(RefPtr<ImageInfo>); |
| 224 | 212 |
| 225 // Releases all resources in the CHROMIUM image cache. | 213 // Releases all resources in the CHROMIUM image cache. |
| 226 void clearCHROMIUMImageCache(); | 214 void clearCHROMIUMImageCache(); |
| 227 #endif // USE_IOSURFACE_FOR_2D_CANVAS | 215 #endif // USE_IOSURFACE_FOR_2D_CANVAS |
| 228 | 216 |
| 229 // Prepends a new MailboxInfo object to |m_mailboxes|. | 217 // Prepends a new MailboxInfo object to |m_mailboxes|. |
| 230 void createMailboxInfo(); | 218 void createMailboxInfo(); |
| 231 | 219 |
| 232 // Returns whether the mailbox was successfully prepared from the SkImage. | 220 // Returns whether the mailbox was successfully prepared from the SkImage. |
| 233 // The mailbox is an out parameter only populated on success. | 221 // The mailbox is an out parameter only populated on success. |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 277 AccelerationMode m_accelerationMode; | 265 AccelerationMode m_accelerationMode; |
| 278 OpacityMode m_opacityMode; | 266 OpacityMode m_opacityMode; |
| 279 const IntSize m_size; | 267 const IntSize m_size; |
| 280 sk_sp<SkColorSpace> m_colorSpace; | 268 sk_sp<SkColorSpace> m_colorSpace; |
| 281 int m_recordingPixelCount; | 269 int m_recordingPixelCount; |
| 282 | 270 |
| 283 #if USE_IOSURFACE_FOR_2D_CANVAS | 271 #if USE_IOSURFACE_FOR_2D_CANVAS |
| 284 // Each element in this vector represents an IOSurface backed texture that | 272 // Each element in this vector represents an IOSurface backed texture that |
| 285 // is ready to be reused. | 273 // is ready to be reused. |
| 286 // Elements in this vector can safely be purged in low memory conditions. | 274 // Elements in this vector can safely be purged in low memory conditions. |
| 287 Vector<ImageInfo> m_imageInfoCache; | 275 Vector<RefPtr<ImageInfo>> m_imageInfoCache; |
| 288 #endif // USE_IOSURFACE_FOR_2D_CANVAS | 276 #endif // USE_IOSURFACE_FOR_2D_CANVAS |
| 289 }; | 277 }; |
| 290 | 278 |
| 291 } // namespace blink | 279 } // namespace blink |
| 292 | 280 |
| 293 #endif | 281 #endif |
| OLD | NEW |