| 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 kDisableAcceleration, | 86 kDisableAcceleration, |
| 87 kEnableAcceleration, | 87 kEnableAcceleration, |
| 88 kForceAccelerationForTesting, | 88 kForceAccelerationForTesting, |
| 89 }; | 89 }; |
| 90 | 90 |
| 91 Canvas2DLayerBridge(std::unique_ptr<WebGraphicsContext3DProvider>, | 91 Canvas2DLayerBridge(std::unique_ptr<WebGraphicsContext3DProvider>, |
| 92 const IntSize&, | 92 const IntSize&, |
| 93 int msaa_sample_count, | 93 int msaa_sample_count, |
| 94 OpacityMode, | 94 OpacityMode, |
| 95 AccelerationMode, | 95 AccelerationMode, |
| 96 const gfx::ColorSpace&, | 96 const CanvasColorParams&); |
| 97 bool sk_surfaces_use_color_space, | |
| 98 SkColorType); | |
| 99 | 97 |
| 100 ~Canvas2DLayerBridge() override; | 98 ~Canvas2DLayerBridge() override; |
| 101 | 99 |
| 102 // cc::TextureLayerClient implementation. | 100 // cc::TextureLayerClient implementation. |
| 103 bool PrepareTextureMailbox(cc::TextureMailbox* out_mailbox, | 101 bool PrepareTextureMailbox(cc::TextureMailbox* out_mailbox, |
| 104 std::unique_ptr<cc::SingleReleaseCallback>* | 102 std::unique_ptr<cc::SingleReleaseCallback>* |
| 105 out_release_callback) override; | 103 out_release_callback) override; |
| 106 | 104 |
| 107 // Callback for mailboxes given to the compositor from PrepareTextureMailbox. | 105 // Callback for mailboxes given to the compositor from PrepareTextureMailbox. |
| 108 void MailboxReleased(const gpu::Mailbox&, | 106 void MailboxReleased(const gpu::Mailbox&, |
| (...skipping 25 matching lines...) Expand all Loading... |
| 134 void FlushGpu(); | 132 void FlushGpu(); |
| 135 bool IsHidden() { return is_hidden_; } | 133 bool IsHidden() { return is_hidden_; } |
| 136 OpacityMode GetOpacityMode() { return opacity_mode_; } | 134 OpacityMode GetOpacityMode() { return opacity_mode_; } |
| 137 void DontUseIdleSchedulingForTesting() { | 135 void DontUseIdleSchedulingForTesting() { |
| 138 dont_use_idle_scheduling_for_testing_ = true; | 136 dont_use_idle_scheduling_for_testing_ = true; |
| 139 } | 137 } |
| 140 | 138 |
| 141 void BeginDestruction(); | 139 void BeginDestruction(); |
| 142 void Hibernate(); | 140 void Hibernate(); |
| 143 bool IsHibernating() const { return hibernation_image_.get(); } | 141 bool IsHibernating() const { return hibernation_image_.get(); } |
| 144 sk_sp<SkColorSpace> SkSurfaceColorSpace() const; | 142 const CanvasColorParams& color_params() const { return color_params_; } |
| 145 SkColorType ColorType() const { return color_type_; } | |
| 146 | 143 |
| 147 bool HasRecordedDrawCommands() { return have_recorded_draw_commands_; } | 144 bool HasRecordedDrawCommands() { return have_recorded_draw_commands_; } |
| 148 | 145 |
| 149 sk_sp<SkImage> NewImageSnapshot(AccelerationHint, SnapshotReason); | 146 sk_sp<SkImage> NewImageSnapshot(AccelerationHint, SnapshotReason); |
| 150 | 147 |
| 151 // The values of the enum entries must not change because they are used for | 148 // 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. | 149 // usage metrics histograms. New values can be added to the end. |
| 153 enum HibernationEvent { | 150 enum HibernationEvent { |
| 154 kHibernationScheduled = 0, | 151 kHibernationScheduled = 0, |
| 155 kHibernationAbortedDueToDestructionWhileHibernatePending = 1, | 152 kHibernationAbortedDueToDestructionWhileHibernatePending = 1, |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 // but sometimes we may have three due to the async nature of mailbox | 276 // but sometimes we may have three due to the async nature of mailbox |
| 280 // handling. | 277 // handling. |
| 281 kMaxActiveMailboxes = 3, | 278 kMaxActiveMailboxes = 3, |
| 282 }; | 279 }; |
| 283 | 280 |
| 284 Deque<MailboxInfo, kMaxActiveMailboxes> mailboxes_; | 281 Deque<MailboxInfo, kMaxActiveMailboxes> mailboxes_; |
| 285 GLenum last_filter_; | 282 GLenum last_filter_; |
| 286 AccelerationMode acceleration_mode_; | 283 AccelerationMode acceleration_mode_; |
| 287 OpacityMode opacity_mode_; | 284 OpacityMode opacity_mode_; |
| 288 const IntSize size_; | 285 const IntSize size_; |
| 289 // The color space that the compositor is to use. This will always be | 286 CanvasColorParams color_params_; |
| 290 // defined. | |
| 291 gfx::ColorSpace color_space_; | |
| 292 bool sk_surfaces_use_color_space_ = false; | |
| 293 SkColorType color_type_; | |
| 294 int recording_pixel_count_; | 287 int recording_pixel_count_; |
| 295 | 288 |
| 296 #if USE_IOSURFACE_FOR_2D_CANVAS | 289 #if USE_IOSURFACE_FOR_2D_CANVAS |
| 297 // Each element in this vector represents an IOSurface backed texture that | 290 // Each element in this vector represents an IOSurface backed texture that |
| 298 // is ready to be reused. | 291 // is ready to be reused. |
| 299 // Elements in this vector can safely be purged in low memory conditions. | 292 // Elements in this vector can safely be purged in low memory conditions. |
| 300 Vector<RefPtr<ImageInfo>> image_info_cache_; | 293 Vector<RefPtr<ImageInfo>> image_info_cache_; |
| 301 #endif // USE_IOSURFACE_FOR_2D_CANVAS | 294 #endif // USE_IOSURFACE_FOR_2D_CANVAS |
| 302 }; | 295 }; |
| 303 | 296 |
| 304 } // namespace blink | 297 } // namespace blink |
| 305 | 298 |
| 306 #endif | 299 #endif |
| OLD | NEW |