| 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 19 matching lines...) Expand all Loading... |
| 30 #include "cc/resources/texture_mailbox.h" | 30 #include "cc/resources/texture_mailbox.h" |
| 31 #include "platform/PlatformExport.h" | 31 #include "platform/PlatformExport.h" |
| 32 #include "platform/geometry/IntSize.h" | 32 #include "platform/geometry/IntSize.h" |
| 33 #include "platform/graphics/ImageBufferSurface.h" | 33 #include "platform/graphics/ImageBufferSurface.h" |
| 34 #include "platform/graphics/paint/PaintRecorder.h" | 34 #include "platform/graphics/paint/PaintRecorder.h" |
| 35 #include "platform/graphics/paint/PaintSurface.h" | 35 #include "platform/graphics/paint/PaintSurface.h" |
| 36 #include "public/platform/WebExternalTextureLayer.h" | 36 #include "public/platform/WebExternalTextureLayer.h" |
| 37 #include "public/platform/WebThread.h" | 37 #include "public/platform/WebThread.h" |
| 38 #include "third_party/khronos/GLES2/gl2.h" | 38 #include "third_party/khronos/GLES2/gl2.h" |
| 39 #include "third_party/skia/include/core/SkRefCnt.h" | 39 #include "third_party/skia/include/core/SkRefCnt.h" |
| 40 #include "ui/gfx/color_space.h" |
| 40 #include "wtf/Allocator.h" | 41 #include "wtf/Allocator.h" |
| 41 #include "wtf/Deque.h" | 42 #include "wtf/Deque.h" |
| 42 #include "wtf/RefCounted.h" | 43 #include "wtf/RefCounted.h" |
| 43 #include "wtf/RefPtr.h" | 44 #include "wtf/RefPtr.h" |
| 44 #include "wtf/Vector.h" | 45 #include "wtf/Vector.h" |
| 45 #include "wtf/WeakPtr.h" | 46 #include "wtf/WeakPtr.h" |
| 47 |
| 46 #include <memory> | 48 #include <memory> |
| 47 | 49 |
| 48 class SkImage; | 50 class SkImage; |
| 49 struct SkImageInfo; | 51 struct SkImageInfo; |
| 50 | 52 |
| 51 namespace gpu { | 53 namespace gpu { |
| 52 namespace gles2 { | 54 namespace gles2 { |
| 53 class GLES2Interface; | 55 class GLES2Interface; |
| 54 } | 56 } |
| 55 } | 57 } |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 DisableAcceleration, | 89 DisableAcceleration, |
| 88 EnableAcceleration, | 90 EnableAcceleration, |
| 89 ForceAccelerationForTesting, | 91 ForceAccelerationForTesting, |
| 90 }; | 92 }; |
| 91 | 93 |
| 92 Canvas2DLayerBridge(std::unique_ptr<WebGraphicsContext3DProvider>, | 94 Canvas2DLayerBridge(std::unique_ptr<WebGraphicsContext3DProvider>, |
| 93 const IntSize&, | 95 const IntSize&, |
| 94 int msaaSampleCount, | 96 int msaaSampleCount, |
| 95 OpacityMode, | 97 OpacityMode, |
| 96 AccelerationMode, | 98 AccelerationMode, |
| 97 sk_sp<SkColorSpace>, | 99 const gfx::ColorSpace&, |
| 100 bool skSurfacesUseColorSpace, |
| 98 SkColorType); | 101 SkColorType); |
| 99 | 102 |
| 100 ~Canvas2DLayerBridge() override; | 103 ~Canvas2DLayerBridge() override; |
| 101 | 104 |
| 102 // cc::TextureLayerClient implementation. | 105 // cc::TextureLayerClient implementation. |
| 103 bool PrepareTextureMailbox( | 106 bool PrepareTextureMailbox( |
| 104 cc::TextureMailbox* outMailbox, | 107 cc::TextureMailbox* outMailbox, |
| 105 std::unique_ptr<cc::SingleReleaseCallback>* outReleaseCallback) override; | 108 std::unique_ptr<cc::SingleReleaseCallback>* outReleaseCallback) override; |
| 106 | 109 |
| 107 // Callback for mailboxes given to the compositor from PrepareTextureMailbox. | 110 // Callback for mailboxes given to the compositor from PrepareTextureMailbox. |
| (...skipping 26 matching lines...) Expand all Loading... |
| 134 void prepareSurfaceForPaintingIfNeeded(); | 137 void prepareSurfaceForPaintingIfNeeded(); |
| 135 bool isHidden() { return m_isHidden; } | 138 bool isHidden() { return m_isHidden; } |
| 136 OpacityMode opacityMode() { return m_opacityMode; } | 139 OpacityMode opacityMode() { return m_opacityMode; } |
| 137 void dontUseIdleSchedulingForTesting() { | 140 void dontUseIdleSchedulingForTesting() { |
| 138 m_dontUseIdleSchedulingForTesting = true; | 141 m_dontUseIdleSchedulingForTesting = true; |
| 139 } | 142 } |
| 140 | 143 |
| 141 void beginDestruction(); | 144 void beginDestruction(); |
| 142 void hibernate(); | 145 void hibernate(); |
| 143 bool isHibernating() const { return m_hibernationImage.get(); } | 146 bool isHibernating() const { return m_hibernationImage.get(); } |
| 144 sk_sp<SkColorSpace> colorSpace() const { return m_colorSpace; } | 147 sk_sp<SkColorSpace> skSurfaceColorSpace() const; |
| 145 SkColorType colorType() const { return m_colorType; } | 148 SkColorType colorType() const { return m_colorType; } |
| 146 | 149 |
| 147 bool hasRecordedDrawCommands() { return m_haveRecordedDrawCommands; } | 150 bool hasRecordedDrawCommands() { return m_haveRecordedDrawCommands; } |
| 148 | 151 |
| 149 sk_sp<SkImage> newImageSnapshot(AccelerationHint, SnapshotReason); | 152 sk_sp<SkImage> newImageSnapshot(AccelerationHint, SnapshotReason); |
| 150 | 153 |
| 151 // The values of the enum entries must not change because they are used for | 154 // The values of the enum entries must not change because they are used for |
| 152 // usage metrics histograms. New values can be added to the end. | 155 // usage metrics histograms. New values can be added to the end. |
| 153 enum HibernationEvent { | 156 enum HibernationEvent { |
| 154 HibernationScheduled = 0, | 157 HibernationScheduled = 0, |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 // but sometimes we may have three due to the async nature of mailbox | 285 // but sometimes we may have three due to the async nature of mailbox |
| 283 // handling. | 286 // handling. |
| 284 MaxActiveMailboxes = 3, | 287 MaxActiveMailboxes = 3, |
| 285 }; | 288 }; |
| 286 | 289 |
| 287 Deque<MailboxInfo, MaxActiveMailboxes> m_mailboxes; | 290 Deque<MailboxInfo, MaxActiveMailboxes> m_mailboxes; |
| 288 GLenum m_lastFilter; | 291 GLenum m_lastFilter; |
| 289 AccelerationMode m_accelerationMode; | 292 AccelerationMode m_accelerationMode; |
| 290 OpacityMode m_opacityMode; | 293 OpacityMode m_opacityMode; |
| 291 const IntSize m_size; | 294 const IntSize m_size; |
| 292 sk_sp<SkColorSpace> m_colorSpace; | 295 // The color space that the compositor is to use. This will always be |
| 296 // defined. |
| 297 gfx::ColorSpace m_colorSpace; |
| 298 bool m_skSurfacesUseColorSpace = false; |
| 293 SkColorType m_colorType; | 299 SkColorType m_colorType; |
| 294 int m_recordingPixelCount; | 300 int m_recordingPixelCount; |
| 295 | 301 |
| 296 #if USE_IOSURFACE_FOR_2D_CANVAS | 302 #if USE_IOSURFACE_FOR_2D_CANVAS |
| 297 // Each element in this vector represents an IOSurface backed texture that | 303 // Each element in this vector represents an IOSurface backed texture that |
| 298 // is ready to be reused. | 304 // is ready to be reused. |
| 299 // Elements in this vector can safely be purged in low memory conditions. | 305 // Elements in this vector can safely be purged in low memory conditions. |
| 300 Vector<RefPtr<ImageInfo>> m_imageInfoCache; | 306 Vector<RefPtr<ImageInfo>> m_imageInfoCache; |
| 301 #endif // USE_IOSURFACE_FOR_2D_CANVAS | 307 #endif // USE_IOSURFACE_FOR_2D_CANVAS |
| 302 }; | 308 }; |
| 303 | 309 |
| 304 } // namespace blink | 310 } // namespace blink |
| 305 | 311 |
| 306 #endif | 312 #endif |
| OLD | NEW |